Tianxiaomo / pytorch-YOLOv4

PyTorch ,ONNX and TensorRT implementation of YOLOv4
Apache License 2.0
4.49k stars 1.49k forks source link

num = operator.index(num) TypeError: 'numpy.float64' object cannot be interpreted as an integer #214

Open heheli1998 opened 4 years ago

heheli1998 commented 4 years ago

训练时出现 num = operator.index(num) TypeError: 'numpy.float64' object cannot be interpreted as an integer

JiangMei0201 commented 4 years ago

同上问题

Qingyuncookie commented 4 years ago

同上问题,请问解决了吗?

JiangMei0201 commented 4 years ago

我已经解决这个问题了,降低numpy的版本即可

Qingyuncookie commented 4 years ago

我刚也发现了,从1.19一直往下试,1.16是可以的,谢谢~

dade68 commented 4 years ago

在linespace那一行参数里加个int转换也可破

biel-wangdf3 commented 3 years ago

在linespace那一行参数里加个int转换也可破

linespace那行是哪一行呢?

biel-wangdf3 commented 3 years ago

File "train-multi-gpu.py", line 508, in evaluate coco_evaluator = CocoEvaluator(coco, iou_types = ["bbox"], bbox_fmt='coco') File "/pytorch-YOLOv4/tool/tv_reference/coco_eval.py", line 30, in init self.coco_eval[iou_type] = COCOeval(coco_gt, iouType=iou_type) File "/anaconda/envs/azureml_py36/lib/python3.6/site-packages/pycocotools/cocoeval.py", line 76, in init self.params = Params(iouType=iouType) # parameters File "/anaconda/envs/azureml_py36/lib/python3.6/site-packages/pycocotools/cocoeval.py", line 527, in init self.setDetParams() File "/anaconda/envs/azureml_py36/lib/python3.6/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 "/anaconda/envs/azureml_py36/lib/python3.6/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.

np.round() type is float64, but linspace num need int tpye,
change to: self.iouThrs = np.linspace(.5, 0.95, int(np.round((0.95 - .5) / .05) + 1), endpoint=True)