Skip to content

tensorworksio/TensorRT-Vision

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

89 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TensorRT-Vision

A TensorRT Toolbox for Optimized Vision Model Inference

python cuda trt

📋 Overview

TensorRT-Vision provides optimized inference for computer vision models using NVIDIA TensorRT. It supports:

  • Object Detection
  • Object Segmentation
  • Object Classification
  • Object Re-Identification
  • Multi Object Tracking

⚙️ Prerequisites

There is no single fixed CUDA/TensorRT requirement — the right stack depends on your GPU driver. Run nvidia-smi and read the CUDA Version in the top-right: that is the highest CUDA your driver supports. Pick a CUDA + TensorRT combination at or below it.

🖥️ Local

  1. Python 3.12
  2. A CUDA Toolkit supported by your GPU driver
  3. The matching TensorRT release for that CUDA version

Follow installation instructions here

🐳 Docker

Install the NVIDIA Container Toolkit so containers can access the GPU. The CUDA + TensorRT stack is then fully determined by the NGC base image tag chosen at build time — see Selecting your CUDA + TRT version. Nothing else to install on the host.

🖥️ Local Build

# Build all apps (default)
meson setup build
meson compile -C build

# Or build specific apps
meson setup build -Dbuild_apps=detector,mot
meson compile -C build

# Make sure trtexec is available for model conversion
alias trtexec='/usr/src/tensorrt/bin/trtexec'

🐳 Docker Build

All images are built from the single root Dockerfile using --target.

Selecting your CUDA + TRT version

The default base image (nvcr.io/nvidia/tensorrt:25.01-py3) ships CUDA 12.6 + TRT 10.7 and runs on any GPU whose host driver reports CUDA ≥ 12.6 (nvidia-smi shows this). The same image backs both the build and runtime stages, so a single --build-arg switches versions:

# Check available TRT tags at https://catalog.ngc.nvidia.com/orgs/nvidia/containers/tensorrt
docker build \
  --build-arg TRT_IMAGE=nvcr.io/nvidia/tensorrt:24.09-py3 \
  --target detector -t tensorrt-vision:detector .

Build an app image

docker build --target <app> -t tensorrt-vision:<app> .

Replace <app> with: detector, segmenter, classifier, reid, or mot.

Export ONNX models

App images bake in a model-export virtualenv (ultralytics/torch, onnx) alongside trtexec, so models can be exported to ONNX and converted to TRT engines entirely inside the container — no host Python and no per-export installs. Mount the data/ directory so the generated engine persists on the host. See each app's README for the exact command.

🚀 Quick Start

Each app has its own README with detailed local and Docker instructions:

🙏 Credits

This project builds upon foundations from: