Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

where to obtain APN.mat file? #2

Closed
litianjun05090 opened this issue Mar 6, 2023 · 21 comments
Closed

where to obtain APN.mat file? #2

litianjun05090 opened this issue Mar 6, 2023 · 21 comments

Comments

@litianjun05090
Copy link

Already download all the files mentioned but don't know where to obtain APN.mat file

@BigHyf
Copy link
Collaborator

BigHyf commented Mar 6, 2023

You can download apn.mat via the following GitHub link:
https://github.com/wenjiaXu/APN-ZSL

@litianjun05090
Copy link
Author

Thanks,and where to get id2imagepixel.pkl .....

@BigHyf
Copy link
Collaborator

BigHyf commented Mar 7, 2023

This data is too large to upload, but it is relatively easy to generate this data.
You can find the image based on the image id of the dataset and run FeatureExtractor through the corresponding swin or deit model

@Bingyang0410
Copy link

Can you introduce the process of acquiring these pkl files in detail, or give us some reference repo in GitHub? Thanks a lot!

@BigHyf
Copy link
Collaborator

BigHyf commented Apr 10, 2023

https://huggingface.co/docs/transformers/model_doc/swin#transformers.SwinModel
It may will help you generate these pkl files.

@Bingyang0410
Copy link

https://huggingface.co/docs/transformers/model_doc/swin#transformers.SwinModel It may will help you generate these pkl files.

Got it! Thank u very much

@Bingyang0410
Copy link

What's more, there still another question about the output of SwinModel to generate id2imagepixel.pkl. Which parameter I need to choose in the SwinModelOutput? (such as pooler_output/pooler_output/hidden_states/hidden_states/reshaped_hidden_states)

@BigHyf
Copy link
Collaborator

BigHyf commented Apr 13, 2023

pooler_output

@WenshangY
Copy link

Thank you for the code. What I want to ask is can you give the exact steps or code to generate the id2imagepixel.pkl file?

@BigHyf
Copy link
Collaborator

BigHyf commented Jul 7, 2023

This is a process of generating the embedding according to the image. Please refer to the specific implementation process mentioned in this issue. Please feel free to ask further questions if you have any confuse.

@passer
Copy link

passer commented Sep 5, 2023

Thank you very much for sharing, I am a newbie, can you tell me the detailed steps for getting the ID2imagepixel.pkl file?

@BigHyf
Copy link
Collaborator

BigHyf commented Sep 5, 2023

Thank you very much for sharing, I am a newbie, can you tell me the detailed steps for getting the ID2imagepixel.pkl file?

