How hamdiboukamcha/yolo-v11-cpp-tensorrt works
Main Components
• Build & Configuration: The CMakeLists.txt at the root sets up the project, with dependencies to TensorRT, OpenCV, and CUDA.
• Core Application Logic:
• main.cpp acts as the main entry point.
• src/YOLOv11.cpp implements the object detection logic.
• src/preprocess.cu handles CUDA-based preprocessing.
• Header Files: The include/ directory contains the API declarations (including YOLOv11, CUDA utility functions, logging, preprocessing, etc.).
• Assets: The asset directory (along with images/videos) provides benchmark visuals and sample outputs.
• External Dependencies: TensorRT, CUDA Toolkit, and OpenCV are key technologies that power the performance and efficiency of the system.
Relationships and Interactions
• The main application (main.cpp) coordinates the overall workflow. It likely initializes the environment, loads the TensorRT engine, processes input (image/video), and routes data to the YOLOv11 implementation.
• The YOLOv11 component (in YOLOv11.cpp) encapsulates the object detection logic using a TensorRT engine which was built from an ONNX model.
• CUDA preprocessing (in preprocess.cu) prepares and optimizes images/videos for inference.
Architectural Patterns
• The design uses a modular approach where the preprocessing, inference, and conversion are separated into different components.
• A clear separation of concerns is evident between the interface (headers in include/) and the implementation (code in src/), as well as between CPU-side logic (C++) and GPU-accelerated tasks (CUDA).
• The project leverages dependency injection via CMake, ensuring that external libraries (TensorRT, CUDA, OpenCV) are correctly linked.