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.21.5 仍然报错 'numpy.float64' object cannot be interpreted as an integer #7532

Closed
2 of 3 tasks
cunjing56 opened this issue Dec 20, 2022 · 6 comments
Closed
2 of 3 tasks

Comments

@cunjing56
Copy link

问题确认 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

请回复啊!到底是哪一步的问题,需要我把哪个包再怎么升级?
#7448

复现环境 Environment

win
paddlegpu 2.2.2
paddledet 2.5.0
pycocotools 2.0
protobuf 4.21.1
cuda 11.2
numpy 1.21.5;1.21.6; 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
Copy link
Author

我拆开训练跟评估发现,训练可以,评估的时候报错,所以评估的时候怎么触发的这个呢?
python tools/eval.py -c configs/faster_rcnn/faster_rcnn_r50_vd_fpn_ssld_1x_rice.yml -o weights=output/faster_rcnn_r50_vd_fpn_ssld_1x_rice/best_model.pdparams
D:\soft\anaconda3\envs\paddle\lib\site-packages\paddle\vision\transforms\functional_pil.py:36: DeprecationWarning: NEAREST is deprecated and will be removed in Pillow 10 (2023-07-01). Use Resampling.NEAREST or Dither.NONE instead.
'nearest': Image.NEAREST,
D:\soft\anaconda3\envs\paddle\lib\site-packages\paddle\vision\transforms\functional_pil.py:37: DeprecationWarning: BILINEAR is deprecated and will be removed in Pillow 10 (2023-07-01). Use Resampling.BILINEAR instead.
'bilinear': Image.BILINEAR,
D:\soft\anaconda3\envs\paddle\lib\site-packages\paddle\vision\transforms\functional_pil.py:38: DeprecationWarning: BICUBIC is deprecated and will be removed in Pillow 10 (2023-07-01). Use Resampling.BICUBIC instead.
'bicubic': Image.BICUBIC,
D:\soft\anaconda3\envs\paddle\lib\site-packages\paddle\vision\transforms\functional_pil.py:39: DeprecationWarning: BOX is deprecated and will be removed in Pillow 10 (2023-07-01). Use Resampling.BOX instead.
'box': Image.BOX,
D:\soft\anaconda3\envs\paddle\lib\site-packages\paddle\vision\transforms\functional_pil.py:40: DeprecationWarning: LANCZOS is deprecated and will be removed in Pillow 10 (2023-07-01). Use Resampling.LANCZOS instead.
'lanczos': Image.LANCZOS,
D:\soft\anaconda3\envs\paddle\lib\site-packages\paddle\vision\transforms\functional_pil.py:41: DeprecationWarning: HAMMING is deprecated and will be removed in Pillow 10 (2023-07-01). Use Resampling.HAMMING instead.
'hamming': Image.HAMMING
W1222 17:18:04.070852 28056 device_context.cc:447] Please NOTE: device: 0, GPU Compute Capability: 8.6, Driver API Version: 11.8, Runtime API Version: 11.2
W1222 17:18:04.075852 28056 device_context.cc:465] device: 0, cuDNN Version: 8.1.
W1222 17:18:05.134035 28056 device_context.h:397] WARNING: device: 0. The installed Paddle is compiled with CUDNN 8.2, but CUDNN version in your machine is 8.1, which may cause serious incompatible bug. Please recompile or reinstall Paddle with compatible CUDNN version.
loading annotations into memory...
Done (t=0.01s)
creating index...
index created!
Traceback (most recent call last):
File "tools/eval.py", line 193, in
main()
File "tools/eval.py", line 189, in main
run(FLAGS, cfg)
File "tools/eval.py", line 143, in run
trainer.load_weights(cfg.weights)
File "D:\pkg\PaddleDetection\ppdet\engine\trainer.py", line 375, in load_weights
load_pretrain_weight(self.model, weights)
File "D:\pkg\PaddleDetection\ppdet\utils\checkpoint.py", line 209, in load_pretrain_weight
"config file.".format(path))
ValueError: Model pretrain path output/faster_rcnn_r50_vd_fpn_ssld_1x_rice/best_model does not exists. If you don't want to load pretrain model, please delete pretrain_weights field in config file.

