Sha-Lab / FEAT

The code repository for "Few-Shot Learning via Embedding Adaptation with Set-to-Set Functions"
MIT License
418 stars 84 forks source link

用自己的数据集训练FEAT报错 #56

Closed YiX98 closed 3 years ago

YiX98 commented 3 years ago

你好!当我用自己的数据集和预训练模型时,如下命令: python3 train_fsl.py --max_epoch 200 --model_class FEAT --use_euclidean --backbone_class ConvNet --dataset CustomizedData --way 4 --eval_way 4 --shot 5 --eval_shot 5 --query 15 --eval_query 15 --balance 0.1 --temperature 32 --temperature2 64 --lr 0.0001 --lr_mul 10 --lr_scheduler step --step_size 20 --gamma 0.5 --gpu 14 --init_weights ./saves/initialization/miniimagenet/con-pre.pth --eval_interval 1 会遇到报错: Traceback (most recent call last): File "train_fsl.py", line 19, in trainer.train() File "/home/tribta/YiXu/FEAT-original/model/trainer/fsl_trainer.py", line 76, in train logits, reg_logits = self.para_model(data) File "/home/tribta/.local/lib/python3.5/site-packages/torch/nn/modules/module.py", line 541, in call result = self.forward(*input, *kwargs) File "/home/tribta/YiXu/FEAT-original/model/models/base.py", line 48, in forward logits, logits_reg = self._forward(instance_embs, support_idx, query_idx) File "/home/tribta/YiXu/FEAT-original/model/models/feat.py", line 113, in _forward query = instance_embs[query_idx.contiguous().view(-1)].contiguous().view( (query_idx.shape + (-1,))) IndexError: index 40 is out of bounds for dimension 0 with size 40

请问应该怎么解决呢