半月居士
2022-06-27 18:46
采纳率: 100%
浏览 54

TypeError: unsupported operand type(s) for -: 'int' and 'list'

python 已转换为np.ndarray类型,仍然报错TypeError: unsupported operand type(s) for -: 'int' and 'list'

源代码如下

        all_tag = np.array([v for k, v in self.tags.items() if len(v) > 0 ])
        self.tags['empty'] = np.all(1 - all_tag, axis=1).astype(np.int32).tolist()

报错如下

Traceback (most recent call last):
  File "../../tools/eval.py", line 36, in <module>
    dataset = VOTDataset(args.dataset, root)
  File "/home/cao/桌面/Code/SiamMask/utils/pysot/datasets/vot.py", line 127, in __init__
    meta_data[video]['height'])
  File "/home/cao/桌面/Code/SiamMask/utils/pysot/datasets/vot.py", line 52, in __init__
    self.tags['empty'] = np.all(1 - all_tag, axis=1).astype(np.int32).tolist()
TypeError: unsupported operand type(s) for -: 'int' and 'list'

明明已经转换为ndarray类型了为什么报错仍然是int和list类型错误,np的广播机制为什么没有见效?

4条回答 默认 最新

相关推荐 更多相似问题