(paddle) D:\pkg\PaddleDetection>python tools/eval.py -c configs/faster_rcnn/faster_rcnn_r50_vd_fpn_ssld_1x_rice.yml -o weights=output/faster_rcnn_r50_vd_fpn_ssld_1x_rice/model_final.pdparams
D:\soft\anaconda3\envs\paddle\lib\site-packages\paddle\vision\transforms\functional_pil.py:36: DeprecationWarning: NEAREST is deprecated and will be removed in Pillow 10 (2023-07-01). Use Resampling.NEAREST or Dither.NONE instead.
'nearest': Image.NEAREST,
D:\soft\anaconda3\envs\paddle\lib\site-packages\paddle\vision\transforms\functional_pil.py:37: DeprecationWarning: BILINEAR is deprecated and will be removed in Pillow 10 (2023-07-01). Use Resampling.BILINEAR instead.
'bilinear': Image.BILINEAR,
D:\soft\anaconda3\envs\paddle\lib\site-packages\paddle\vision\transforms\functional_pil.py:38: DeprecationWarning: BICUBIC is deprecated and will be removed in Pillow 10 (2023-07-01). Use Resampling.BICUBIC instead.
'bicubic': Image.BICUBIC,
D:\soft\anaconda3\envs\paddle\lib\site-packages\paddle\vision\transforms\functional_pil.py:39: DeprecationWarning: BOX is deprecated and will be removed in Pillow 10 (2023-07-01). Use Resampling.BOX instead.
'box': Image.BOX,
D:\soft\anaconda3\envs\paddle\lib\site-packages\paddle\vision\transforms\functional_pil.py:40: DeprecationWarning: LANCZOS is deprecated and will be removed in Pillow 10 (2023-07-01). Use Resampling.LANCZOS instead.
'lanczos': Image.LANCZOS,
D:\soft\anaconda3\envs\paddle\lib\site-packages\paddle\vision\transforms\functional_pil.py:41: DeprecationWarning: HAMMING is deprecated and will be removed in Pillow 10 (2023-07-01). Use Resampling.HAMMING instead.
'hamming': Image.HAMMING
W1222 17:19:54.703459 37624 device_context.cc:447] Please NOTE: device: 0, GPU Compute Capability: 8.6, Driver API Version: 11.8, Runtime API Version: 11.2
W1222 17:19:54.707639 37624 device_context.cc:465] device: 0, cuDNN Version: 8.1.
W1222 17:19:55.760320 37624 device_context.h:397] WARNING: device: 0. The installed Paddle is compiled with CUDNN 8.2, but CUDNN version in your machine is 8.1, which may cause serious incompatible bug. Please recompile or reinstall Paddle with compatible CUDNN version.
loading annotations into memory...
Done (t=0.00s)
creating index...
index created!
[12/22 17:19:57] ppdet.utils.checkpoint INFO: Finish loading model weights: output/faster_rcnn_r50_vd_fpn_ssld_1x_rice/model_final.pdparams
[12/22 17:19:59] ppdet.engine INFO: Eval iter: 0
[12/22 17:20:00] 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/22 17:20:00] ppdet.metrics.coco_utils INFO: Start evaluate...
Loading and preparing results...
DONE (t=0.01s)
creating index...
index created!
Traceback (most recent call last):
File "tools/eval.py", line 193, in
main()
File "tools/eval.py", line 189, in main
run(FLAGS, cfg)
File "tools/eval.py", line 154, in run
trainer.evaluate()
File "D:\pkg\PaddleDetection\ppdet\engine\trainer.py", line 621, in evaluate
self._eval_with_loader(self.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

(paddle) D:\pkg\PaddleDetection>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
D:\soft\anaconda3\envs\paddle\lib\site-packages\paddle\vision\transforms\functional_pil.py:36: DeprecationWarning: NEAREST is deprecated and will be removed in Pillow 10 (2023-07-01). Use Resampling.NEAREST or Dither.NONE instead.
'nearest': Image.NEAREST,
D:\soft\anaconda3\envs\paddle\lib\site-packages\paddle\vision\transforms\functional_pil.py:37: DeprecationWarning: BILINEAR is deprecated and will be removed in Pillow 10 (2023-07-01). Use Resampling.BILINEAR instead.
'bilinear': Image.BILINEAR,
D:\soft\anaconda3\envs\paddle\lib\site-packages\paddle\vision\transforms\functional_pil.py:38: DeprecationWarning: BICUBIC is deprecated and will be removed in Pillow 10 (2023-07-01). Use Resampling.BICUBIC instead.
'bicubic': Image.BICUBIC,
D:\soft\anaconda3\envs\paddle\lib\site-packages\paddle\vision\transforms\functional_pil.py:39: DeprecationWarning: BOX is deprecated and will be removed in Pillow 10 (2023-07-01). Use Resampling.BOX instead.
'box': Image.BOX,
D:\soft\anaconda3\envs\paddle\lib\site-packages\paddle\vision\transforms\functional_pil.py:40: DeprecationWarning: LANCZOS is deprecated and will be removed in Pillow 10 (2023-07-01). Use Resampling.LANCZOS instead.
'lanczos': Image.LANCZOS,
D:\soft\anaconda3\envs\paddle\lib\site-packages\paddle\vision\transforms\functional_pil.py:41: DeprecationWarning: HAMMING is deprecated and will be removed in Pillow 10 (2023-07-01). Use Resampling.HAMMING instead.
'hamming': Image.HAMMING
loading annotations into memory...
Done (t=0.05s)
creating index...
index created!
W1222 17:22:24.654457 42104 device_context.cc:447] Please NOTE: device: 0, GPU Compute Capability: 8.6, Driver API Version: 11.8, Runtime API Version: 11.2
W1222 17:22:24.659533 42104 device_context.cc:465] device: 0, cuDNN Version: 8.1.
W1222 17:22:25.917392 42104 device_context.h:397] WARNING: device: 0. The installed Paddle is compiled with CUDNN 8.2, but CUDNN version in your machine is 8.1, which may cause serious incompatible bug. Please recompile or reinstall Paddle with compatible CUDNN version.
[12/22 17:22:28] ppdet.utils.checkpoint INFO: Finish loading model weights: C:\Users\NINGMEI/.cache/paddle/weights\ResNet50_vd_ssld_v2_pretrained.pdparams
[12/22 17:22:30] ppdet.engine INFO: Epoch: [0] [ 0/260] learning_rate: 0.000125 loss_rpn_cls: 0.693904 loss_rpn_reg: 0.356441 loss_bbox_cls: 0.673198 loss_bbox_reg: 0.035566 loss: 1.759109 eta: 1:33:46 batch_cost: 1.8035 data_cost: 0.0000 ips: 0.5545 images/s
[12/22 17:22:32] ppdet.engine INFO: Epoch: [0] [ 20/260] learning_rate: 0.000148 loss_rpn_cls: 0.691607 loss_rpn_reg: 0.224547 loss_bbox_cls: 0.403094 loss_bbox_reg: 0.030676 loss: 1.416234 eta: 0:09:23 batch_cost: 0.1006 data_cost: 0.0000 ips: 9.9356 images/s
[12/22 17:22:34] ppdet.engine INFO: Epoch: [0] [ 40/260] learning_rate: 0.000170 loss_rpn_cls: 0.687207 loss_rpn_reg: 0.209526 loss_bbox_cls: 0.203862 loss_bbox_reg: 0.114515 loss: 1.216542 eta: 0:07:14 batch_cost: 0.0987 data_cost: 0.0000 ips: 10.1364 images/s
[12/22 17:22:36] ppdet.engine INFO: Epoch: [0] [ 60/260] learning_rate: 0.000192 loss_rpn_cls: 0.679385 loss_rpn_reg: 0.185349 loss_bbox_cls: 0.402787 loss_bbox_reg: 0.423124 loss: 1.684347 eta: 0:06:32 batch_cost: 0.1019 data_cost: 0.0000 ips: 9.8099 images/s
[12/22 17:22:38] ppdet.engine INFO: Epoch: [0] [ 80/260] learning_rate: 0.000215 loss_rpn_cls: 0.672719 loss_rpn_reg: 0.274452 loss_bbox_cls: 0.485732 loss_bbox_reg: 0.582607 loss: 2.093315 eta: 0:06:12 batch_cost: 0.1045 data_cost: 0.0001 ips: 9.5707 images/s
[12/22 17:22:40] ppdet.engine INFO: Epoch: [0] [100/260] learning_rate: 0.000237 loss_rpn_cls: 0.661841 loss_rpn_reg: 0.209330 loss_bbox_cls: 0.563600 loss_bbox_reg: 0.706078 loss: 2.147810 eta: 0:06:03 batch_cost: 0.1123 data_cost: 0.0000 ips: 8.9028 images/s
[12/22 17:22:44] ppdet.engine INFO: Epoch: [0] [120/260] learning_rate: 0.000260 loss_rpn_cls: 0.649042 loss_rpn_reg: 0.179652 loss_bbox_cls: 0.570783 loss_bbox_reg: 0.846109 loss: 2.308572 eta: 0:06:29 batch_cost: 0.1774 data_cost: 0.0000 ips: 5.6361 images/s
[12/22 17:22:48] ppdet.engine INFO: Epoch: [0] [140/260] learning_rate: 0.000283 loss_rpn_cls: 0.635163 loss_rpn_reg: 0.215484 loss_bbox_cls: 0.536656 loss_bbox_reg: 0.742632 loss: 2.144272 eta: 0:06:48 batch_cost: 0.1800 data_cost: 0.0001 ips: 5.5565 images/s
[12/22 17:22:51] ppdet.engine INFO: Epoch: [0] [160/260] learning_rate: 0.000305 loss_rpn_cls: 0.606619 loss_rpn_reg: 0.228886 loss_bbox_cls: 0.533526 loss_bbox_reg: 0.813776 loss: 2.179272 eta: 0:07:01 batch_cost: 0.1798 data_cost: 0.0002 ips: 5.5624 images/s
[12/22 17:22:55] ppdet.engine INFO: Epoch: [0] [180/260] learning_rate: 0.000328 loss_rpn_cls: 0.561313 loss_rpn_reg: 0.223344 loss_bbox_cls: 0.518211 loss_bbox_reg: 0.821883 loss: 2.143983 eta: 0:07:10 batch_cost: 0.1804 data_cost: 0.0001 ips: 5.5439 images/s
[12/22 17:22:59] ppdet.engine INFO: Epoch: [0] [200/260] learning_rate: 0.000350 loss_rpn_cls: 0.489461 loss_rpn_reg: 0.193966 loss_bbox_cls: 0.485476 loss_bbox_reg: 0.845269 loss: 2.011831 eta: 0:07:18 batch_cost: 0.1828 data_cost: 0.0002 ips: 5.4692 images/s
[12/22 17:23:02] ppdet.engine INFO: Epoch: [0] [220/260] learning_rate: 0.000373 loss_rpn_cls: 0.368714 loss_rpn_reg: 0.166986 loss_bbox_cls: 0.440583 loss_bbox_reg: 0.811506 loss: 1.813768 eta: 0:07:26 batch_cost: 0.1910 data_cost: 0.0001 ips: 5.2352 images/s
[12/22 17:23:06] ppdet.engine INFO: Epoch: [0] [240/260] learning_rate: 0.000395 loss_rpn_cls: 0.278925 loss_rpn_reg: 0.162571 loss_bbox_cls: 0.395618 loss_bbox_reg: 0.815755 loss: 1.685229 eta: 0:07:30 batch_cost: 0.1868 data_cost: 0.0002 ips: 5.3538 images/s
[12/22 17:23:10] 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/22 17:23:10] ppdet.engine INFO: Eval iter: 0
[12/22 17:23:13] 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/22 17:23:13] 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

