Yolo Vision Shenzhen
Shenzhen
Únete ahora
Glosario

TensorRT

Optimice los modelos de aprendizaje profundo con TensorRT para una inferencia más rápida y eficiente en las GPU NVIDIA . Consigue rendimiento en tiempo real con YOLO y las aplicaciones de IA.

TensorRT is a high-performance deep learning inference software development kit (SDK) developed by NVIDIA. It is designed to optimize neural network models for deployment, delivering low inference latency and high throughput for deep learning applications. By acting as an optimization compiler, TensorRT takes trained networks from popular frameworks like PyTorch and TensorFlow and restructures them to execute efficiently on NVIDIA GPUs. This capability is crucial for running complex AI models in production environments where speed and efficiency are paramount.

How TensorRT Optimizes Models

The core function of TensorRT is to convert a trained neural network into an optimized "engine" specifically tuned for the target hardware. It achieves this through several advanced techniques:

  • Layer Fusion: The optimizer combines multiple layers of a neural network into a single kernel, reducing memory access overhead and improving execution speed.
  • Precision Calibration: TensorRT supports reduced precision modes, such as mixed precision (FP16) and integer quantization (INT8). By reducing the number of bits used to represent numbers—often with minimal accuracy loss—developers can significantly accelerate math operations and reduce memory usage. This is a form of model quantization.
  • Kernel Auto-Tuning: The software automatically selects the best data layers and algorithms for the specific GPU architecture being used, ensuring maximum utilization of the hardware's parallel processing capabilities via CUDA.

Aplicaciones en el mundo real

Debido a su capacidad para procesar grandes cantidades de datos con un retraso mínimo, TensorRT utiliza ampliamente en sectores que dependen de la visión artificial y de tareas complejas de IA en las que el tiempo es un factor crítico.

  1. Sistemas autónomos: en el ámbito de la IA en la automoción, los coches autónomos deben procesar las imágenes de vídeo de múltiples cámaras para detect , señales y obstáculos al instante. Con TensorRT, los modelos de percepción, como las redes de detección de objetos, pueden analizar fotogramas en milisegundos, lo que permite al sistema de control del vehículo tomar decisiones críticas para la seguridad sin retrasos.
  2. Automatización industrial: Las fábricas modernas utilizan la IA en la fabricación para la inspección óptica automatizada . Las cámaras de alta velocidad capturan imágenes de los productos en las líneas de montaje, y los modelos TensorRT identifican los defectos o anomalías en tiempo real. Esto garantiza que el control de calidad se adapte al ritmo de los entornos de producción de alta velocidad , a menudo mediante la implementación de dispositivos de IA periféricos como la plataforma NVIDIA directamente en la planta de producción.

Uso de TensorRT Ultralytics YOLO

Integrar TensorRT en su flujo de trabajo es sencillo con las herramientas modernas de IA. El sitio ultralytics package provides a seamless method to convert standard PyTorch models into TensorRT engines. This allows users to leverage the state-of-the-art architecture of Ultralytics YOLO26 with the hardware acceleration of NVIDIA GPUs. For teams looking to manage their datasets and training pipelines before export, the Plataforma Ultralytics offers a comprehensive environment to prepare models for such high-performance deployment.

El siguiente ejemplo muestra cómo exportar un modelo YOLO26 a un archivo TensorRT (.engine) y utilizarlo para inferencia en tiempo real:

from ultralytics import YOLO

# Load the latest stable YOLO26 model (nano size)
model = YOLO("yolo26n.pt")

# Export the model to TensorRT format (creates 'yolo26n.engine')
# This step optimizes the computational graph for your specific GPU
model.export(format="engine")

# Load the optimized TensorRT engine for high-speed inference
trt_model = YOLO("yolo26n.engine")

# Run inference on an image source
results = trt_model("https://ultralytics.com/images/bus.jpg")

TensorRT vs. ONNX vs. Training Frameworks

It is important to distinguish TensorRT from other terms often heard in the model deployment landscape:

  • Vs. PyTorch/TensorFlow: Frameworks like PyTorch are primarily designed for model training and research, offering flexibility and ease of debugging. TensorRT is an inference engine designed solely for executing trained models as fast as possible. It is not used for training.
  • Vs. ONNX: The ONNX (Open Neural Network Exchange) format acts as an intermediary bridge between frameworks. While ONNX provides interoperability (e.g., moving a model from PyTorch to another platform), TensorRT focuses on hardware-specific optimization. Often, a model is converted to ONNX first, and then parsed by TensorRT to generate the final engine.

For developers aiming to maximize the performance of their AI agents or vision systems, understanding the transition from a training framework to an optimized runtime like TensorRT is a key step in professional MLOps.

Únase a la comunidad Ultralytics

Únete al futuro de la IA. Conecta, colabora y crece con innovadores de todo el mundo

Únete ahora