İçeriğe geç

Ultralytics YOLO11 on NVIDIA Jetson using DeepStream SDK and TensorRT



İzle: How to Run Multiple Streams with DeepStream SDK on Jetson Nano using Ultralytics YOLO11

This comprehensive guide provides a detailed walkthrough for deploying Ultralytics YOLO11 on NVIDIA Jetson devices using DeepStream SDK and TensorRT. Here we use TensorRT to maximize the inference performance on the Jetson platform.

DeepStream NVIDIA Jetson'da

Not

Bu kılavuz, JP5.1.3 JetPack sürümünü çalıştıran NVIDIA Jetson Orin NX 16GB tabanlı Seeed Studio reComputer J4012 ve JP4.6.4 JetPack sürümünü çalıştıran NVIDIA Jetson Nano 4GB tabanlı Seeed Studio reComputer J1020 v2 ile test edilmiştir. En yeni ve eski dahil olmak üzere tüm NVIDIA Jetson donanım serisinde çalışması beklenmektedir.

NVIDIA DeepStream nedir?

NVIDIA's DeepStream SDK is a complete streaming analytics toolkit based on GStreamer for AI-based multi-sensor processing, video, audio, and image understanding. It's ideal for vision AI developers, software partners, startups, and OEMs building IVA (Intelligent Video Analytics) apps and services. You can now create stream-processing pipelines that incorporate neural networks and other complex processing tasks like tracking, video encoding/decoding, and video rendering. These pipelines enable real-time analytics on video, image, and sensor data. DeepStream's multi-platform support gives you a faster, easier way to develop vision AI applications and services on-premise, at the edge, and in the cloud.

Ön Koşullar

Bu kılavuzu izlemeye başlamadan önce:

İpucu

Bu kılavuzda DeepStream SDK'yı Jetson cihazına yüklemek için Debian paket yöntemini kullandık. DeepStream'in eski sürümlerine erişmek için DeepStream SDK on Jetson (Archived) sayfasını da ziyaret edebilirsiniz.

DeepStream Configuration for YOLO11

Burada, YOLO modelleri için NVIDIA DeepStream SDK desteğini içeren marcoslucianops/DeepStream-Yolo GitHub deposunu kullanıyoruz. Katkıları için marcoslucianops'un çabalarını takdir ediyoruz!

  1. Yükleme bağımlılıkları

    pip install cmake
    pip install onnxsim
    
  2. Aşağıdaki depoyu kopyalayın

    git clone https://github.com/marcoslucianops/DeepStream-Yolo
    cd DeepStream-Yolo
    
  3. Download Ultralytics YOLO11 detection model (.pt) of your choice from YOLO11 releases. Here we use yolov8s.pt.

    wget https://github.com/ultralytics/assets/releases/download/v8.2.0/yolov8s.pt
    

    Not

    You can also use a custom trained YOLO11 model.

  4. Modeli şuna dönüştür ONNX

    python3 utils/export_yoloV8.py -w yolov8s.pt
    

    Aşağıdaki bağımsız değişkenleri yukarıdaki komuta iletin

    DeepStream 6.0.1 için opset 12 veya daha düşük bir sürümü kullanın. Varsayılan işlem kümesi 16'dır.

    --opset 12
    

    Çıkarım boyutunu değiştirmek için (varsayılan: 640)

    -s SIZE
    --size SIZE
    -s HEIGHT WIDTH
    --size HEIGHT WIDTH
    

    1280 için örnek:

    -s 1280
    or
    -s 1280 1280
    

    Basitleştirmek için ONNX modeli (DeepStream >= 6.0)

    --simplify
    

    Dinamik toplu iş boyutu kullanmak için (DeepStream >= 6.1)

    --dynamic
    

    Statik toplu iş boyutu kullanmak için (toplu iş boyutu = 4 için örnek)

    --batch 4
    
  5. CUDA sürümünü kurulu JetPack sürümüne göre ayarlayın

    JetPack 4.6.4 için:

    export CUDA_VER=10.2
    

    JetPack 5.1.3 için:

    export CUDA_VER=11.4
    
  6. Kitaplığı derleyin

    make -C nvdsinfer_custom_impl_Yolo clean && make -C nvdsinfer_custom_impl_Yolo
    
  7. Düzenleyin config_infer_primary_yoloV8.txt modelinize göre dosya ( YOLOv8s 80 sınıflı)

    [property]
    ...
    onnx-file=yolov8s.onnx
    ...
    num-detected-classes=80
    ...
    
  8. Düzenleyin deepstream_app_config dosya

    ...
    [primary-gie]
    ...
    config-file=config_infer_primary_yoloV8.txt
    
  9. Video kaynağını şuradan da değiştirebilirsiniz: deepstream_app_config dosya. Burada varsayılan bir video dosyası yüklenir

    ...
    [source0]
    ...
    uri=file:///opt/nvidia/deepstream/deepstream/samples/streams/sample_1080p_h264.mp4
    

Çıkarımı Çalıştır

deepstream-app -c deepstream_app_config.txt

Not

Oluşturmak uzun zaman alacak TensorRT Çıkarıma başlamadan önce motor dosyası. Bu yüzden lütfen sabırlı olun.

YOLO11 with deepstream

İpucu

If you want to convert the model to FP16 precision, simply set model-engine-file=model_b1_gpu0_fp16.engine ve network-mode=2 içinde config_infer_primary_yoloV8.txt

INT8 Kalibrasyonu

