Paddle hub solov2 [operator < gather > error]
欢迎您反馈PaddleHub使用问题,非常感谢您对PaddleHub的贡献! 在留下您的问题时,辛苦您同步提供如下信息:
- 版本、环境信息 1)PaddleHub和PaddlePaddle版本:请提供您的PaddleHub和PaddlePaddle版本号,例如PaddleHub1.4.1,PaddlePaddle1.6.2 2)系统环境:请您描述系统类型,例如Linux/Windows/MacOS/,python版本
- 复现信息:如为报错,请给出复现环境、复现步骤
PaddleHub 2.1.1 与 PaddlePaddle 2.2.0 安装在windows10 anaconda上时 运行solov2 示例程序
import cv2 import paddlehub as hub
img = cv2.imread('/PATH/TO/IMAGE') model = hub.Module(name='solov2', use_gpu=False) output = model.predict(image=img, visualization=False)
出现报错
W1111 19:56:47.858419 4732 analysis_predictor.cc:1353] Deprecated. Please use CreatePredictor instead.
e[37m--- Fused 0 subgraphs into layer_norm op.e[0m
e[37m--- fused 0 pairs of fc gru patternse[0m
Traceback (most recent call last):
File "tes.py", line 7, in
File "tools/export_model.py", line 89, in <module>
main()
File "tools/export_model.py", line 63, in main
test_fetches = model.test(feed_vars, exclude_nms=FLAGS.exclude_nms)
File "/paddle/tools/PaddleDetection/ppdet/modeling/architectures/solov2.py", line 175, in test
return self.build(feed_vars, mode='test')
File "/paddle/tools/PaddleDetection/ppdet/modeling/architectures/solov2.py", line 110, in build
return self.bbox_head.get_prediction(*seg_inputs)
File "/paddle/tools/PaddleDetection/ppdet/modeling/anchor_heads/solov2_head.py", line 336, in get_prediction
im_info[idx])
File "/paddle/tools/PaddleDetection/ppdet/modeling/anchor_heads/solov2_head.py", line 382, in get_seg_single
strides = fluid.layers.gather(strides, index=inds[:, 0])
File "/usr/local/lib/python3.7/site-packages/paddle/fluid/layers/nn.py", line 8328, in gather
attrs={'overwrite': overwrite})
File "/usr/local/lib/python3.7/site-packages/paddle/fluid/layer_helper.py", line 43, in append_op
return self.main_program.current_block().append_op(*args, **kwargs)
File "/usr/local/lib/python3.7/site-packages/paddle/fluid/framework.py", line 2917, in append_op
attrs=kwargs.get("attrs", None))
File "/usr/local/lib/python3.7/site-packages/paddle/fluid/framework.py", line 2014, in __init__
for frame in traceback.extract_stack():
OutOfRangeError: The element of Index must be less than the size of input dim size of axis which is 3872, but received index element which is 3872 in the 20 index.
[Hint: Expected p_index[i] < input_size, but received p_index[i]:3872 >= input_size:3872.] (at C:\home\workspace\Paddle_release\paddle/fluid/operators/gather.h:82)
[operator < gather > error]
尝试更换目标图片仍然同样报错,应该与图片本身无关
看报错好像是gather这个算子发生了运行时错误,p_index[I]本应 < input_size,现在 = input_size了
但是奇怪的是上个星期一点问题没有 今天再去试就这样了 重装了环境和paddle都没用
您好,可以降低paddle版本到2.1尝试是否能正常使用。
我已经尝试了包括2.1.3 和 2.0.0 的paddle, 2.0的hub 在内的各种组合 仍然有同样报错 但是两到三周前这个solov2完全正常,不知道是不是这两周有什么改动?
您好,我用Paddle2.2能够复现出你这个错误,但是我这里使用Paddle 2.1.1的版本运行这个模型是没有问题的,因目前Paddle版本升级造成的兼容性问题给您带来的不便感到抱歉。
我在这里尝试安装了2.1.1 还是有这个错误 能具体讲一下怎么删除更高版本的paddle和回到2.1.1的方式吗
以及对应paddlehub版本应该是多少?
可以根据使用的环境(pip, conda等)参考如下Paddle安装页面进行2.1.1版本的安装
https://www.paddlepaddle.org.cn/install/quick?docurl=/documentation/docs/zh/install/pip/linux-pip.html
以下是在该版本环境下的复现结果
碰到了同样的问题,请问现在有解决方案吗?paddlehub=2.1.1,paddle=2.2.1
各种版本组合试了都不行,估计是更新代码然后bug了
你好,需要安装飞桨的框架paddlepaddle的版本为2.1