targeted-supcon icon indicating copy to clipboard operation
targeted-supcon copied to clipboard

reproduce cifar10

Open YunYunY opened this issue 2 years ago • 19 comments

Hi, thank you for the code. Could you please provide your cifar10 code for reproducing? I have followed your supplemental material and run the code for 1000 epochs for pretraining (Moco based). But the result is still lower than the number in the paper. I'm wondering if using SimCLR as you claimed in the paper will reach higher accuracy? Have you compared Moco and Simclr structures on CIFAR? It would be great if you could share that part of the code.
Thank you very much for your time.

YunYunY avatar Jun 26 '22 20:06 YunYunY

Hi @YunYunan and @LTH14 , please guide or share the link to supplementary material. It would be great if you could share the code for reproducing the results on Cifar and INat datasets on my email: [email protected] Cheers

Angelina1996 avatar Jul 26 '23 03:07 Angelina1996

Hi, thanks for your interest! Please refer to this supplementary material -- I submitted with the CVPR camera ready but I don't know why it does not appear online. For Cifar you need to replace the moco framework with supcon. For inat you can simply change the imagenet-LT to inat. Hope this helps.

On Tue, Jul 25, 2023 at 11:20 PM Angelina1996 @.***> wrote:

Hi @YunYunan and @LTH14 https://github.com/LTH14 , please guide or share the link to supplementary material. It would be great if you could share the code for reproducing the results on Cifar and INat datasets on my email: @.*** Cheers

— Reply to this email directly, view it on GitHub https://github.com/LTH14/targeted-supcon/issues/3#issuecomment-1650916600, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFJD3KAZ54ZXHVZXIRPZRH3XSCEH3ANCNFSM5Z4OTBTA . You are receiving this because you were mentioned.Message ID: @.***>

LTH14 avatar Jul 26 '23 14:07 LTH14

Hi, thanks for your interest! Please refer to this supplementary material -- I submitted with the CVPR camera ready but I don't know why it does not appear online. For Cifar you need to replace the moco framework with supcon https://github.com/HobbitLong/SupContrast. For inat you can simply change the imagenet-LT to inat. Hope this helps.

On Wed, Jul 26, 2023 at 10:22 AM Tianhong Li @.***> wrote:

Hi, thanks for your interest! Please refer to this supplementary material -- I submitted with the CVPR camera ready but I don't know why it does not appear online. For Cifar you need to replace the moco framework with supcon. For inat you can simply change the imagenet-LT to inat. Hope this helps.

On Tue, Jul 25, 2023 at 11:20 PM Angelina1996 @.***> wrote:

Hi @YunYunan and @LTH14 https://github.com/LTH14 , please guide or share the link to supplementary material. It would be great if you could share the code for reproducing the results on Cifar and INat datasets on my email: @.*** Cheers

— Reply to this email directly, view it on GitHub https://github.com/LTH14/targeted-supcon/issues/3#issuecomment-1650916600, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFJD3KAZ54ZXHVZXIRPZRH3XSCEH3ANCNFSM5Z4OTBTA . You are receiving this because you were mentioned.Message ID: @.***>

LTH14 avatar Jul 26 '23 14:07 LTH14

Thanks so much, Tianhong, for the reply. Could you exactly guide me about the line where I have to replace moco with supcon framework? I already know about supcon, however, supcon uses a different loss function than yours (TSC). I am a bit confused about this. Any help regarding this will be highly appreciated. Cheers

Angelina1996 avatar Jul 27 '23 08:07 Angelina1996

Our implementation in Cifar is not based on the moco and imagenet framework, so it could be hard to directly adapt the released code to Cifar. Our implementation in Cifar is based on this repo: https://github.com/HobbitLong/SupContrast. You need to replace the supcon losses file with the targeted supcon loss https://github.com/HobbitLong/SupContrast/blob/master/losses.py. I don't have a clean version of the Cifar repo, but I can share with you the tsc loss implementation. Hope it can make your reproduction easier.

Best Tianhong

On Thu, Jul 27, 2023 at 4:23 AM Angelina1996 @.***> wrote:

Thanks so much, Tianhong, for the reply. Could you exactly guide me about the line where I have to replace moco with supcon framework? I already know about supcon, however, supcon uses a different loss function than yours (TSC). I am a bit confused about this. Any help regarding this will be highly appreciated. Cheers

— Reply to this email directly, view it on GitHub https://github.com/LTH14/targeted-supcon/issues/3#issuecomment-1653132792, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFJD3KFKXLVZWT3U7BWITZ3XSIQPHANCNFSM5Z4OTBTA . You are receiving this because you were mentioned.Message ID: @.***>

LTH14 avatar Jul 27 '23 13:07 LTH14

Thanks so much, Tianhong, for your kind help. It makes sense to me now. Could you share the TSC loss, I want to reproduce the results on CIFAR.

Angelina1996 avatar Jul 28 '23 07:07 Angelina1996

Please see the attachment of the previous email

On Fri, Jul 28, 2023 at 3:11 AM Angelina1996 @.***> wrote:

Thanks so much, Tianhong, for your kind help. It makes sense to me now. Could you share the TSC loss, I want to reproduce the results on CIFAR.

