zhihou7 / BatchFormer

CVPR2022, BatchFormer: Learning to Explore Sample Relationships for Robust Representation Learning, https://arxiv.org/abs/2203.01522
246 stars 20 forks source link

Run the project #2

Closed michaelzfm closed 2 years ago

michaelzfm commented 2 years ago

Holle, I'm interested in your work for long-tailed problem, but could you tell me how to run the code? I can't find the code of the "encoder" in the RIDE folder.

zhihou7 commented 2 years ago

Hi, Thanks for your interest.

Do you mean the file in ``https://github.com/zhihou7/BatchFormer/blob/main/long-tailed_recognition/RIDE-LongTailRecognition/model/fb_resnets/__init__.py" ?

michaelzfm commented 2 years ago

Yes, thank you. So you have put it in your file , if I want to run RIDE+batchformer, just run the RIDE project in your file right?

zhihou7 commented 2 years ago

Yes, Of course. All codes have included BatchFormer.

The encoder is just in https://github.com/zhihou7/BatchFormer/blob/3a0667b5c15d7410dfbb0de4c6c0bf10d836e4a3/long-tailed_recognition/RIDE-LongTailRecognition/model/fb_resnets/__init__.py#L12

You can run the experiment like,

  python train.py -c "configs/config_imagenet_lt_resnet10_ride.json" --reduce_dimension 1 --num_experts 3 --add_bt 1

You can disable BatchFormer with -add_bt 0. I have updated the code and fixed a small typo right now.

Regards,