Yolo Vision Shenzhen
Shenzhen
Junte-se agora
Glossário

Quantização de Modelo

Otimize o desempenho da IA com a quantização de modelo. Reduza o tamanho, aumente a velocidade e melhore a eficiência energética para implementações no mundo real.

Model quantization is a sophisticated model optimization technique used to reduce the computational and memory costs of running deep learning models. In standard training workflows, neural networks typically store parameters (weights and biases) and activation maps using 32-bit floating-point numbers (FP32). While this high precision ensures accurate calculations during training, it is often unnecessary for inference. Quantization converts these values into lower-precision formats, such as 16-bit floating-point (FP16) or 8-bit integers (INT8), effectively shrinking the model size and accelerating execution speed without significantly compromising accuracy.

Why Quantization Matters

The primary driver for quantization is the need to deploy powerful AI on resource-constrained hardware. As computer vision models like YOLO26 become more complex, their computational demands increase. Quantization addresses three critical bottlenecks:

  • Memory Footprint: By reducing the bit-width of weights (e.g., from 32-bit to 8-bit), the model's storage requirement is reduced by up to 4x. This is vital for mobile apps where application size is restricted.
  • Inference Latency: Lower precision operations are computationally cheaper. Modern processors, especially those with specialized neural processing units (NPUs), can execute INT8 operations much faster than FP32, significantly reducing inference latency.
  • Power Consumption: Moving less data through memory and performing simpler arithmetic operations consumes less energy, extending battery life in portable devices and autonomous vehicles.

Comparação com Conceitos Relacionados

É importante diferenciar a quantização de outras técnicas de otimização, pois elas modificam o modelo de maneiras distintas :

  • Quantization vs. Pruning: While quantization reduces the file size by lowering the bit-width of parameters, model pruning involves removing unnecessary connections (weights) entirely to create a sparse network. Pruning alters the model's structure, whereas quantization alters the data representation.
  • Quantização vs. Destilação de conhecimento: A destilação de conhecimento é uma técnica de treino em que um pequeno modelo «aluno» aprende a imitar um grande modelo «professor». A quantização é frequentemente aplicada ao modelo aluno após a destilação para melhorar ainda mais o desempenho da IA de ponta.

Aplicações no Mundo Real

Quantization enables computer vision and AI across various industries where efficiency is paramount.

  1. Autonomous Systems: In the automotive industry, self-driving cars must process visual data from cameras and LiDAR in real-time. Quantized models deployed on NVIDIA TensorRT engines allow these vehicles to detect pedestrians and obstacles with millisecond latency, ensuring passenger safety.
  2. Agricultura inteligente: Drones equipados com câmaras multiespectrais utilizam modelos quantizados de deteção de objetos para identificar doenças nas culturas ou monitorizar as fases de crescimento. A execução destes modelos localmente nos sistemas incorporados dos drones elimina a necessidade de ligações móveis pouco fiáveis em campos remotos.

Implementar a quantização com Ultralytics

The Ultralytics library simplifies the export process, allowing developers to convert models like the cutting-edge YOLO26 into quantized formats. The Ultralytics Platform also provides tools to manage these deployments seamlessly.

The following example demonstrates how to export a model to TFLite with INT8 quantization enabled. This process involves a calibration step where the model observes sample data to determine the optimal dynamic range for the quantized values.

from ultralytics import YOLO

# Load a standard YOLO26 model
model = YOLO("yolo26n.pt")

# Export to TFLite format with INT8 quantization
# The 'int8' argument triggers Post-Training Quantization
# 'data' provides the calibration dataset needed for mapping values
model.export(format="tflite", int8=True, data="coco8.yaml")

Os modelos otimizados são frequentemente implementados utilizando padrões interoperáveis, como ONNX ou motores de inferência de alto desempenho, como o OpenVINO, garantindo ampla compatibilidade entre diversos ecossistemas de hardware.

Junte-se à comunidade Ultralytics

Junte-se ao futuro da IA. Conecte-se, colabore e cresça com inovadores globais

Junte-se agora