Here i have modified the object detection file to run only on ONNX weights kindly refer to the main yolo v5 git given below for other weight file usage.
yolo v5 git : https://github.com/ultralytics/yolov5.git
Given export.py will convert the yolov5s.pt weight to yolov5s.onnx weight.