# 偵測物件

在執行模型的管線命令前，請完成必要的 [前置條件](https://docs.qualcomm.com/doc/80-70020-15BT/topic/ai-hub-qualcomm-im-sdk.html#prerequisites)。

執行以下命令以確保您的結果顯示在連接的顯示器上。

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

## Yolo-V7

YoloV7 是一個機器學習模型，用於預測影像中物體的邊界框和類別。

此模型在訓練後使用 COCO 資料集中的樣本量化為 int8。

AI Hub 模型以 [此 Yolo-v7 實作](https://github.com/WongKinYiu/yolov7/) 為基礎。

- 模型： [yolov7](https://github.com/quic/ai-hub-models/tree/main/qai_hub_models/models/yolov7)
- 標籤： [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

Ultralytics Yolov8 是一個機器學習模型，用於預測影像中物體的邊界框和類別。

此模型在訓練後使用 COCO 資料集中的樣本量化為 int8。

AI Hub 模型是以 [此 YOLOv8-Detection-Quantized](https://github.com/ultralytics/ultralytics/tree/main/ultralytics/models/yolo/detect) 的實作構建。

- 模型： [YOLOv8-Detection](https://github.com/quic/ai-hub-models/tree/main/qai_hub_models/models/yolov8_det)
- 標籤： [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

備註

在上述命令中將 `htp_device_id=(string)0,htp_performance_mode=(string)2,htp_precision=(string)1` 添加到 `external-delegate-options` 中，允許模型在 HTP 上以高性能模式運行。

可以以相同方式為所有其他管道啟用高效能模式。

Last Published: Dec 23, 2025

[Previous Topic
分類影像](https://docs.qualcomm.com/bundle/publicresource/80-70020-15BT/topics/image-classification.md) [Next Topic
套用語義分割至視訊畫面](https://docs.qualcomm.com/bundle/publicresource/80-70020-15BT/topics/semantic-segmentation.md)