Çıkarım için INT8 hassasiyetini kullanmak istiyorsanız, aşağıdaki adımları izlemeniz gerekir

  1. Ayarlamak OPENCV ortam değişkeni

    export OPENCV=1
    
  2. Kitaplığı derleyin

    make -C nvdsinfer_custom_impl_Yolo clean && make -C nvdsinfer_custom_impl_Yolo
    
  3. COCO veri kümesi için val2017'ye gidin, çıkarın ve DeepStream-Yolo klasör

  4. Kalibrasyon görüntüleri için yeni bir dizin oluşturun

    mkdir calibration
    
  5. Kalibrasyonu çalıştırmak üzere COCO veri kümesinden 1000 rastgele görüntü seçmek için aşağıdakileri çalıştırın

    for jpg in $(ls -1 val2017/*.jpg | sort -R | head -1000); do \
        cp ${jpg} calibration/; \
    done
    

    Not

    NVIDIA recommends at least 500 images to get a good accuracy. On this example, 1000 images are chosen to get better accuracy (more images = more accuracy). You can set it from head -1000. For example, for 2000 images, head -2000. This process can take a long time.

  6. Oluştur calibration.txt Seçilen tüm görüntüleri içeren dosya

    realpath calibration/*jpg > calibration.txt
    
  7. Ortam değişkenlerini ayarlama

    export INT8_CALIB_IMG_PATH=calibration.txt
    export INT8_CALIB_BATCH_SIZE=1
    

    Not

    Daha yüksek INT8_CALIB_BATCH_SIZE değerleri daha fazla doğruluk ve daha hızlı kalibrasyon hızı ile sonuçlanacaktır. Bunu GPU belleğinize göre ayarlayın.

  8. Güncelle config_infer_primary_yoloV8.txt dosya

    Kimden

    ...
    model-engine-file=model_b1_gpu0_fp32.engine
    #int8-calib-file=calib.table
    ...
    network-mode=0
    ...
    

    için

    ...
    model-engine-file=model_b1_gpu0_int8.engine
    int8-calib-file=calib.table
    ...
    network-mode=1
    ...
    

Çıkarımı Çalıştır

deepstream-app -c deepstream_app_config.txt

MultiStream Kurulumu

Tek bir derin akış uygulaması altında birden fazla akış ayarlamak için, deepstream_app_config.txt dosya

  1. Sahip olmak istediğiniz akış sayısına göre bir ızgara görüntüsü oluşturmak için satırları ve sütunları değiştirin. Örneğin, 4 akış için 2 satır ve 2 sütun ekleyebiliriz.

    [tiled-display]
    rows=2
    columns=2
    
  2. Ayarlamak num-sources=4 ve ekle uri 4 akışın tümünün

    [source0]
    enable=1
    type=3
    uri=<path_to_video>
    uri=<path_to_video>
    uri=<path_to_video>
    uri=<path_to_video>
    num-sources=4
    

Çıkarımı Çalıştır

deepstream-app -c deepstream_app_config.txt
Çoklu akış kurulumu

Benchmark Sonuçları

Aşağıdaki tabloda YOLOv8s modellerinin NVIDIA Jetson Orin NX 16GB üzerinde 640x640 giriş boyutuyla farklı TensorRT hassasiyet seviyelerinde nasıl performans gösterdiği özetlenmektedir.

Model AdıHassasiyetÇıkarım Süresi (ms/im)FPS
YOLOv8sFP3215.6364
FP167.94126
INT85.53181

Teşekkür

Bu rehber başlangıçta Seeed Studio, Lakshantha ve Elaine'deki arkadaşlarımız tarafından oluşturuldu.

SSS

How do I set up Ultralytics YOLO11 on an NVIDIA Jetson device?

To set up Ultralytics YOLO11 on an NVIDIA Jetson device, you first need to install the DeepStream SDK compatible with your JetPack version. Follow the step-by-step guide in our Quick Start Guide to configure your NVIDIA Jetson for YOLO11 deployment.

What is the benefit of using TensorRT with YOLO11 on NVIDIA Jetson?

Using TensorRT with YOLO11 optimizes the model for inference, significantly reducing latency and improving throughput on NVIDIA Jetson devices. TensorRT provides high-performance, low-latency deep learning inference through layer fusion, precision calibration, and kernel auto-tuning. This leads to faster and more efficient execution, particularly useful for real-time applications like video analytics and autonomous machines.

Can I run Ultralytics YOLO11 with DeepStream SDK across different NVIDIA Jetson hardware?

Yes, the guide for deploying Ultralytics YOLO11 with the DeepStream SDK and TensorRT is compatible across the entire NVIDIA Jetson lineup. This includes devices like the Jetson Orin NX 16GB with JetPack 5.1.3 and the Jetson Nano 4GB with JetPack 4.6.4. Refer to the section DeepStream Configuration for YOLO11 for detailed steps.

How can I convert a YOLO11 model to ONNX for DeepStream?

To convert a YOLO11 model to ONNX format for deployment with DeepStream, use the utils/export_yoloV8.py komut dosyasından DeepStream-Yolo Depo.

İşte örnek bir komut:

python3 utils/export_yoloV8.py -w yolov8s.pt --opset 12 --simplify

Model dönüştürme hakkında daha fazla ayrıntı için model dışa aktarma bölümümüze göz atın.

What are the performance benchmarks for YOLO on NVIDIA Jetson Orin NX?

The performance of YOLO11 models on NVIDIA Jetson Orin NX 16GB varies based on TensorRT precision levels. For example, YOLOv8s models achieve:

  • FP32 Hassasiyeti: 15,63 ms/im, 64 FPS
  • FP16 Hassasiyeti: 7,94 ms/im, 126 FPS
  • INT8 Hassasiyeti: 5,53 ms/im, 181 FPS

These benchmarks underscore the efficiency and capability of using TensorRT-optimized YOLO11 models on NVIDIA Jetson hardware. For further details, see our Benchmark Results section.

📅 Created 3 months ago ✏️ Updated 23 days ago

Yorumlar