SupContrast icon indicating copy to clipboard operation
SupContrast copied to clipboard

Meaning of joint training

Open htn274 opened this issue 3 years ago • 3 comments

First of all, thank you very much for your contributions. I have 2 questions now:

  1. Does SupCon Model show better accuracy than traditional cross entropy if augmentation isn't used? I asked because I want to apply the model to a non-image dataset. At the present, I don't know how to augment this dataset. I think it is possible from your loss. However I am not sure. So I would like to ask for your opinions.
  2. I would like to verify the meaning of jointly training for linear supervised model and SupCon model:
for each epoch:
    1. Train SupCon model 
    2. Freeze SupCon model: model.eval()
    4. Train linear supervised model
    5. Evaluate linear supervised model on validation set

Is the steps correct for jointly training?

Hope to receive your response soon. Thanks a lot!

htn274 avatar Mar 15 '22 08:03 htn274

  1. I implemented jointly train version, as I tested. It runs correctly as it produced results same as seperate training. Anyone who has interest can check the code here

htn274 avatar Mar 19 '22 03:03 htn274

  1. However when I tried to train the model without augmentation on CIFAR10 dataset, the classifier model becomes overfitting after 20 epochs.

image

Note: red line is train accuracy, green line is val accuracy

Is it normal to be overfitting in this case? Anyway it just my first step because I would like to apply the model into a custom dataset.

htn274 avatar Mar 19 '22 03:03 htn274

  1. I implemented joint train version, as I tested. It runs correctly as it produced results same as seperate training. Anyone who has interest can check the code here

Thanks so much, Nu Hoang, for providing the joint training code. I am wondering if you could guide how to execute supcon code for the Imagenet dataset, it says it has used the moco trick, however, I could not find any help regarding this. Cheers, Angelina

Angelina1996 avatar Jul 31 '23 06:07 Angelina1996