This repository hosts a C++ implementation of the state-of-the-art YOLOv11 object detection model from ultralytics, leveraging the TensorRT API for efficient, real-time inference.
git clone https://github.com/spacewalk01/yolov11-tensorrt.git
cd yolov11-tensorrt
-
For Python: Install required Python dependencies using pip:
pip install --upgrade ultralytics
-
For C++: Ensure that OpenCV and TensorRT are installed. Set the correct paths for these libraries in the
CMakeLists.txt
file.
mkdir build && cd build
cmake ..
cmake --build . --config Release
-
Modify the
export.py
script if needed to set the desired model name. -
Run the Python script to export the YOLOv11 model to ONNX format:
python export.py
Convert the ONNX model to a TensorRT engine:
./yolov11-tensorrt.exe yolo11s.onnx ""
Perform object detection on an image:
./yolov11-tensorrt.exe yolo11s.engine "zidane.jpg"
Perform object detection on a video:
./yolov11-tensorrt.exe yolo11s.engine "road.mp4"
This project is licensed under the AGPL-3.0 License. See the LICENSE file for details.