Skip to content

Commit e140a08

Browse files
authored
Merge pull request #354 from ppwwyyxx/patch-1
Fix the use of linspace for numpy 1.18
2 parents 636becd + 6c3b394 commit e140a08

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

PythonAPI/pycocotools/cocoeval.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -503,8 +503,8 @@ def setDetParams(self):
503503
self.imgIds = []
504504
self.catIds = []
505505
# np.arange causes trouble. the data point on arange is slightly larger than the true value
506-
self.iouThrs = np.linspace(.5, 0.95, np.round((0.95 - .5) / .05) + 1, endpoint=True)
507-
self.recThrs = np.linspace(.0, 1.00, np.round((1.00 - .0) / .01) + 1, endpoint=True)
506+
self.iouThrs = np.linspace(.5, 0.95, int(np.round((0.95 - .5) / .05)) + 1, endpoint=True)
507+
self.recThrs = np.linspace(.0, 1.00, int(np.round((1.00 - .0) / .01)) + 1, endpoint=True)
508508
self.maxDets = [1, 10, 100]
509509
self.areaRng = [[0 ** 2, 1e5 ** 2], [0 ** 2, 32 ** 2], [32 ** 2, 96 ** 2], [96 ** 2, 1e5 ** 2]]
510510
self.areaRngLbl = ['all', 'small', 'medium', 'large']
@@ -514,8 +514,8 @@ def setKpParams(self):
514514
self.imgIds = []
515515
self.catIds = []
516516
# np.arange causes trouble. the data point on arange is slightly larger than the true value
517-
self.iouThrs = np.linspace(.5, 0.95, np.round((0.95 - .5) / .05) + 1, endpoint=True)
518-
self.recThrs = np.linspace(.0, 1.00, np.round((1.00 - .0) / .01) + 1, endpoint=True)
517+
self.iouThrs = np.linspace(.5, 0.95, int(np.round((0.95 - .5) / .05)) + 1, endpoint=True)
518+
self.recThrs = np.linspace(.0, 1.00, int(np.round((1.00 - .0) / .01)) + 1, endpoint=True)
519519
self.maxDets = [20]
520520
self.areaRng = [[0 ** 2, 1e5 ** 2], [32 ** 2, 96 ** 2], [96 ** 2, 1e5 ** 2]]
521521
self.areaRngLbl = ['all', 'medium', 'large']
@@ -531,4 +531,4 @@ def __init__(self, iouType='segm'):
531531
raise Exception('iouType not supported')
532532
self.iouType = iouType
533533
# useSegm is deprecated
534-
self.useSegm = None
534+
self.useSegm = None

0 commit comments

Comments
 (0)