You can follow this Python script(https://github.com/zjukg/DUET/blob/main/cache/generate_embedding.py) to understand the detailed steps. Essentially, the image embedding is obtained through the image url and then saved into a pkl file

@passer
Copy link

passer commented Sep 6, 2023

Thank u very much

@WenshangY
Copy link

Hello, when I'm running: bash script/AWA2/AWA2_GZSL.sh, I get the following error: RuntimeError: Tensors must have same number of dimensions: got 2 and 4. This is also the case when I run it on the CUB dataset : input = torch.cat((input_v[index].unsqueeze(0), positive_input.unsqueeze(0), negative_input_1_1.unsqueeze(0), negative_input_1_2.unsqueeze(0), negative_input_2_1.unsqueeze(0), negative_input_2_2.unsqueeze(0)), 0) RuntimeError: Tensors must have same number of dimensions: got 2 and 4. Is there a bug in the experiment?

@BigHyf
Copy link
Collaborator

BigHyf commented Sep 14, 2023

Hello, when I'm running: bash script/AWA2/AWA2_GZSL.sh, I get the following error: RuntimeError: Tensors must have same number of dimensions: got 2 and 4. This is also the case when I run it on the CUB dataset : input = torch.cat((input_v[index].unsqueeze(0), positive_input.unsqueeze(0), negative_input_1_1.unsqueeze(0), negative_input_1_2.unsqueeze(0), negative_input_2_1.unsqueeze(0), negative_input_2_2.unsqueeze(0)), 0) RuntimeError: Tensors must have same number of dimensions: got 2 and 4. Is there a bug in the experiment?

It may be an issue with the dataset processing. You can check the dimension information of input_v[index], positive_input, and negative_input_1_1, and then perform targeted debugging.

@WenshangY
Copy link

您好,当我运行时:bash script/AWA2/AWA2_GZSL.sh,我收到以下错误:运行时错误:张量必须具有相同数量的维度:得到 2 和 4。当我在 CUB 数据集上运行它时也是如此:input = torch.cat((input_v[index].unsqueeze(0), positive_input.unsqueeze(0), negative_input_1_1.unsqueeze(0), negative_input_1_2.unsqueeze(0), negative_input_2_1.unsqueeze(0), negative_input_2_2.unsqueeze(0)), 0) 运行时错误: 张量必须具有相同的维数: 得到 2 和 4。实验中是否有错误?

这可能是数据集处理的问题。您可以查看input_v[索引]、positive_input、negative_input_1_1的维度信息,然后进行有针对性的调试。
Thank you very much for your answer, I think there is a problem with this code: input = torch.cat((input_v[index].unsqueeze(0), positive_input.unsqueeze(0), negative_input_1_1.unsqueeze(0), negative_input_1_2.unsqueeze(0), negative_input_2_1.unsqueeze(0), negative_input_2_2.unsqueeze(0)), 0)..
I get their dimensions as:input_v[index] (3,224,224) and all the others as (1000), after .unsqueeze(0),the shape is a tensor of (1,3,224,224) and (1, 1000), which is obviously not possible to splice with the :torch.cat function. After that I have tried to convert them to tensor of the same dimension, but its form of data interpretation may change. Now I'm wondering if there is something wrong with the code or with the dimension of the generated tensor.Can you help me to discover the problem, thanks a lot!

@BigHyf
Copy link
Collaborator

BigHyf commented Sep 19, 2023

您好,当我运行时:bash script/AWA2/AWA2_GZSL.sh,我收到以下错误:运行时错误:张量必须具有相同数量的维度:得到 2 和 4。当我在 CUB 数据集上运行它时也是如此:input = torch.cat((input_v[index].unsqueeze(0), positive_input.unsqueeze(0), negative_input_1_1.unsqueeze(0), negative_input_1_2.unsqueeze(0), negative_input_2_1.unsqueeze(0), negative_input_2_2.unsqueeze(0)), 0) 运行时错误: 张量必须具有相同的维数: 得到 2 和 4。实验中是否有错误?

这可能是数据集处理的问题。您可以查看input_v[索引]、positive_input、negative_input_1_1的维度信息,然后进行有针对性的调试。
Thank you very much for your answer, I think there is a problem with this code: input = torch.cat((input_v[index].unsqueeze(0), positive_input.unsqueeze(0), negative_input_1_1.unsqueeze(0), negative_input_1_2.unsqueeze(0), negative_input_2_1.unsqueeze(0), negative_input_2_2.unsqueeze(0)), 0)..
I get their dimensions as:input_v[index] (3,224,224) and all the others as (1000), after .unsqueeze(0),the shape is a tensor of (1,3,224,224) and (1, 1000), which is obviously not possible to splice with the :torch.cat function. After that I have tried to convert them to tensor of the same dimension, but its form of data interpretation may change. Now I'm wondering if there is something wrong with the code or with the dimension of the generated tensor.Can you help me to discover the problem, thanks a lot!

I may have been unclear before, I provided the entire generating of the embedding script. In my impression, generate_embedding.py should not generate an embedding, but a feature (3,224,224). Since it's been a long time, this is a temporary script that we saved for you to refer to to generate ID2imagepixel.pkl, not a complete input/output.
You can look at the input and implementation process into the forward in the Multi_attention_Model and the implementation process described in our paper to see where the dimension problem lies.

@BigHyf
Copy link
Collaborator

BigHyf commented Sep 19, 2023

您好,当我运行时:bash script/AWA2/AWA2_GZSL.sh,我收到以下错误:运行时错误:张量必须具有相同数量的维度:得到 2 和 4。当我在 CUB 数据集上运行它时也是如此:input = torch.cat((input_v[index].unsqueeze(0), positive_input.unsqueeze(0), negative_input_1_1.unsqueeze(0), negative_input_1_2.unsqueeze(0), negative_input_2_1.unsqueeze(0), negative_input_2_2.unsqueeze(0)), 0) 运行时错误: 张量必须具有相同的维数: 得到 2 和 4。实验中是否有错误?

这可能是数据集处理的问题。您可以查看input_v[索引]、positive_input、negative_input_1_1的维度信息,然后进行有针对性的调试。
Thank you very much for your answer, I think there is a problem with this code: input = torch.cat((input_v[index].unsqueeze(0), positive_input.unsqueeze(0), negative_input_1_1.unsqueeze(0), negative_input_1_2.unsqueeze(0), negative_input_2_1.unsqueeze(0), negative_input_2_2.unsqueeze(0)), 0)..
I get their dimensions as:input_v[index] (3,224,224) and all the others as (1000), after .unsqueeze(0),the shape is a tensor of (1,3,224,224) and (1, 1000), which is obviously not possible to splice with the :torch.cat function. After that I have tried to convert them to tensor of the same dimension, but its form of data interpretation may change. Now I'm wondering if there is something wrong with the code or with the dimension of the generated tensor.Can you help me to discover the problem, thanks a lot!

I may have been unclear before, I provided the entire generating of the embedding script. In my impression, generate_embedding.py should not generate a embedding, but a feature (3,224,224). Since it's been a long time, this is a temporary script that we saved for you to refer to to generate ID2imagepixel.pkl, not a complete input/output.
You can look at the input and implementation process into the forward in the Multi_attention_Model and the implementation process described in our paper to see where the dimension problem lies.

@wangwangwangj
Copy link

您好,当我运行时:bash script/AWA2/AWA2_GZSL.sh,我收到以下错误:运行时错误:张量必须具有相同数量的维度:得到 2 和 4。当我在 CUB 数据集上运行它时也是如此:input = torch.cat((input_v[index].unsqueeze(0), positive_input.unsqueeze(0), negative_input_1_1.unsqueeze(0), negative_input_1_2.unsqueeze(0), negative_input_2_1.unsqueeze(0), negative_input_2_2.unsqueeze(0)), 0) 运行时错误: 张量必须具有相同的维数: 得到 2 和 4。实验中是否有错误?

这可能是数据集处理的问题。您可以查看input_v[索引]、positive_input、negative_input_1_1的维度信息,然后进行有针对性的调试。非常感谢您的回答,我认为这段代码有问题:input = torch.cat((input_v[index].unsqueeze(0), positive_input.unsqueeze(0), negative_input_1_1.unsqueeze(0), negative_input_1_2.unsqueeze(0), negative_input_2_1.unsqueeze(0), negative_input_2_2.unsqueeze(0)), 0)..我得到它们的维度为:input_v[index](3,224,224),所有其他维度为(1000),在.unsqueeze(0)之后,形状是(1,3,224,224)和(1, 1000)的张量,这显然不可能与:torch.cat 函数拼接。之后,我尝试将它们转换为相同维度的张量,但其数据解释的形式可能会发生变化。现在我想知道代码或生成的张量的维度是否有问题。你能帮我发现问题吗,非常感谢!

Hello, I have the same problem as you, did you solve it? If you don't mind, can you tell us how it was solved, thank you very much!

@hackerchenzhuo
Copy link
Collaborator

Hi everyone, thanks for your attention.

Our cache data for (CUB, AWA, SUN) are now available here (Baidu cloud, 19.89G, Code: s07d).

@litianjun05090 @Bingyang0410 @wangwangwangj @Even008 @passer

@WenshangY
Copy link

Hi, I would like to ask one other question, the splitting standard we usually use is xlsa17, but how is the file 'att_splits.mat ' generated? I didn't find the method in the original paper! Can you explain this, thank you very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants