- using yolov5 export file,
python3 export.py --weights yolov5m_shear.pt --include onnx --data coco128.yaml --device 0 --batch-size 4
- Convert batch parameter to 'b' using models/dynmic.py.
- use following trtexec command for conversion (change the input resolution and batch size accordigly)
trtexec --onnx=dynamic.onnx --fp16 --minShapes=images:1x3x640x640 --optShapes=images:4x3x640x640 --maxShapes=images:8x3x640x640 --useCudaGraph --saveEngine= < output name >_dynamic.engine
- using yolov5 export file,
python3 export.py --weights yolov5m_shear.pt --include onnx --data coco128.yaml --device 0
trtexec --onnx=yolov5m.onnx --fp16 --saveEngine=yolov5m_static.engine --useCudaGraph
For batch inference,
- Alaways use a dynamic engine file.
- In config.py
- Make the TensorRT.batch
True
- Set the correct batch size of the converted engine file in TensorRT.batch_size
- Make the TensorRT.batch
- Make shure the camera fps is set to a divisible value of the batch_size.