LTH14 / targeted-supcon

A PyTorch implementation of the paper Targeted Supervised Contrastive Learning for Long-tailed Recognition
MIT License
93 stars 13 forks source link

import different models in stage1 and stage2 #13

Closed suminRoh closed 1 year ago

suminRoh commented 1 year ago

I have a question about your code. In main_moco_supcon_imba(stage1), it uses models imported from moco_models, which includes the ResNet model you wrote. However, in main_lincls_imba(stage2), it imports models from torchvision.models, and then loads the model that was trained and saved in stage1. Is there any specific reason why you import different models in stage1 and stage2? Thanks for providing the paper!

LTH14 commented 1 year ago

For stage 1, the moco training requires two ResNet models, one for q and one for k. For stage 2, we only need to load the weights of the pre-trained q model.