Ultralytics YOLO11 on NVIDIA Jetson using DeepStream SDK and TensorRT
Pass auf: 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.
Hinweis
Diese Anleitung wurde sowohl mit dem Seeed Studio reComputer J4012 getestet, der auf dem NVIDIA Jetson Orin NX 16GB mit der JetPack-Version JP5.1.3 basiert, als auch mit dem Seeed Studio reComputer J1020 v2, der auf dem NVIDIA Jetson Nano 4GB mit der JetPack-Version JP4.6.4 basiert. Es wird erwartet, dass es mit der gesamten NVIDIA Jetson-Hardware-Reihe funktioniert, einschließlich der neuesten und der älteren.
Was ist NVIDIA DeepStream?
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.
Voraussetzungen
Bevor Sie dieser Anleitung folgen:
- Visit our documentation, Quick Start Guide: NVIDIA Jetson with Ultralytics YOLO11 to set up your NVIDIA Jetson device with Ultralytics YOLO11
Installieren Sie das DeepStream SDK gemäß der JetPack-Version
- Installieren Sie für JetPack 4.6.4 DeepStream 6.0.1
- Installieren Sie für JetPack 5.1.3 DeepStream 6.3
Tipp
In dieser Anleitung haben wir die Debian-Paketmethode verwendet, um das DeepStream SDK auf dem Jetson-Gerät zu installieren. Sie können auch das DeepStream SDK auf Jetson (archiviert) besuchen, um auf ältere Versionen von DeepStream zuzugreifen.
DeepStream Configuration for YOLO11
Hier verwenden wir marcoslucianops/DeepStream-Yolo GitHub Repository, das NVIDIA DeepStream SDK Unterstützung für YOLO Modelle enthält. Wir danken marcoslucianops für seine Beiträge!
Installieren von Abhängigkeiten
Klonen Sie das folgende Repository
Download Ultralytics YOLO11 detection model (.pt) of your choice from YOLO11 releases. Here we use yolov8s.pt.
Hinweis
You can also use a custom trained YOLO11 model.
Modell konvertieren in ONNX
Übergeben Sie die folgenden Argumente an den obigen Befehl
Verwenden Sie für DeepStream 6.0.1 opset 12 oder niedriger. Die Standardeinstellung ist 16.
So ändern Sie die Inferenzgröße (Standard: 640)
Beispiel für 1280:
Zur Vereinfachung der ONNX Modell (DeepStream >= 6.0)
So verwenden Sie die dynamische Batch-Größe (DeepStream >= 6.1)
So verwenden Sie die statische Batchgröße (Beispiel für Batchgröße = 4)
Setze die CUDA Version entsprechend der installierten JetPack Version
Für JetPack 4.6.4:
Für JetPack 5.1.3:
Kompilieren Sie die Bibliothek
Bearbeiten Sie die
config_infer_primary_yoloV8.txt
Datei entsprechend Ihrem Modell (für YOLOv8s mit 80 Klassen)Bearbeiten Sie die
deepstream_app_config
DateiSie können die Videoquelle auch in
deepstream_app_config
Datei. Hier wird eine Standard-Videodatei geladen
Ausführen von Rückschlüssen
Hinweis
Es wird lange dauern, die TensorRT Engine-Datei, bevor Sie die Inferenz starten. Habt also bitte etwas Geduld.
Tipp
If you want to convert the model to FP16 precision, simply set model-engine-file=model_b1_gpu0_fp16.engine
und network-mode=2
innerhalb config_infer_primary_yoloV8.txt
INT8 Kalibrierung
Wenn du die INT8-Präzision für die Inferenz verwenden möchtest, musst du die folgenden Schritte ausführen
Garnitur
OPENCV
UmgebungsvariableKompilieren Sie die Bibliothek
Laden Sie für das COCO-Dataset die val2017, extrahieren und nach
DeepStream-Yolo
OrdnerErstellen eines neuen Verzeichnisses für Kalibrierungsbilder
Führen Sie Folgendes aus, um 1000 zufällige Bilder aus dem COCO-Datensatz auszuwählen, um die Kalibrierung durchzuführen
Hinweis
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.
Erstellen Sie die
calibration.txt
Datei mit allen ausgewählten BildernFestlegen von Umgebungsvariablen
Hinweis
Höhere INT8_CALIB_BATCH_SIZE-Werte führen zu einer höheren Genauigkeit und schnelleren Kalibrierungsgeschwindigkeit. Stelle ihn entsprechend deinem GPU Speicher ein.
Aktualisieren Sie die
config_infer_primary_yoloV8.txt
DateiVon
An
Ausführen von Rückschlüssen
MultiStream-Einrichtung
Um mehrere Streams unter einer einzigen Deepstream-Anwendung einzurichten, können Sie die folgenden Änderungen an der deepstream_app_config.txt
Datei
Ändern Sie die Zeilen und Spalten, um eine Rasteranzeige entsprechend der Anzahl der gewünschten Streams zu erstellen. Zum Beispiel können wir für 4 Streams 2 Zeilen und 2 Spalten hinzufügen.
Garnitur
num-sources=4
und fügen Sieuri
aller 4 Streams
Ausführen von Rückschlüssen
Benchmark-Ergebnisse
Die folgende Tabelle fasst zusammen, wie die YOLOv8s Modelle bei verschiedenen TensorRT Genauigkeitsstufen mit einer Eingabegröße von 640x640 auf NVIDIA Jetson Orin NX 16GB abschneiden.
Modellname | Präzision | Inferenzzeit (ms/im) | FPS |
---|---|---|---|
YOLOv8s | FP32 | 15.63 | 64 |
FP16 | 7.94 | 126 | |
INT8 | 5.53 | 181 |
Bestätigungen
Dieser Leitfaden wurde ursprünglich von unseren Freunden von Seeed Studio, Lakshantha und Elaine, erstellt.
FAQ
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
Skript aus dem DeepStream-Yolo Repository.
Hier ist ein Beispielbefehl:
Weitere Informationen zur Modellkonvertierung findest du in unserem Abschnitt zum Modellexport.
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 Präzision: 15,63 ms/im, 64 FPS
- FP16 Präzision: 7,94 ms/im, 126 FPS
- INT8 Präzision: 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.