zihangJiang / TokenLabeling

Pytorch implementation of "All Tokens Matter: Token Labeling for Training Better Vision Transformers"
Apache License 2.0
425 stars 36 forks source link

Generating label for custom dataset #24

Closed AleMaiaF closed 2 years ago

AleMaiaF commented 2 years ago

Hello,

Thank you for sharing your work. I am currently trying to generate token label to a custom dataset for model lvvit_s, but I keep getting the loss close to 7 and the Accuracy 0 (not pre-trained and using 1 GPU in Google Colab). I also tried using the pre-trained model with --transfer but got 0 in both Loss and Acc . What option should I use for a custom dataset? image

zihangJiang commented 2 years ago

Hello,

Thank you for sharing your work. I am currently trying to generate token label to a custom dataset for model lvvit_s, but I keep getting the loss close to 7 and the Accuracy 0 (not pre-trained and using 1 GPU in Google Colab). I also tried using the pre-trained model with --transfer but got 0 in both Loss and Acc . What option should I use for a custom dataset? image

Are you using generate_label.py to generate label? Large loss and zero accuracy usually mean you are not using the correct number of classes for the label generation. My current implementation is only tested when class number = 1000. I'm not sure if generate_label.py works fine when you apply it on custom dataset. You may check with this script and adapt it to your own dataset.

ivanvoid commented 2 years ago

with --transfer but got 0 in both Loss and Acc

It's because if transfer flag is used in generate_label.py line 275 disable tracking of loss and accuracy. But it not clear to me why you can't collect them during transfer.