PaddleDetection测试代码报错
收藏
开宗明义:
在跑测试代码
python ppdet/modeling/tests/test_architectures.py
时,报错TypeError: 'MultiBoxHead' object is not callable
全过程如下:
按照paddle的安装说明INSTALL_cn一步步执行。
最开始是安装不上COCO-API。折腾了半天,通过以下方法终于安装成功。
坑1: 问题:无法运行pip install git+https://github.com/philferriere/cocoapi.git#subdirectory=PythonAPI 解决方法:运行conda install git 坑2: 问题:安不上cocoapi,运行pip install git+https://github.com/philferriere/cocoapi.git#subdirectory=PythonAPI还是失败 解决方法:在 https://github.com/philferriere/cocoapi 下载源码,并进行解压。 以管理员身份打开 CMD 终端,并切换到 *\cocoapi-master\PythonAPI 目录。(本电脑位置 E:\AI\cocoapi-master\PythonAPI ) python setup.py build_ext install 此时又出现问题: error: Unable to find vcvarsall.bat 原因:Microsoft Visual Studio版本太低 尝试:安装VS2015后,问题仍未解决 尝试:安装VS2019,网络连接问题,“无法下载通道清单“。 解决办法:连接手机热点,控制面板\网络和 Internet\网络连接,wlan属性,ipv4,使用下面的DNS服务器地址:首选DNS服务器114.114.114.114;备选DNS服务器8.8.8.8 成功安装VS2019后,重新执行python setup.py build_ext install 没有再报错“error: Unable to find vcvarsall.bat”,该问题解决 但又出现新问题:fatal error C1083: 无法打开包括文件: “io.h”: No such file or directory 转换思路:执行pip install git+https://github.com/philferriere/cocoapi.git#subdirectory=PythonAPI 报错:ERROR: Command errored out with exit status 128: 原因:网络连接问题。换手机热点,解决。 出现新问题:fatal error C1083: 无法打开包括文件: “io.h”: No such file or directory (该问题和离线安装一样) 尝试1:安装Windows 10 SDK(链接https://developer.microsoft.com/zh-cn/windows/downloads/windows-10-sdk/) 成功解决
使用的cuda版本是10.1.105_418.96,cudnn版本是v7.6.5.32
安装对应版本的paddle。
python -m pip install paddlepaddle-gpu==2.0.1.post101 -f https://paddlepaddle.org.cn/whl/mkl/stable.html
执行paddle.utils.run_check(),返回的结果为:
W0408 18:42:01.823998 17292 device_context.cc:362] Please NOTE: device: 0, GPU Compute Capability: 7.5, Driver API Version: 11.0, Runtime API Version: 10.1 W0408 18:42:01.962602 17292 device_context.cc:372] device: 0, cuDNN Version: 7.6. PaddlePaddle works well on 1 GPU. W0408 18:42:10.303730 17292 build_strategy.cc:171] fusion_group is not enabled for Windows/MacOS now, and only effective when running with CUDA GPU. PaddlePaddle works well on 1 GPUs. PaddlePaddle is installed successfully! Let's start deep learning with PaddlePaddle now.
最后输入测试代码:
python ppdet/modeling/tests/test_architectures.py
却报错 TypeError: 'MultiBoxHead' object is not callable
全部报错信息如下:
(paddle) E:\coal_rock_AI\PaddleDetection-release-2.0-rc>python ppdet/modeling/tests/test_architectures.py E:\coal_rock_AI\PaddleDetection-release-2.0-rc\ppdet\core\workspace.py:170: DeprecationWarning: The 'warn' method is deprecated, use 'warning' instead 'is required.'.format(cls.__op__)) 2021-04-08 18:42:49,674 - WARNING - OP not found, maybe a newer version of paddle is required. ssC:\Users\pc\Miniconda3\envs\paddle\lib\site-packages\paddle\fluid\layers\math_op_patch.py:298: UserWarning: E:\coal_rock_AI\PaddleDetection-release-2.0-rc\ppdet\modeling\roi_heads\bbox_head.py:315 The behavior of expression A / B has been unified with elementwise_div(X, Y, axis=-1) from Paddle 2.0. If your code works well in the older versions but crashes in this version, try to use elementwise_div(X, Y, axis=0) instead of A / B. This transitional warning will be dropped in the future. op_type, op_type, EXPRESSION_MAP[method_name])) ..C:\Users\pc\Miniconda3\envs\paddle\lib\site-packages\paddle\fluid\layers\math_op_patch.py:298: UserWarning: E:\coal_rock_AI\PaddleDetection-release-2.0-rc\ppdet\modeling\architectures\mask_rcnn.py:253 The behavior of expression A * B has been unified with elementwise_mul(X, Y, axis=-1) from Paddle 2.0. If your code works well in the older versions but crashes in this version, try to use elementwise_mul(X, Y, axis=0) instead of A * B. This transitional warning will be dropped in the future. op_type, op_type, EXPRESSION_MAP[method_name])) ....EE.. ====================================================================== ERROR: test_test (__main__.TestSSD) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\coal_rock_AI\PaddleDetection-release-2.0-rc\ppdet\modeling\tests\decorator_helper.py", line 29, in __fn__ fn(*args, **kwargs) File "ppdet/modeling/tests/test_architectures.py", line 59, in test_test test_fetches = model.eval(feed_vars) File "E:\coal_rock_AI\PaddleDetection-release-2.0-rc\ppdet\modeling\architectures\ssd.py", line 135, in eval return self.build(feed_vars, 'eval') File "E:\coal_rock_AI\PaddleDetection-release-2.0-rc\ppdet\modeling\architectures\ssd.py", line 87, in build inputs=body_feats, image=im, num_classes=self.num_classes) TypeError: 'MultiBoxHead' object is not callable ====================================================================== ERROR: test_train (__main__.TestSSD) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\coal_rock_AI\PaddleDetection-release-2.0-rc\ppdet\modeling\tests\decorator_helper.py", line 29, in __fn__ fn(*args, **kwargs) File "ppdet/modeling/tests/test_architectures.py", line 51, in test_train train_fetches = model.train(feed_vars) File "E:\coal_rock_AI\PaddleDetection-release-2.0-rc\ppdet\modeling\architectures\ssd.py", line 132, in train return self.build(feed_vars, 'train') File "E:\coal_rock_AI\PaddleDetection-release-2.0-rc\ppdet\modeling\architectures\ssd.py", line 87, in build inputs=body_feats, image=im, num_classes=self.num_classes) TypeError: 'MultiBoxHead' object is not callable ---------------------------------------------------------------------- Ran 12 tests in 5.369s FAILED (errors=2, skipped=2)
这下真不会了。
求问怎么解决
0
收藏
请登录后评论