Make sure you first follow the instructions here (Lseg section): https://github.com/Lab-of-AI-and-Robotics/Pixel_aligned_VLM
- Make sure you have downloaded "demo_e200.ckpt" file.
- To load model only
python hw_clip/CLIP_resnet_test.py
- To make onnx file
python hw_clip/CLIP_resnet_test.py --make_onnx_file
- To measure execution time
python hw_clip/CLIP_resnet_test.py --measure_time
- To do both
python hw_clip/CLIP_resnet_test.py --make_onnx_file --measure_time
Execution time: 4.363ms
- To load model only
python Pixel_aligned_VLM/Lseg/Lseg_resnet_test.py
- To make onnx file
python Pixel_aligned_VLM/Lseg/Lseg_resnet_test.py --make_onnx_file
- To measure execution time
python Pixel_aligned_VLM/Lseg/Lseg_resnet_test.py --measure_time
- To do both
python Pixel_aligned_VLM/Lseg/Lseg_resnet_test.py --make_onnx_file --measure_time
Execution time: 22.162ms
- Give permission to sh file
chmod +x hw_clip/cpp_ver/engine_files/convert_onnx_to_trt.sh
- Convert CLIP model from onnx to trt
hw_clip/cpp_ver/engine_files/convert_onnx_to_trt.sh hw_clip/cpp_ver/engine_files/clip_visual_component.onnx hw_clip/cpp_ver/engine_files/clip_visual_component.trt
- Convert Lseg model from onnx to trt
hw_clip/cpp_ver/engine_files/convert_onnx_to_trt.sh hw_clip/cpp_ver/engine_files/lseg_resnet.onnx hw_clip/cpp_ver/engine_files/lseg_resnet.trt
After you make trt files, you can test trt models
Make sure you have "clip_visual_component.trt" in engine_files folder.
hw_clip/cpp_ver/build/./trt_model_test hw_clip/cpp_ver/engine_files/clip_visual_component.trt
Execution time: 1.931ms
Make sure you have "lseg_resnet.trt" in engine_files folder.
hw_clip/cpp_ver/build/./trt_model_test hw_clip/cpp_ver/engine_files/lseg_resnet.trt
Execution time: 15.457ms
| Model | Pytorch Execution Time | TRT Execution Time |
|---|---|---|
| CLIP | 4.363 ms | 1.931 ms |
| Lseg (Resnet) | 22.162 ms | 15.457 ms |