使用cocoapi遇到的坑及爬坑记录
近期在做基于coco数据集的实验,这两天又幸运地薅到了实验室一台服务器,搬运一波代码配好环境之后发现在服务器上使用coco自带的api做evaluation的时候报错了,卡了好久才把问题都解决。以下是遇到的两个问题以及爬坑的记录。
问题一:模型评估阶段,数据类型不匹配
错误信息
TypeError: object of type <class ‘numpy.float64’> cannot be safely interpreted as an integer
原因
问题出在 cocoapi 库的 cocoval.py 中的 Params类,代码如下:
class Params:
'''
Params for coco evaluation api
'''
def setDetParams(self):
self.imgIds = []
self.catIds = []
# np.arange causes trouble. the data point on arange is slightly larger than the true value
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)
self.maxDets = [1, 10, 100]
self.areaRng = [[0 ** 2, 1e5 ** 2], [0 ** 2, 32 ** 2], [32 ** 2, 96 ** 2], [96 ** 2, 1e5 ** 2]]
self.areaRngLbl = ['all', 'small', 'medium', 'large']
self.useCats = 1
def setKpParams(self):
self.imgIds = []
self.catIds = []
# np.arange causes trouble. the data point on arange is slightly larger than the true value
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)
self.maxDets = [20]
self.areaRng = [[0 ** 2, 1e5 ** 2],

最低0.47元/天 解锁文章
6088

被折叠的 条评论
为什么被折叠?



