Example scripts for the detection of lanes using the ultra fast lane detection v2 model in ONNX/TensorRT.
Example scripts for the detection of objects using the YOLOv5/YOLOv5-lite/YOLOv6/YOLOv7/YOLOv8/YOLOv9/YOLOv10/EfficientDet model in ONNX/TensorRT.
Add ByteTrack to determine the driving direction of ID vehicles and perform trajectory tracking.
-
Python 3.7+
-
OpenCV, Scikit-learn, onnxruntime, pycuda and pytorch.
-
Install :
The
requirements.txtfile should list all Python libraries that your notebooks depend on, and they will be installed using:pip install -r requirements.txt
-
Download YOLO Series Onnx model :
Use the Google Colab notebook to convert
Model release version Link YOLOv5 v6.2YOLOv6/Lite 0.4.0YOLOv7 v0.1YOLOv8 8.1.27YOLOv9 v0.1YOLOv10 8.2.41 -
Convert Onnx to TenserRT model :
Need to modify
onnx_model_pathandtrt_model_pathbefore converting.python convertOnnxToTensorRT.py -i <path-of-your-onnx-model> -o <path-of-your-trt-model> -
Quantize ONNX models :
Converting a model to use float16 instead of float32 can decrease the model size.
python onnxQuantization.py -i <path-of-your-onnx-model> -
Video Inference :
- Setting Config :
Note : can support onnx/tensorRT format model. But it needs to match the same model type.
lane_config = { "model_path": "./TrafficLaneDetector/models/culane_res18.trt", "model_type" : LaneModelType.UFLDV2_CULANE } object_config = { "model_path": './ObjectDetector/models/yolov8l-coco.trt', "model_type" : ObjectModelType.YOLOV8, "classes_path" : './ObjectDetector/models/coco_label.txt', "box_score" : 0.4, "box_nms_iou" : 0.45 }
Target Model Type Describe Lanes LaneModelType.UFLD_TUSIMPLESupport Tusimple data with ResNet18 backbone. Lanes LaneModelType.UFLD_CULANESupport CULane data with ResNet18 backbone. Lanes LaneModelType.UFLDV2_TUSIMPLESupport Tusimple data with ResNet18/34 backbone. Lanes LaneModelType.UFLDV2_CULANESupport CULane data with ResNet18/34 backbone. Object ObjectModelType.YOLOV5Support yolov5n/s/m/l/x model. Object ObjectModelType.YOLOV5_LITESupport yolov5lite-e/s/c/g model. Object ObjectModelType.YOLOV6Support yolov6n/s/m/l, yolov6lite-s/m/l model. Object ObjectModelType.YOLOV7Support yolov7 tiny/x/w/e/d model. Object ObjectModelType.YOLOV8Support yolov8n/s/m/l/x model. Object ObjectModelType.YOLOV9Support yolov9t/s/m/c/e model. Object ObjectModelType.YOLOV10Support yolov10n/s/m/b/l/x model. Object ObjectModelType.EfficientDetSupport efficientDet b0/b1/b2/b3 model. - Run :
python demo.py - Setting Config :
-
Display
-
Front Collision Warning System (FCWS)
-
Lane Departure Warning System (LDWS)
-
Lane Keeping Assist System (LKAS)
GPLv3 License key requirements :
- Disclose Source
- License and Copyright Notice
- Same License
- State Changes



