Open MaRuiXiang1201 opened 2 years ago
I also meet such error, can you tell me how to fix it?
Traceback (most recent call last):
File "D:\PyCharm_projects\deepLearningProjects\PresonReID\Relation-Aware-Global-Attention-Networks-master\main_imgreid.py", line 276, in
Process finished with exit code 1
= torch.min( IndexError: min(): Expected reduction dim 1 to have non-zero size.
解决了吗
你需要把--num-instances和--batch-size设置清楚,其中batch-size必须是num-instances的大于1的整数倍,就解决问题了 其中--num-instances的描述中也提到了"each minibatch consist of " "(batch_size // num_instances) identities, and " "each identity has num_instances instances, " "default: 4")
After I ran the 'bash ./scripts/run_rgasc_cuhk03.sh' order, the log reports error like below:
Traceback (most recent call last): File "C:\Users\24282\Desktop\RAG\main_imgreid.py", line 261, in
main(parser.parse_args())
File "C:\Users\24282\Desktop\RAG\main_imgreid.py", line 178, in main
trainer.train(epoch, train_loader, optimizer, random_erasing=args.random_erasing, empty_cache=args.empty_cache)
File "C:\Users\24282\Desktop\RAG\reid\img_trainers.py", line 43, in train
loss, all_loss, prec1 = self._forward(ori_inputs, targets)
File "C:\Users\24282\Desktop\RAG\reid\img_trainers.py", line 94, in _forward
loss_tri = self.criterion[1](outputs[0], targets)
File "C:\Users\24282\Desktop\RAG\reid\loss\loss_set.py", line 133, in call
dist_ap, dist_an = hard_example_mining(
File "C:\Users\24282\Desktop\RAG\reid\loss\loss_set.py", line 86, in hard_example_mining
dist_an, relative_n_inds = torch.min(
IndexError: min(): Expected reduction dim 1 to have non-zero size.
I checked the 'loss_set.py', the logic is reasonable. I couldn't figure out why there is such an 'IndexError', have any one met the same problem before? Please Help!