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

numpy版本为1.17.4 仍然报错 'numpy.float64' object cannot be interpreted as an integer #7448

Open
2 of 3 tasks
cunjing56 opened this issue Dec 3, 2022 · 2 comments
Open
2 of 3 tasks

Comments

@cunjing56
Copy link

cunjing56 commented Dec 3, 2022

问题确认 Search before asking

  • 我已经查询历史issue,没有发现相似的bug。I have searched the issues and found no similar bug report.

Bug组件 Bug Component

No response

Bug描述 Describe the Bug

问题一:训练一轮后报错“'numpy.float64' object cannot be interpreted as an integer”
最初我的numpy 版本是1.21.6,报错“'numpy.float64' object cannot be interpreted as an integer”,
我已参考"https://github.com/PaddlePaddle/PaddleDetection/issues/245",将numpy改成1.17.4,仍然报错
将numpy 改成1.21.5,仍然报错

python tools/train.py -c configs/faster_rcnn/faster_rcnn_r50_vd_fpn_ssld_1x_rice.yml -o LearningRate.base_lr=0.00125 worker_num=1 --eval

[12/03 14:49:32] ppdet.engine INFO: Epoch: [0] [240/260] learning_rate: 0.000395 loss_rpn_cls: 0.267394 loss_rpn_reg: 0.168532 loss_bbox_cls: 0.434746 loss_bbox_reg: 0.887510 loss: 1.783545 eta: 0:08:24 batch_cost: 0.1729 data_cost: 0.0002 ips: 5.7833 images/s
[12/03 14:49:36] ppdet.utils.checkpoint INFO: Save checkpoint: output\faster_rcnn_r50_vd_fpn_ssld_1x_rice
loading annotations into memory...
Done (t=0.00s)
creating index...
index created!
loading annotations into memory...
Done (t=0.00s)
creating index...
index created!
[12/03 14:49:36] ppdet.engine INFO: Eval iter: 0
[12/03 14:49:38] ppdet.metrics.metrics INFO: The bbox result is saved to bbox.json.
loading annotations into memory...
Done (t=0.00s)
creating index...
index created!
[12/03 14:49:38] ppdet.metrics.coco_utils INFO: Start evaluate...
Loading and preparing results...
DONE (t=0.02s)
creating index...
index created!
Traceback (most recent call last):
File "tools/train.py", line 172, in
main()
File "tools/train.py", line 168, in main
run(FLAGS, cfg)
File "tools/train.py", line 132, in run
trainer.train(FLAGS.eval)
File "D:\pkg\PaddleDetection\ppdet\engine\trainer.py", line 564, in train
self._eval_with_loader(self._eval_loader)
File "D:\pkg\PaddleDetection\ppdet\engine\trainer.py", line 613, in _eval_with_loader
metric.accumulate()
File "D:\pkg\PaddleDetection\ppdet\metrics\metrics.py", line 142, in accumulate
classwise=self.classwise)
File "D:\pkg\PaddleDetection\ppdet\metrics\coco_utils.py", line 111, in cocoapi_eval
coco_eval = COCOeval(coco_gt, coco_dt, style)
File "D:\soft\anaconda3\envs\paddle\lib\site-packages\pycocotools-2.0-py3.7-win-amd64.egg\pycocotools\cocoeval.py", line 76, in init
self.params = Params(iouType=iouType) # parameters
File "D:\soft\anaconda3\envs\paddle\lib\site-packages\pycocotools-2.0-py3.7-win-amd64.egg\pycocotools\cocoeval.py", line 527, in init
self.setDetParams()
File "D:\soft\anaconda3\envs\paddle\lib\site-packages\pycocotools-2.0-py3.7-win-amd64.egg\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 "D:\soft\anaconda3\envs\paddle\lib\site-packages\numpy\core\function_base.py", line 120, in linspace
num = operator.index(num)
TypeError: 'numpy.float64' object cannot be interpreted as an integer

我本来是2.4的paddle, 训练报错out of bound,参考“https://github.com/PaddlePaddle/PaddleDetection/issues/7371”升级了paddle0.0.0, 但是还是报错,现又改成2.2.2还是不成。到底咋整啊?


**问题二:infer中 save_results=True,没有.json输出,带slice_infer就没有输出,怎么才能输出?已经发布问题了,迟迟没有回复。。
CUDA_VISIBLE_DEVICES=0 python tools/infer.py -c configs/faster_rcnn/faster_rcnn_r50_vd_fpn_ssld_1x_rice.yml -o weights=/home/aistudio/work/PaddleDetection/output/faster_rcnn_r50_vd_fpn_ssld_1x_rice/best_model.pdparams --infer_dir=/home/aistudio/data/price --output_dir /home/aistudio/data/price/frcnn --draw_threshold=0.65 --save_results=True --slice_infer --slice_size 640 640 --overlap_ratio 0.25 0.25 --combine_method=nms --match_threshold=0.6 --match_metric=ios

