请提出你的问题 Please ask your question
paddlepaddle == 2.3.2
使用官方提供的paddleYOLO 代码,数据集coco,使用yolov5_m_300e_coco.yml
device:cpu,batchsize:2
使用了动态图转静态图方法,具体做法:
参考:https://www.paddlepaddle.org.cn/documentation/docs/zh/guides/jit/basic_usage_cn.html#inputspec
在yolov5.py中def _forward(self):上面增加@paddle.jit.to_static
错误:
File "tools/train.py", line 176, in
main()
File "tools/train.py", line 169, in main
run(FLAGS, cfg)
File "tools/train.py", line 133, in run
trainer.train(FLAGS.eval)
File "D:\paddle\yolov5\PaddleYOLO\ppdet\engine\trainer.py", line 539, in train
outputs = model(data)
File "C:\Users\Anaconda3\envs\paddle\lib\site-packages\paddle\fluid\dygraph\layers.py", line 930, in call
return self._dygraph_call_func(*inputs, **kwargs)
File "C:\Users\Anaconda3\envs\paddle\lib\site-packages\paddle\fluid\dygraph\layers.py", line 915, in _dygraph_call_func
outputs = self.forward(*inputs, **kwargs)
File "D:\paddle\yolov5\PaddleYOLO\ppdet\modeling\architectures\meta_arch.py", line 59, in forward
out = self.get_loss()
File "D:\paddle\yolov5\PaddleYOLO\ppdet\modeling\architectures\yolov5.py", line 105, in get_loss
return self.forward()
File "C:\Users\Anaconda3\envs\paddle\lib\site-packages\paddle\fluid\dygraph\dygraph_to_static\program_translator.py", line 379, in call
error_data.raise_new_exception()
File "C:\Users\Anaconda3\envs\paddle\lib\site-packages\paddle\fluid\dygraph\dygraph_to_static\error.py", line 336, in raise_new_exception
six.exec("raise new_exception from None")
File "", line 1, in
ValueError: In transformed code:
File "D:\paddle\yolov5\PaddleYOLO\ppdet\modeling\architectures\yolov5.py", line 81, in _forward
@paddle.jit.to_static
def _forward(self):
body_feats = self.backbone(self.inputs)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ <--- HERE
neck_feats = self.neck(body_feats, self.for_mot)
File "C:\Users\Anaconda3\envs\paddle\lib\site-packages\paddle\fluid\dygraph\layers.py", line 930, in call
return self._dygraph_call_func(*inputs, **kwargs)
File "C:\Users\Anaconda3\envs\paddle\lib\site-packages\paddle\fluid\dygraph\layers.py", line 915, in _dygraph_call_func
outputs = self.forward(*inputs, **kwargs)
File "D:\paddle\yolov5\PaddleYOLO\ppdet\modeling\backbones\csp_darknet.py", line 421, in forward
x = self.stem(x)
File "C:\Users\Anaconda3\envs\paddle\lib\site-packages\paddle\fluid\dygraph\layers.py", line 930, in call
return self._dygraph_call_func(*inputs, **kwargs)
File "C:\Users\Anaconda3\envs\paddle\lib\site-packages\paddle\fluid\dygraph\layers.py", line 915, in _dygraph_call_func
outputs = self.forward(*inputs, **kwargs)
File "D:\paddle\yolov5\PaddleYOLO\ppdet\modeling\backbones\csp_darknet.py", line 84, in forward
x = self.bn(self.conv(x))
File "C:\Users\Anaconda3\envs\paddle\lib\site-packages\paddle\fluid\dygraph\layers.py", line 930, in call
return self._dygraph_call_func(*inputs, **kwargs)
File "C:\Users\Anaconda3\envs\paddle\lib\site-packages\paddle\fluid\dygraph\layers.py", line 915, in _dygraph_call_func
outputs = self.forward(*inputs, **kwargs)
File "C:\Users\Anaconda3\envs\paddle\lib\site-packages\paddle\nn\layer\conv.py", line 678, in forward
use_cudnn=self._use_cudnn)
File "C:\Users\Anaconda3\envs\paddle\lib\site-packages\paddle\nn\functional\conv.py", line 169, in _conv_nd
type=op_type, inputs=inputs, outputs=outputs, attrs=attrs)
File "C:\Users\Anaconda3\envs\paddle\lib\site-packages\paddle\fluid\layer_helper.py", line 44, in append_op
return self.main_program.current_block().append_op(*args, **kwargs)
File "C:\Users\Anaconda3\envs\paddle\lib\site-packages\paddle\fluid\framework.py", line 3621, in append_op
attrs=kwargs.get("attrs", None))
File "C:\Users\Anaconda3\envs\paddle\lib\site-packages\paddle\fluid\framework.py", line 2635, in init
for frame in traceback.extract_stack():
InvalidArgumentError: The conv2d Op's Input Variable Input contains uninitialized Tensor.
[Hint: Expected t->IsInitialized() == true, but received t->IsInitialized():0 != true:1.] (at C:\home\workspace\Paddle_release\paddle\fluid\framework\operator.cc:2094)
[operator < conv2d > error] [operator < run_program > error]
在yolov5.py中_forward函数里面打印self.inputs是有值的,错误提示input含有未初始化Tensor,这个应该怎么处理?
您好,我们已经收到了您的问题,会安排技术人员尽快解答您的问题,请耐心等待。请您再次检查是否提供了清晰的问题描述、复现代码、环境&版本、报错信息等。同时,您也可以通过查看官网API文档、常见问题、历史Issue、AI社区来寻求解答。祝您生活愉快~
Hi! We've received your issue and please be patient to get responded. We will arrange technicians to answer your questions as soon as possible. Please make sure that you have posted enough message to demo your request. You may also check out the API,FAQ,Github Issue and AI community to get the answer.Have a nice day!
您好,已有提供COCO的yolov5-m动转静导出后的模型,下载链接,请参考 https://github.com/PaddlePaddle/PaddleYOLO/blob/release/2.5/docs/MODEL_ZOO_cn.md
导出命令:
python tools/export_model.py -c configs/yolov5/yolov5_m_300e_coco.yml -o weights=https://paddledet.bj.bcebos.com/models/yolov5_m_300e_coco.pdparams # exclude_nms=True trt=True
您好,已有提供COCO的yolov5-m动转静导出后的模型,下载链接,请参考 https://github.com/PaddlePaddle/PaddleYOLO/blob/release/2.5/docs/MODEL_ZOO_cn.md
导出命令:
python tools/export_model.py -c configs/yolov5/yolov5_m_300e_coco.yml -o weights=https://paddledet.bj.bcebos.com/models/yolov5_m_300e_coco.pdparams # exclude_nms=True trt=True
Hi, I'm following this and the error still there, any advice?
您好,已有提供COCO的yolov5-m动转静导出后的模型,下载链接,请参考 https://github.com/PaddlePaddle/PaddleYOLO/blob/release/2.5/docs/MODEL_ZOO_cn.md
导出命令:
python tools/export_model.py -c configs/yolov5/yolov5_m_300e_coco.yml -o weights=https://paddledet.bj.bcebos.com/models/yolov5_m_300e_coco.pdparams # exclude_nms=True trt=True
Hi, I'm following this and the error still there, any advice?
Hi, you can report your bug in https://github.com/PaddlePaddle/PaddleYOLO/issues.
Please follow this template:
https://github.com/PaddlePaddle/PaddleYOLO/issues/new?assignees=&labels=type%2Fbug-report%2Cstatus%2Fnew-issue&template=1_bug-report.yml
Since you haven't replied for more than a year, we have closed this issue/pr.
If the problem is not solved or there is a follow-up one, please reopen it at any time and we will continue to follow up.
由于您超过一年未回复,我们将关闭这个issue/pr。
若问题未解决或有后续问题,请随时重新打开,我们会继续跟进。