hpc203 / yolo-fastestv2-opencv

使用OpenCV部署Yolo-FastestV2,包含C++和Python两种版本的程序

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

pth转onnx报错,assert (num_channels % 4 == 0)

wukongxuetang opened this issue · comments

使用您提供的convert-onnx进行yolo fastest v2内pth转换时,提示以下报错
D:\labelImg\yolofastv2\convert_onnx>python pytorch2onnx.py --data coco.data --weights coco.pth
load param...
D:\labelImg\yolofastv2\convert_onnx\model\backbone\shufflenetv2.py:59: TracerWarning: Converting a tensor to a Python boolean 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!
assert (num_channels % 4 == 0)

使用您提供的convert-onnx进行yolo fastest v2内pth转换时,提示以下报错 D:\labelImg\yolofastv2\convert_onnx>python pytorch2onnx.py --data coco.data --weights coco.pth load param... D:\labelImg\yolofastv2\convert_onnx\model\backbone\shufflenetv2.py:59: TracerWarning: Converting a tensor to a Python boolean 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! assert (num_channels % 4 == 0)

碰到了同样的问题,求解
load param...
/home/test/miniconda3/lib/python3.7/site-packages/torch/nn/functional.py:718: UserWarning: Named tensors and all their associated APIs are an experimental feature and subject to change. Please do not use them for anything important until they are released as stable. (Triggered internally at /pytorch/c10/core/TensorImpl.h:1156.)
return torch.max_pool2d(input, kernel_size, stride, padding, dilation, ceil_mode)
/home/test/data/qqhu/ml/Yolo-FastestV2/model/backbone/shufflenetv2.py:59: TracerWarning: Converting a tensor to a Python boolean 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!
assert (num_channels % 4 == 0)
/home/test/miniconda3/lib/python3.7/site-packages/torch/_tensor.py:575: UserWarning: floor_divide is deprecated, and will be removed in a future version of pytorch. It currently rounds toward 0 (like the 'trunc' function NOT 'floor'). This results in incorrect rounding for negative values.
To keep the current behavior, use torch.div(a, b, rounding_mode='trunc'), or for actual floor division, use torch.div(a, b, rounding_mode='floor'). (Triggered internally at /pytorch/aten/src/ATen/native/BinaryOps.cpp:467.)
return torch.floor_divide(self, other)