Yolo Tầm nhìn Thâm Quyến
Thâm Quyến
Tham gia ngay
Bảng chú giải thuật ngữ

Lượng Tử Hóa Mô Hình

Tối ưu hóa hiệu suất AI bằng lượng tử hóa mô hình. Giảm kích thước, tăng tốc độ và cải thiện hiệu quả năng lượng cho các triển khai thực tế.

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.

So sánh với các khái niệm liên quan

Điều quan trọng là phải phân biệt lượng tử hóa với các kỹ thuật tối ưu hóa khác, vì chúng thay đổi mô hình theo những cách khác nhau:

  • 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.
  • Lượng tử hóa so với chưng cất tri thức: Chưng cất tri thức là một kỹ thuật huấn luyện trong đó một mô hình "học sinh" nhỏ học cách bắt chước một mô hình "giáo viên" lớn. Lượng tử hóa thường được áp dụng cho mô hình học sinh sau khi chưng cất để nâng cao hơn nữa hiệu suất của AI biên .

Các Ứng dụng Thực tế

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. Nông nghiệp thông minh: Máy bay không người lái được trang bị camera đa phổ sử dụng các mô hình phát hiện đối tượng lượng tử hóa để xác định bệnh cây trồng hoặc theo dõi các giai đoạn sinh trưởng. Việc chạy các mô hình này cục bộ trên hệ thống nhúng của máy bay không người lái giúp loại bỏ nhu cầu về kết nối di động không ổn định ở các vùng xa xôi.

Thực hiện lượng tử hóa với 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")

Các mô hình được tối ưu hóa thường được triển khai bằng cách sử dụng các tiêu chuẩn tương tác như ONNX hoặc các công cụ suy luận hiệu năng cao như OpenVINO , đảm bảo khả năng tương thích rộng rãi trên các hệ sinh thái phần cứng đa dạng.

Tham gia Ultralytics cộng đồng

Tham gia vào tương lai của AI. Kết nối, hợp tác và phát triển cùng với những nhà đổi mới toàn cầu

Tham gia ngay