python export.py --weights yolov5s.pt --simplify --include onnx
export: data=D:\yolo\yolov5-7.0\data\coco128.yaml, weights=['yolov5s.pt'], imgsz=[640, 640], batch_size=1, device=cpu, half=False, inplace=False, keras=False, optimize=False, int8=False, dynamic=False, simplify=True, opset=12, verbose=False, workspace=4, nms=False, agnostic_nms=False, topk_per_class=100, topk_all=100, iou_thres=0.45, conf_thres=0.25, include=['onnx']
YOLOv5 2023-8-5 Python-3.11.9 torch-2.5.0+cu121 CPU
D:\yolo\yolov5-7.0\models\experimental.py:79: FutureWarning: You are using torch.load with weights_only=False (the current default value), which uses the default pickle module implicitly. It is possible to construct malicious pickle data which will execute arbitrary code during unpickling (See https://github.com/pytorch/pytorch/blob/main/SECURITY.md#untrusted-models for more details). In a future release, the default value for weights_only will be flipped to True. This limits the functions that could be executed during unpickling. Arbitrary objects will no longer be allowed to be loaded via this mode unless they are explicitly allowlisted by the user via torch.serialization.add_safe_globals. We recommend you start setting weights_only=True for any use case where you don't have full control of the loaded file. Please open an issue on GitHub for any issues related to this experimental feature.
ckpt = torch.load(attempt_download(w), map_location='cpu') # load
Fusing layers...
YOLOv5s summary: 213 layers, 7225885 parameters, 0 gradients, 16.4 GFLOPs
PyTorch: starting from yolov5s.pt with output shape (1, 25200, 85) (14.1 MB)
ONNX: export failure 1.5s: DLL load failed while importing onnx_cpp2py_export: (DLL)
Traceback (most recent call last):
File "D:\yolo\yolov5-7.0\export.py", line 658, in
main(opt)
File "D:\yolo\yolov5-7.0\export.py", line 652, in main
run(**vars(opt))
File "C:\Users\chuuimc\AppData\Local\Programs\Python\Python311\Lib\site-packages\torch\utils_contextlib.py", line 116, in decorate_context
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "D:\yolo\yolov5-7.0\export.py", line 569, in run
f[2], _ = export_onnx(model, im, file, opset, dynamic, simplify)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\yolo\yolov5-7.0\export.py", line 113, in outer_func
raise e
File "D:\yolo\yolov5-7.0\export.py", line 108, in outer_func
f, model = inner_func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\yolo\yolov5-7.0\export.py", line 139, in export_onnx
import onnx
File "C:\Users\chuuimc\AppData\Local\Programs\Python\Python311\Lib\site-packages\onnx_init_.py", line 77, in
from onnx.onnx_cpp2py_export import ONNX_ML
ImportError: DLL load failed while importing onnx_cpp2py_export: 动态链接库(DLL)初始化例程失败。