Export
Export¶
You can simply export model to ONNX format by calling export
method.
Load trained hub¶
In [1]:
Copied!
from waffle_hub.hub import Hub
hub = Hub.load("detector")
from waffle_hub.hub import Hub
hub = Hub.load("detector")
/home/lhj/anaconda3/envs/waffle/lib/python3.9/site-packages/tqdm/auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html from .autonotebook import tqdm as notebook_tqdm
In [2]:
Copied!
hub.export()
hub.export()
/home/lhj/anaconda3/envs/waffle/lib/python3.9/site-packages/ultralytics/nn/modules/head.py:50: 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! elif self.dynamic or self.shape != shape: /home/lhj/anaconda3/envs/waffle/lib/python3.9/site-packages/ultralytics/yolo/utils/tal.py:251: TracerWarning: Iterating over a tensor might cause the trace to be incorrect. Passing a tensor of different shape won't change the number of iterations executed (and might lead to errors or silently give incorrect results). for i, stride in enumerate(strides): /home/lhj/anaconda3/envs/waffle/lib/python3.9/site-packages/torch/onnx/utils.py:617: UserWarning: ONNX Preprocess - Removing mutation from node aten::sub_ on block input: 'tensor.1'. This changes graph semantics. (Triggered internally at ../torch/csrc/jit/passes/onnx/remove_inplace_ops_for_onnx.cpp:335.) _C._jit_pass_onnx_remove_inplace_ops_for_onnx(graph, module)
Out[2]:
ExportResult(export_file=PosixPath('hubs/detector/weights/model.onnx'))
In [ ]:
Copied!