欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

京东fast-reid运行visualize_result.py出现error:IndexError: invalid index to scalar variable

程序员文章站 2022-05-30 22:50:18
1.问题IndexError: invalid index to scalar variable2.解决修改/fast-reid-master/fastreid/evaluation/rank.pyline182:def evaluate_rank( distmat, q_pids, g_pids, q_camids, g_camids, max_rank=50, use_...

1.问题

IndexError: invalid index to scalar variable

2.解决

修改/fast-reid-master/fastreid/evaluation/rank.py

line182:
def evaluate_rank(
        distmat,
        q_pids,
        g_pids,
        q_camids,
        g_camids,
        max_rank=50,
        use_metric_cuhk03=False,
        use_cython=True
):
改为:
def evaluate_rank(
        distmat,
        q_pids,
        g_pids,
        q_camids,
        g_camids,
        max_rank=50,
        use_metric_cuhk03=False,
        use_cython=False
):

京东fast-reid运行visualize_result.py出现error:IndexError: invalid index to scalar variable

更靠谱的修改fast-reid-master/fastreid/utils/visualizer.py line72附近: 

if len(query_indices) != 1:
    ax.set_title('{}/{:.2f}/cam{}'.format(query_name, self.all_ap[q_idx], cam_id))
else:
    ax.set_title('{}/{:.2f}/cam{}'.format(query_name, self.all_ap, cam_id))

 

运行下面命令之后:

python ./demo/visualize_result.py --config-file './configs/Market1501/AGW_R50.yml' --vis-label --dataset-name 'Market1501' --output 'logs/market1501/agw_R50/agw_market1501_vis' --opts MODEL.WEIGHTS "./logs/market1501/agw_R50/model_final.pth"

京东fast-reid运行visualize_result.py出现error:IndexError: invalid index to scalar variable

参考

1.fast-reid/issues/105(my issue)

 

本文地址:https://blog.csdn.net/qq_35975447/article/details/107313764