yxgeee / MMT

[ICLR-2020] Mutual Mean-Teaching: Pseudo Label Refinery for Unsupervised Domain Adaptation on Person Re-identification.

Home Page:https://yxgeee.github.io/projects/mmt

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

RuntimeError: bool value of Tensor with more than one value is ambiguous

YachaoDong opened this issue · comments

您好,之前在其他机器上没有出现过这个问题,然后在学校的机器上Titan V 上运行发现这个错误,网上也搜索了好多信息,也没有解决这个问题,请问您可以帮助解决这个问题吗?非常感谢您,期待您的回复!!

Traceback (most recent call last):
File "examples/mmt_train_kmeans.py", line 294, in
main()
File "examples/mmt_train_kmeans.py", line 138, in main
main_worker(args)
File "examples/mmt_train_kmeans.py", line 234, in main_worker
is_best = (mAP_1 > best_mAP) or (mAP_2 > best_mAP)
RuntimeError: bool value of Tensor with more than one value is ambiguous

Could you please print the value of mAP_1, best_mAP, mAP_2 and the result of mAP_1 > best_mAP?

因为我想边训练的不仅能打印mAP,也能打印rank-1,,故对此处作了更改 cmc_scores1, mAP_1 = evaluator_1_ema.evaluate(test_loader_target, dataset_target.query, dataset_target.gallery, cmc_flag=True) ,但是在之前的机器上是没有问题的。

Compute mean AP

mAP = mean_ap(distmat, query_ids, gallery_ids, query_cams, gallery_cams)
print('Mean AP: {:4.1%}'.format(mAP))           # 这个地方的mAP是对的

if (not cmc_flag):
    return mAP

cmc_configs = {
    'market1501': dict(separate_camera_set=False,
                       single_gallery_shot=False,
                       first_match_break=True)
            }
cmc_scores = {name: cmc(distmat, query_ids, gallery_ids,
                        query_cams, gallery_cams, **params)
              for name, params in cmc_configs.items()}

print('CMC Scores:')
for k in cmc_topk:
    print('  top-{:<4}{:12.1%}'
          .format(k,
                  cmc_scores['market1501'][k-1]))
return cmc_scores['market1501'][0], mAP   # 这个地方的mAP就变成了多维向量,貌似没有作均值处理

Could you please print the value of mAP_1, best_mAP, mAP_2 and the result of mAP_1 > best_mAP?

您好,可能由于自己迁移代码的时候有的地方没改,return 返回未接收正确的参数,我会将这个问题自己关闭。
非常感觉您能秒回,帮助解决问题,太敬业了,非常感谢!

Could you please print the value of mAP_1, best_mAP, mAP_2 and the result of mAP_1 > best_mAP?

您可以把这个issues删除了!非常感谢您~