TracerWarning: Converting a tensor to a Python integer might cause the trace to be incorrect.
ybxbupt opened this issue · comments
运行convert_onnx.py时出现下列警告:
Namespace(net_type='yolov5s')
360 360
360 360
H:\yuanbaoxi\ybx_gitee\yolov5-dnn-cpp-py\yolov5s.py:36: TracerWarning: Converting a tensor to a Python integer might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
route = F.interpolate(xRt2, size=(int(xRt2.shape[2] * 2), int(xRt2.shape[3] * 2)), mode='nearest')
H:\yuanbaoxi\ybx_gitee\yolov5-dnn-cpp-py\yolov5s.py:40: TracerWarning: Converting a tensor to a Python integer might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
route = F.interpolate(xRt3, size=(int(xRt3.shape[2] * 2), int(xRt3.shape[3] * 2)), mode='nearest')
convert yolov5s.onnx to onnx finish!!!
然后出现下面错误:
read failed
我这边Pytorch时1.7.0版本的,你那边的哪个版本的
我的时1.7.1版本,我试试1.7.0
多谢回复
1.7.0出现同样的错误,我的所有包列表如下:
Package Version
certifi 2020.12.5
dataclasses 0.6
future 0.18.2
numpy 1.19.5
opencv-python 4.0.0.21
pip 20.3.3
setuptools 51.3.3.post20210118
torch 1.7.0+cu101
tqdm 4.56.0
typing-extensions 3.7.4.3
wheel 0.36.2
wincertstore 0.2
我的python版本时3.7
1.7.0出现同样的错误,我的所有包列表如下:
Package Versioncertifi 2020.12.5
dataclasses 0.6
future 0.18.2
numpy 1.19.5
opencv-python 4.0.0.21
pip 20.3.3
setuptools 51.3.3.post20210118
torch 1.7.0+cu101
tqdm 4.56.0
typing-extensions 3.7.4.3
wheel 0.36.2
wincertstore 0.2
升级opencv-python
麻烦您用pip list看一下您的opencv-python版本
我升级跟您一样的版本试试
麻烦您用pip list看一下您的opencv-python版本
我这边是4.5.1的
opencv-python的4.5.1版本能够正确运行,多谢指导!
能运行,但是结果差了好多,啥原因?