pytorch-retinanet icon indicating copy to clipboard operation
pytorch-retinanet copied to clipboard

TypeError: object of type <class 'numpy.float64'> cannot be safely interpreted as an integer.

Open LIUHAO121 opened this issue 5 years ago • 2 comments

Traceback (most recent call last): File "train.py", line 173, in main() File "train.py", line 155, in main coco_eval.evaluate_coco(dataset_val, retinanet) File "/home/liuhao/seedland/retina/pytorch-retinanet/retinanet/coco_eval.py", line 73, in evaluate_coco coco_eval = COCOeval(coco_true, coco_pred, 'bbox') File "/home/liuhao/anaconda3/envs/retina/lib/python3.7/site-packages/pycocotools/cocoeval.py", line 76, in init self.params = Params(iouType=iouType) # parameters File "/home/liuhao/anaconda3/envs/retina/lib/python3.7/site-packages/pycocotools/cocoeval.py", line 527, in init self.setDetParams() File "/home/liuhao/anaconda3/envs/retina/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/liuhao/anaconda3/envs/retina/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. I have no idea of this problem

LIUHAO121 avatar Feb 02 '20 14:02 LIUHAO121

someone said it is because the version of numpy,i tried,but it does not work

LIUHAO121 avatar Feb 02 '20 15:02 LIUHAO121

This is a problem with numpy 1.18, see here: https://github.com/xingyizhou/CenterNet/issues/547

You can either go into your coco_eval.py file in site-packages, and fix it yourself, or install the latest version on github, where this has been fixed: https://github.com/cocodataset/cocoapi/commit/6c3b394c07aed33fd83784a8bf8798059a1e9ae4

daveboat avatar Feb 04 '20 22:02 daveboat