object of type <class 'numpy.float64'> cannot be safely interpreted as an integer.
Created by: heavengate
New numpy version 1.18.0 linspace
usage incompatible,see https://github.com/cocodataset/cocoapi/pull/354 pycocotools cocoeval error as follows
Traceback (most recent call last):
File "/home/anaconda/envs/py37/lib/python3.7/site-packages/numpy/core/function_base.py", line 117, in linspace
num = operator.index(num)
TypeError: 'numpy.float64' object cannot be interpreted as an integer
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "slim/prune/prune.py", line 393, in <module>
main()
File "slim/prune/prune.py", line 271, in main
dataset=dataset)
File "/paddle/slim16/slim17/dete_0210_py37/PaddleDetection/ppdet/utils/eval_utils.py", line 205, in eval_results
is_bbox_normalized=is_bbox_normalized)
File "/paddle/slim16/slim17/dete_0210_py37/PaddleDetection/ppdet/utils/coco_eval.py", line 94, in bbox_eval
map_stats = cocoapi_eval(outfile, 'bbox', coco_gt=coco_gt)
File "/paddle/slim16/slim17/dete_0210_py37/PaddleDetection/ppdet/utils/coco_eval.py", line 147, in cocoapi_eval
coco_eval = COCOeval(coco_gt, coco_dt, style)
File "/home/anaconda/envs/py37/lib/python3.7/site-packages/pycocotools/cocoeval.py", line 76, in __init__
self.params = Params(iouType=iouType) # parameters
File "/home/anaconda/envs/py37/lib/python3.7/site-packages/pycocotools/cocoeval.py", line 527, in __init__
self.setDetParams()
File "/home/anaconda/envs/py37/lib/python3.7/site-packages/pycocotools/cocoeval.py", line 507, in setDetParams
self.iouThrs = np.linspace(.5, 0.95, np.round((0.95 - .5) / .05) + 1, endpoint=True)
File "<__array_function__ internals>", line 6, in linspace
File "/home/anaconda/envs/py37/lib/python3.7/site-packages/numpy/core/function_base.py", line 121, in linspace
.format(type(num)))
TypeError: object of type <class 'numpy.float64'> cannot be safely interpreted as an integer.
terminate called without an active exception
Solution:
- rollback numpy to 1.17.4
pip uninstall numpy
pip install numpy==1.17.4
- reinstall pycocotools by compiling from latest source code