hanlu-nju / revisiting-UML

The official code repository for "Revisiting Unsupervised Meta-Learning via the Characteristics of Few-Shot Tasks" (TPAMI 2023) in PyTorch.
7 stars 2 forks source link

The accuracy of HMS is always 20 #2

Open jiaxin9271 opened 2 years ago

jiaxin9271 commented 2 years ago

hello, I just try HMS:

python train.py --eval_all --unsupervised --batch_size 32 --augment 'AMDIM' \ --num_tasks 256 --max_epoch 200 --model_class ProtoNet --backbone_class ConvNet \ --dataset MiniImageNet --way 5 --shot 1 --query 5 --eval_query 15 \ --balance 0 --temperature 1 --temperature2 1 --lr 0.03 --lr_mul 1 --lr_scheduler cosine \ --gpu 0 --eval_interval 2 --similarity sns --additional HMS \ --strength 0.5

epoch 1, loss: 2.7131, acc: 9.1483: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1200/1200 [01:08<00:00, 17.52it/s] ETA:1m/4.0h epoch 2, loss: 2.7080, acc: 19.9997: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1200/1200 [01:07<00:00, 17.67it/s] eval procedure: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 600/600 [00:18<00:00, 32.58it/s] epoch 2,5 way 1 shot, val, loss=1.6094 acc=20.0000+0.0000 best epoch 2, best val acc=20.0000 + 0.0000 ETA:3m/4.4h epoch 3, loss: 2.7080, acc: 19.9999: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1200/1200 [01:07<00:00, 17.78it/s] ETA:4m/4.2h epoch 4, loss: 2.7080, acc: 19.9999: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1200/1200 [01:08<00:00, 17.47it/s] eval procedure: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 600/600 [00:18<00:00, 33.10it/s] epoch 4,5 way 1 shot, val, loss=1.6094 acc=20.0000+0.0000 best epoch 4, best val acc=20.0000 + 0.0000 ETA:5m/4.3h epoch 5, loss: 2.7080, acc: 20.0000: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1200/1200 [01:07<00:00, 17.79it/s] ETA:6m/4.2h epoch 6, loss: 2.7080, acc: 19.9999: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1200/1200 [01:08<00:00, 17.64it/s] eval procedure: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 600/600 [00:17<00:00, 33.47it/s] epoch 6,5 way 1 shot, val, loss=1.6094 acc=20.0000+0.0000 best epoch 6, best val acc=20.0000 + 0.0000 ....

why?

hanlu-nju commented 2 years ago

I've compared your command and found the problem lies in the learning rate. Try:

python train.py --eval_all --unsupervised --batch_size 64 --augment 'AMDIM' \
--num_tasks 256 --max_epoch 100 --model_class ProtoNet --backbone_class ConvNet \
--dataset MiniImageNet --way 5 --shot 1 --query 5 --eval_query 15 \
--balance 0 --temperature 1 --temperature2 1 --lr 0.002 --lr_mul 1 --lr_scheduler cosine \
--gpu 0 --eval_interval 2 --similarity sns --additional HMS \
--strength 0.5 

It is the default setup for ConvNet reported in the article.

jiaxin9271 commented 2 years ago

It's working, and your research is really great!

hanlu-nju commented 2 years ago

Thanks :)