The function using in Scaled-YOLOv4, please refer to Scaled-YOLOv4 repository.
Before start, the export script requires onnxsim
, you need to install it first :
$ pip install -q onnx-simplifier
the export script should existing in ./ScaledYOLOv4/models/
, then start export onnx
:
$ export PYTHONPATH="$PWD" && python models/export-onnx.py \
--weights './runs/exp0_yolov4-csp-results/weights/best_yolov4-csp-results.pt'
You should see output like this:
Namespace(batch_size=1, img_size=[896, 896], weights='./runs/exp0_yolov4-csp-results/weights/best_yolov4-csp-results.pt')
Fusing layers... Model Summary: 235 layers, 5.28044e+07 parameters, 5.04494e+07 gradients
Starting ONNX export with onnx 1.8.1...
ONNX export success, saved as ./runs/exp0_yolov4-csp-results/weights/best_yolov4-csp-results.onnx
Export complete. Visualize with https://github.com/lutzroeder/netron.