yolov11-tensorrt
yolov11-tensorrt copied to clipboard
C++ implementation of YOLOv11 using TensorRT API
YOLOv11-TensorRT
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.
Installation
1. Clone the Repository
git clone https://github.com/spacewalk01/yolov11-tensorrt.git
cd yolov11-tensorrt
2. Install Dependencies
-
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.txtfile.
3. Build the C++ Code
mkdir build && cd build
cmake ..
cmake --build . --config Release
Usage
Exporting the Model
-
Modify the
export.pyscript if needed to set the desired model name. -
Run the Python script to export the YOLOv11 model to ONNX format:
python export.py
Running Inference
1. Create a TensorRT Engine
Convert the ONNX model to a TensorRT engine:
./yolov11-tensorrt.exe yolo11s.onnx ""
2. Run Inference on an Image
Perform object detection on an image:
./yolov11-tensorrt.exe yolo11s.engine "zidane.jpg"
3. Run Inference on a Video
Perform object detection on a video:
./yolov11-tensorrt.exe yolo11s.engine "road.mp4"
License
This project is licensed under the AGPL-3.0 License. See the LICENSE file for details.