Skip to content

spacewalk01/yolov11-tensorrt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

YOLOv11-TensorRT

python cuda trt mit

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.txt file.

3. Build the C++ Code

mkdir build && cd build
cmake ..
cmake --build . --config Release

Usage

Exporting the Model

  1. Modify the export.py script if needed to set the desired model name.

  2. 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.