— Reply to this email directly, view it on GitHub https://github.com/LTH14/targeted-supcon/issues/3#issuecomment-1655160104, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFJD3KEB5SQN4PVLHNFFPIDXSNQ2TANCNFSM5Z4OTBTA . You are receiving this because you were mentioned.Message ID: @.***>

LTH14 avatar Jul 28 '23 13:07 LTH14

Tianhong

Thanks, Tianhong, for your help. It is still unclear as the attachments or the links you have provided are for Supcon loss but not for targetted soupcon loss (TSC), moreover I am wondering how the targetted centres are calculated in Cifar dataset.

Angelina1996 avatar Jul 31 '23 02:07 Angelina1996

On CIFAR10, since the number of classes is smaller than the output dimension for contrastive loss, the targets can be directly computed without using gradient descent (see section 3.1 of the paper). Here is the main function we use to use target, hope it helps:

On Sun, Jul 30, 2023 at 10:04 PM Angelina1996 @.***> wrote:

Tianhong

Thanks, Tianhong, for your help. It is still unclear as the attachments or the links you have provided are for Supcon loss but not for targetted soupcon loss (TSC), moreover I am wondering how the targetted centres are calculated in Cifar dataset.

— Reply to this email directly, view it on GitHub https://github.com/LTH14/targeted-supcon/issues/3#issuecomment-1657388545, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFJD3KCMBNHHMWGD5OY7JTDXS4HB3ANCNFSM5Z4OTBTA . You are receiving this because you were mentioned.Message ID: @.***>

LTH14 avatar Jul 31 '23 02:07 LTH14

Thanks, Tianhong

I have applied the setting for the Cifar dataset as you suggested. However, the performance accuracies are far less than the results claimed in the paper. Would you mind sharing the code for reproducing the Cifar Dataset?

Angelina1996 avatar Aug 10 '23 01:08 Angelina1996

Hi, thank you for the code. Could you please provide your cifar10 code for reproducing? I have followed your supplemental material and run the code for 1000 epochs for pretraining (Moco based). But the result is still lower than the number in the paper. I'm wondering if using SimCLR as you claimed in the paper will reach higher accuracy? Have you compared Moco and Simclr structures on CIFAR? It would be great if you could share that part of the code. Thank you very much for your time.

Hi Yun, I am wondering if you managed to reproduce the Cifar dataset results. I have tried but the results are far less than the claimed results in the paper. Cheers

Angelina1996 avatar Aug 10 '23 01:08 Angelina1996

Hi, it seems there are some discrepancies between email and the Github reply -- I thought the attachment in the email apply will also appear here. I just uploaded the uncleaned main python file and loss file for TSC in the repo here. I'm sorry that I haven't really got time to clean it up. Hope it helps.

LTH14 avatar Aug 10 '23 01:08 LTH14

Hi, it seems there are some discrepancies between email and the Github reply -- I thought the attachment in the email apply will also appear here. I just uploaded the uncleaned main python file and loss file for TSC in the repo here. I'm sorry that I haven't really got time to clean it up. Hope it helps.

Angelina1996 avatar Aug 10 '23 04:08 Angelina1996

Hi, it seems there are some discrepancies between email and the Github reply -- I thought the attachment in the email apply will also appear here. I just uploaded the uncleaned main python file and loss file for TSC in the repo here. I'm sorry that I haven't really got time to clean it up. Hope it helps.

Thanks, Tianhong, Thanks so much for your help, yes, I already integrated TSC loss into the SupCon model and trained the model using SimCLR, and used LDAM and reweighting in the second stage (classification) but the results were far less than the claimed ones. Would you mind sharing the whole uncleaned version of the code for Cifar dataset?

Angelina1996 avatar Aug 10 '23 04:08 Angelina1996

Hi, it seems there are some discrepancies between email and the Github reply -- I thought the attachment in the email apply will also appear here. I just uploaded the uncleaned main python file and loss file for TSC in the repo here. I'm sorry that I haven't really got time to clean it up. Hope it helps. Tianhong, could you please provide the code?

Angelina1996 avatar Aug 11 '23 03:08 Angelina1996

Please check the cifar_dirty sub directory. It should contain every necessary file.

LTH14 avatar Aug 11 '23 15:08 LTH14

Please check the cifar_dirty sub directory. It should contain every necessary file.

Dear Tianhong, Thanks for providing the code; however, I believe there are still some files missing i.e. FileNotFoundError: [Errno 2] No such file or directory: 'optimal_10_10.npy'

Could you please, provide the missing files Cheers

Angelina1996 avatar Aug 13 '23 11:08 Angelina1996

Just uploaded. This file would be also easy to generate, as there is a analytical optimal solution for target positions when the number of classes <= output dimension.

LTH14 avatar Aug 14 '23 15:08 LTH14

Please check the cifar_dirty sub directory. It should contain every necessary file.

Dear Tianhong, Thanks for providing the code; however, I believe there are still some files missing i.e. FileNotFoundError: [Errno 2] No such file or directory: 'optimal_10_10.npy'

Could you please, provide the missing files Cheers

Hi, did you finally reproduce the cifar10 code? If so, could you please provide me with a copy of your code?

xuxhuan avatar Sep 19 '23 08:09 xuxhuan