Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
heavengate opened this issue Feb 18, 2020 · 1 comment
Assignees

Comments

@heavengate
Copy link
Collaborator

New numpy version 1.18.0 linspace usage incompatible,see cocodataset/cocoapi#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:

  1. rollback numpy to 1.17.4
pip uninstall numpy
pip install numpy==1.17.4
  1. reinstall pycocotools by compiling from latest source code
@heavengate heavengate self-assigned this Feb 18, 2020
@zimoqingfeng
Copy link

建议numpy版本在readme中进行明确,否则会影响使用体验。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants