L2C icon indicating copy to clipboard operation
L2C copied to clipboard

training G funstion on imagenet

Open sesmae opened this issue 5 years ago • 5 comments

Hi, I have question regarding training function G. by using pair-enumeration layer there are always many more dis-similar pair per batch than similar pairs, I can see that it works on Omniglot but on more complicated datasets like imagenet, would not this imbalance be a problem? is different hyperparameters used to train G for imagenet?

sesmae avatar Aug 21 '20 06:08 sesmae

Hi, the Omniglot has more than nine hundred classes, so the situation is the same. The imbalance is addressed by sampling in the Omniglot dataloader.

Training the G from scratch on ImageNet can be time-consuming. There is a short cut for building the G without training. Here are the steps: (1) Pick an ImageNet-pretrained model. (2) Feed two images separately to get two predicted probability vectors (softmax outputs). (3) The inner product between the two vectors is the probability of being the same class (similar pair). (4) You can thresholding the final probability to get the binarized prediction. You can find more details about this method in Reference Section 6.3.2.

I hope this helps.

yenchanghsu avatar Aug 21 '20 07:08 yenchanghsu

The shortcut method seems interesting , I will give it a try, thanks for the hint and for the reference.

sesmae avatar Aug 21 '20 17:08 sesmae

Hi, I cannot find the code of training function G, could you please upload a version of source code for reference?

liujianzhao6328057 avatar Sep 09 '20 14:09 liujianzhao6328057

This line is the command to train function G.

yenchanghsu avatar Sep 09 '20 17:09 yenchanghsu

Thanks! I didn't notice it

liujianzhao6328057 avatar Sep 10 '20 06:09 liujianzhao6328057