在yolov5使用export.py将pt文件转为onnx时,报错:
(yolov5) PS D:\zn\yolov5-fire> python export.py --include onnx --opset 11
export: weights=runs/train/exp41/weights/best.pt, img_size=[320, 320], batch_size=1, device=cpu, include=['onnx'], half=False, inplace=False, train=False, optimize=False, dynamic=False, simplify=False, opset=11
YOLOv5 72f8dad torch 1.8.2+cu111 CPU
Fusing layers...
Model Summary: 230 layers, 9539697 parameters, 0 gradients, 19.2 GFLOPs
PyTorch: starting from runs/train/exp41/weights/best.pt (19.3 MB)
ONNX: starting export with onnx 1.13.1...
D:\zn\yolov5-fire\models\yolo.py:58: 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!
if self.grid[i].shape[2:4] != x[i].shape[2:4] or self.onnx_dynamic:
ONNX: export failure: Exporting the operator deform_conv2d to ONNX opset version 11 is not supported. Please feel free to request support or submit a pull request on PyTorch GitHub.
Export complete (1.63s)
Results saved to D:\zn\yolov5-fire\runs\train\exp41\weights
Visualize with https://netron.app