Run yolov5 segmentation model on onnxruntime or opencv dnn without torch!
All you need is on segment.py
, it provides cli to run yolov5-seg onnx model.
python segment.py -- help
python segment.py -m <YOLOV5-SEG-ONNX-PATH> -i <IMAGE-PATH>
python segment.py -m <YOLOV5-SEG-ONNX-PATH> -v 0 # webcam
<VIDEO-PATH> # local video
Note : Press q
to stop video processing.
Use Opencv DNN as backend with --dnn
arguments.
python segment.py -m <YOLOV5-SEG-ONNX-PATH> -v 0 --dnn
Auto using gpu to run model when devices is supported.
-
onnxruntime
needonnxruntime-gpu
to be installed.Note :
onnxruntime-gpu
must be installed with the same version asonnxruntime
to be able to use GPU. -
opencv-dnn
need custom build.
pip install onnxruntime-gpu==<YOUR-ONNXRUNTIME-VERSION>