@cunjing56
Copy link
Author

重新安装环境的问题是,现在没有办法再指定安装到1.21.5的numpy 安装paddle会自动升级为1.21.6, 卸载numpy重新安装就会自动卸载paddle.

@nemonameless
Copy link
Collaborator

这个是win环境下pycocotools的问题,cocodataset/cocoapi#356 ,建议卸载pycocotools再重装。
指定安装numpy版本,pip install numpy==1.21.5 也不行吗?卸载numpy不可能连带着卸载paddle的。

@gaohuayang
Copy link

我在AiStudio也报了这个错,训练没问题,评估的时候报错,把numpy降到1.17.0就好了
paddle = 2.4.0
pycocotools = 2.0.0
numpy = 1.17.0

@cunjing56
Copy link
Author

这个是win环境下pycocotools的问题,cocodataset/cocoapi#356 ,建议卸载pycocotools再重装。 指定安装numpy版本,pip install numpy==1.21.5 也不行吗?卸载numpy不可能连带着卸载paddle的。

感恩的心!终于好了!我之前是本地装的pycocotools, 按你的卸载了,重装的时候我在线装的pycocotools-windows ,再运行就不再报错了!
等待了一个月!!感恩!

@gs80140
Copy link

gs80140 commented Sep 14, 2023

这个是win环境下pycocotools的问题,cocodataset/cocoapi#356 ,建议卸载pycocotools再重装。 指定安装numpy版本,pip install numpy==1.21.5 也不行吗?卸载numpy不可能连带着卸载paddle的。

感恩的心!终于好了!我之前是本地装的pycocotools, 按你的卸载了,重装的时候我在线装的pycocotools-windows ,再运行就不再报错了! 等待了一个月!!感恩!

果然有效, 太感谢了,差点放弃了, 幸好遇到你
操作环境 windows10 , GPU 3060 , CURD 11.8
仅仅执行如下命令即可,不需要重新 numpy
pip uninstall pycocotools
pip install pycocotools

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

No branches or pull requests

4 participants