This sample contains code that performs TensorRT inference on Jetson.
- Download ONNX Ultra-Fast-Lane-Detection Model from PINTO_model_zoo.
- Convert ONNX Model to Serialize engine and inference on Jetson.
- PINTO0309/PINTO_model_zoo
- cfzd/Ultra-Fast-Lane-Detection
- ibaiGorordo/onnx-Ultra-Fast-Lane-Detection-Inference
pip3 install -U scipy
Clone PINTO_model_zoo repository and download Ultra-Fast-Lane-Detection model.
git clone https://github.com/PINTO0309/PINTO_model_zoo.git
cd PINTO_model_zoo/140_Ultra-Fast-Lane-Detection/
./download.sh
Check trtexec
/usr/src/tensorrt/bin/trtexec --onnx=./saved_model_culane/ultra_falst_lane_detection_culane_288x800.onnx
or
/usr/src/tensorrt/bin/trtexec --onnx=./saved_model_tusimple/ultra_falst_lane_detection_tusimple_288x800.onnx
Copy ultra_falst_lane_detection_culane_288x800.onnx
or ultra_falst_lane_detection_tusimple_288x800.onnx
to tensorrt-examples/models
.
In the following, culane
is taken as an example.
cp ~/PINTO_model_zoo/140_Ultra-Fast-Lane-Detection/saved_model_culane/ultra_falst_lane_detection_culane_288x800.onnx ~/tensorrt-examples/models/
Convert to Serialize engine file.
If you want to convert to FP16 model, add --fp16
to the argument of convert_onnxgs2trt.py
.
cd ~/tensorrt-examples/python/utils
python3 convert_onnxgs2trt.py \
--model /home/jetson/tensorrt-examples/models/ultra_falst_lane_detection_culane_288x800.onnx \
--output /home/jetson/tensorrt-examples/models/ultra_falst_lane_detection_culane_288x800.trt \
Finally you can run the demo.
python3 trt_ultra_fast_lane_detection_capture.py \
--model ../../models/ultra_falst_lane_detection_culane_288x800.trt
--model_config culane
or
python3 trt_ultra_fast_lane_detection_image.py \
--model ../../models/ultra_falst_lane_detection_culane_288x800.trt
--model_config culane
--input input_image.png
--output output_image.png