1.出现meshgrid() got an unexpected keyword argument ‘indexing‘
把出现问题的代码
torch.meshgrid([torch.arange(hsize), torch.arange(wsize)], indexing="ij")
里面的indexing="ij" 删除即可
torch.meshgrid([torch.arange(hsize), torch.arange(wsize)])
2. 出现classes = [label2category[obj["category_id"]]for obj in anno] keyError:0
首先找到出错的地方:
因为在数据集yml里面:”remap_mscoco_category: True“调用的是原来coco数据集的标签,所以要在数据集yml里面将remap_mscoco_category改成False,就是调用else后面的代码
3. 出现:TypeError: 'numpy.float64' object cannot be interpreted as an integer
找到报错地方
把下面的代码
self.iouThrs = np.linspace(.5, 0.95, np.round((0.95 - .5) / .05) + 1, endpoint=True)
self.recThrs = np.linspace(.0, 1.00, np.round((1.00 - .0) / .01) + 1, endpoint=True)
改成:
self.iouThrs = np.linspace(.5, 0.95, int(np.round((0.95 - .5) / .05) + 1), endpoint=True)
self.recThrs = np.linspace(.0, 1.00, int(np.round((1.00 - .0) / .01) + 1), endpoint=True)
4. AttributeError: module 'numpy' has no attribute 'float'. `np.float` was a deprecated alias for the builtin `float`.
解决办法:
重新安装numpy
出现这个问题是因为np.float从1.24起被删除。所用的代码是依赖于旧版本的Numpy。可以将Numpy版本降级到1.23.5.
conda install numpy==1.23.5