复现环境 Environment

win
paddlegpu 2.2.2
paddledet 2.5.0
pycocotools 2.0
protobuf 4.21.1
cuda 11.2
numpy 1.17.6

Bug描述确认 Bug description confirmation

  • 我确认已经提供了Bug复现步骤、代码改动说明、以及环境信息,确认问题是可以复现的。I confirm that the bug replication steps, code change instructions, and environment information have been provided, and the problem can be reproduced.

是否愿意提交PR? Are you willing to submit a PR?

  • 我愿意提交PR!I'd like to help by submitting a PR!
@cunjing56 cunjing56 changed the title numpy版本为1.17.4 仍然报错 numpy版本为1.17.4 仍然报错 'numpy.float64' object cannot be interpreted as an integer Dec 4, 2022
@nemonameless
Copy link
Collaborator

numpy 1.21.5 测试过没有报错,你看下你eval完存下来的bbox.json里的数值有没有问题。
out of bound 装了0.0.0版本报错,和改成2.2.2还报错,是同一个报错吗,建议单开一个issue。
slice_infer json在派人修了。

@cunjing56
Copy link
Author

numpy 1.21.5 测试过没有报错,你看下你eval完存下来的bbox.json里的数值有没有问题。 out of bound 装了0.0.0版本报错,和改成2.2.2还报错,是同一个报错吗,建议单开一个issue。 slice_infer json在派人修了。

我当前是1.21.5,报错“TypeError: 'numpy.float64' object cannot be interpreted as an integer”
bbox.json 文件如下,请问有问题吗?
[{"image_id": 4, "category_id": 1, "bbox": [275.2439880371094, 138.0215301513672, 97.75216674804688, 105.435546875], "score": 0.1600416749715805}, {"image_id": 4, "category_id": 1, "bbox": [395.4527282714844, 403.98883056640625, 97.97509765625, 97.94207763671875], "score": 0.16338315606117249}, {"image_id": 4, "category_id": 1, "bbox": [500.4181213378906, 350.83905029296875, 113.09176635742188, 103.125244140625], "score": 0.5210153460502625}, {"image_id": 4, "category_id": 1, "bbox": [512.1255493164062, 18.448816299438477, 102.44287109375, 102.96307182312012], "score": 0.15462179481983185}, {"image_id": 4, "category_id": 1, "bbox": [1.078302025794983, 372.0433654785156, 92.93096005916595, 96.88739013671875], "score": 0.24322748184204102},
.......,
{"image_id": 287, "category_id": 1, "bbox": [586.73779296875, 534.8777465820312, 53.26220703125, 32.52642822265625], "score": 0.32499566674232483}]

我的环境
(paddle) C:\Users\NINGMEI>pip list
Package Version
astor 0.8.1
Babel 2.11.0
bce-python-sdk 0.8.74
brotlipy 0.7.0
certifi 2022.9.24
cffi 1.15.1
charset-normalizer 2.1.1
click 8.1.3
colorama 0.4.6
cryptography 37.0.4
cycler 0.11.0
Cython 0.29.32
decorator 5.1.1
dill 0.3.6
filterpy 1.4.5
Flask 2.2.2
Flask-Babel 2.0.0
fonttools 4.38.0
future 0.18.2
gast 0.3.3
idna 3.4
importlib-metadata 5.1.0
itsdangerous 2.1.2
Jinja2 3.1.2
kiwisolver 1.4.4
lap 0.4.0
MarkupSafe 2.1.1
matplotlib 3.5.3
motmetrics 1.2.5
multiprocess 0.70.14
numpy 1.21.5
opencv-python 4.6.0.66
packaging 21.3
paddledet 2.5.0
paddlepaddle-gpu 2.2.2.post112
pandas 1.3.5
Pillow 9.3.0
pip 22.2.2
protobuf 4.21.1
pyclipper 1.3.0.post4
pycocotools 2.0
pycparser 2.21
pycryptodome 3.16.0
pyOpenSSL 22.0.0
pyparsing 3.0.9
PySocks 1.7.1
python-dateutil 2.8.2
pytz 2022.6
PyYAML 6.0
requests 2.28.1
scipy 1.7.3
setuptools 65.5.0
Shapely 1.8.5.post1
six 1.16.0
sklearn 0.0.post1
terminaltables 3.1.10
tqdm 4.64.1
typeguard 2.13.3
typing_extensions 4.4.0
urllib3 1.26.13
visualdl 2.4.1
Werkzeug 2.2.2
wheel 0.37.1
win-inet-pton 1.1.0
wincertstore 0.2
xmltodict 0.13.0
zipp 3.11.0

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