# Phát hiện đối tượng

Trước khi chạy pipeline cho một mô hình, hãy tuân thủ các [Điều kiện tiên quyết](https://docs.qualcomm.com/doc/80-70018-15BV/topic/ai-hub-qualcomm-im-sdk.html#prerequisites) bắt buộc.

Chạy lệnh sau để đảm bảo kết quả hiển thị trên màn hình được kết nối.

export XDG_RUNTIME_DIR=/dev/socket/weston && export WAYLAND_DISPLAY=wayland-1
    Copy to clipboard

## Yolo-V7 Quantized

YoloV7 là một mô hình học máy có khả năng dự đoán các bounding box và class của đối tượng trong ảnh.

Mô hình này được lượng tử hóa sau huấn luyện thành int8 bằng cách dùng các mẫu từ COCO dataset.

Mô hình AI Hub dựa trên [cách triển khai Yolo-v7-Quantized này](https://github.com/WongKinYiu/yolov7/).

- Mô hình: [Yolo-v7-Quantized.tflite](https://aihub.qualcomm.com/iot/models/yolov7_quantized)
- Nhãn: [coco_labels.txt](https://github.com/quic/ai-hub-models/blob/main/qai_hub_models/labels/coco_labels.txt)

gst-launch-1.0 -e --gst-debug=2 \
    filesrc location=/etc/media/video.mp4 ! qtdemux ! queue ! h264parse ! v4l2h264dec capture-io-mode=4 output-io-mode=4 ! video/x-raw,format=NV12 ! queue ! tee name=split \
    split. ! queue ! qtivcomposer name=mixer ! queue ! waylandsink fullscreen=true \
    split. ! queue ! qtimlvconverter ! queue ! qtimltflite delegate=external external-delegate-path=libQnnTFLiteDelegate.so \
    external-delegate-options="QNNExternalDelegate,backend_type=htp;" model=/etc/models/Yolo-v7-Quantized.tflite ! queue ! \
    qtimlvdetection threshold=50.0 results=10 module=yolov8 labels=/etc/labels/coco_labels.txt constants="YOLOv7,q-offsets=<35.0, 0.0, 0.0>,q-scales=<3.4220554, 0.0023370725102722645, 1.0>;" ! \
    video/x-raw,format=BGRA,width=640,height=360 ! queue ! mixer.
    Copy to clipboard

## Yolov8-Detection-Quantized

Ultralytics Yolov8 là một mô hình học máy có khả năng dự đoán các bounding box và class của đối tượng trong ảnh.

Mô hình này được lượng tử hóa sau huấn luyện thành int8 bằng cách dùng các mẫu từ COCO dataset.

Mô hình AI Hub dựa trên [cách triển khai YOLOv8-Detection-Quantized này](https://github.com/ultralytics/ultralytics/tree/main/ultralytics/models/yolo/detect).

- Mô hình: [YOLOv8-Detection-Quantized.tflite](https://aihub.qualcomm.com/iot/models/yolov8_det_quantized)
- Nhãn: [coco_labels.txt](https://github.com/quic/ai-hub-models/blob/main/qai_hub_models/labels/coco_labels.txt)

gst-launch-1.0 -e --gst-debug=2 \
    filesrc location=/etc/media/video.mp4 ! qtdemux ! queue ! h264parse ! v4l2h264dec capture-io-mode=4 output-io-mode=4 ! video/x-raw,format=NV12 ! queue ! tee name=split \
    split. ! queue ! qtivcomposer name=mixer ! queue ! waylandsink fullscreen=true \
    split. ! queue ! qtimlvconverter ! queue ! qtimltflite delegate=external external-delegate-path=libQnnTFLiteDelegate.so \
    external-delegate-options="QNNExternalDelegate,backend_type=htp,htp_device_id=(string)0,htp_performance_mode=(string)2,htp_precision=(string)1;" model=/etc/models/YOLOv8-Detection-Quantized.tflite ! queue ! \
    qtimlvdetection threshold=50.0 results=10 module=yolov8 labels=/etc/labels/coco_labels.txt constants="YOLOv8,q-offsets=<21.0, 0.0, 0.0>,q-scales=<3.093529462814331, 0.00390625, 1.0>;" ! \
    video/x-raw,format=BGRA,width=640,height=360 ! queue ! mixer.
    Copy to clipboard

Ghi chú

Thêm `htp_device_id=(string)0,htp_performance_mode=(string)2,htp_precision=(string)1` vào `external-delegate-options` trong lệnh bên trên để mô hình chạy trong chế độ Hiệu suất cao trên HTP.

Bạn có thể bật chế độ Hiệu suất cao cho mọi pipeline khác theo cách này.

## Yolo-nas-Quantized

YoloNAS là một mô hình học máy có khả năng dự đoán các bounding box và class của đối tượng trong ảnh.

Mô hình này được lượng tử hóa sau huấn luyện thành int8 bằng cách dùng các mẫu từ COCO dataset.

Mô hình AI Hub dựa trên [cách triển khai Yolo-nas-Quantized này](https://github.com/Deci-AI/super-gradients).

- Mô hình: [Yolo-NAS-Quantized.tflite](https://aihub.qualcomm.com/iot/models/yolonas_quantized)
- Nhãn: [coco_labels.txt](https://github.com/quic/ai-hub-models/blob/main/qai_hub_models/labels/coco_labels.txt)

gst-launch-1.0 -e --gst-debug=2 \
    filesrc location=/etc/media/video.mp4 ! qtdemux ! queue ! h264parse ! v4l2h264dec capture-io-mode=4 output-io-mode=4 ! video/x-raw,format=NV12 ! queue ! tee name=split \
    split. ! queue ! qtivcomposer name=mixer ! queue ! waylandsink fullscreen=true \
    split. ! queue ! qtimlvconverter ! queue ! qtimltflite delegate=external external-delegate-path=libQnnTFLiteDelegate.so \
    external-delegate-options="QNNExternalDelegate,backend_type=htp;" model=/etc/models/Yolo-NAS-Quantized.tflite ! queue ! \
    qtimlvdetection threshold=50.0 results=10 module=yolov8 labels=/etc/labels/coco_labels.txt constants="yolo-nas,q-offsets=<37.0,0.0, 0.0>,q-scales=<3.416602611541748, 0.00390625, 1.0>;" ! \
    video/x-raw,format=BGRA,width=640,height=360 ! queue ! mixer.
    Copy to clipboard

Last Published: Oct 22, 2025

[Previous Topic
Phân loại hình ảnh](https://docs.qualcomm.com/bundle/publicresource/80-70018-15BV/topics/image-classification.md) [Next Topic
Áp dụng semantic segmentation cho khung hình của video](https://docs.qualcomm.com/bundle/publicresource/80-70018-15BV/topics/semantic-segmentation.md)