chrysts / dsn_fewshot

MIT License
89 stars 19 forks source link

Issue on subspace dimension #11

Closed longspringcity closed 3 years ago

longspringcity commented 3 years ago

Hi. In Conv4/train_subspace_discriminative.py, Subspace_Projection is initialized before the args.subspace_dim is assigned, which in the case of 1-shot results in the subspace dimension being set to 0. This seems to be inconsistent with the paper.

Looking forward to your reply!

chrysts commented 3 years ago

Hi Tong Zhang,

Thanks for your interest in our work. Yes, you are correct that if we only have 1 shot and use exactly one embedded feature, the singular vector cannot be obtained.

In our code, you can see that when the number of shot is 1, we add an augmented sample (in total 2 samples). Then we run svd with the number of column is two. This is also reflected in the Experiments section of our paper. Hope this answers your question.

Cheers

longspringcity commented 3 years ago

Thanks for your prompt reply!

I'm still confused about some code details. In the 1-shot case, I printed out self.num_dim from Subspace_Projection.create_subspace() in Conv4/algorithm/subspace_projection.py and found that it is all 0. This causes the return value allhyper planes to be []. Here is my code and the result of running it.

I noticed the use of inverted images to expand the support set at 1-shot, but the key problem is not setting the subspace dimension correctly when the Subspace_Projection class is initialized.

Thanks again for your time and have a great day! 1 2

chrysts commented 3 years ago

Hi Tong Zhang,

You can see in train_subspace_discriminative.py > line 61. The subspacedim is set to 1. Yes, there is a mistake when I initialize the subspaceprojection class. I have edited the line to initialize subspace projection, you can pull or copy from train_subspace_discriminative.py. Thanks for spotting this out!