Zum Inhalt springen

Modell-Benchmarking mit Ultralytics YOLO

Ultralytics YOLO Ökosystem und Integrationen

Einführung

Once your model is trained and validated, the next logical step is to evaluate its performance in various real-world scenarios. Benchmark mode in Ultralytics YOLO11 serves this purpose by providing a robust framework for assessing the speed and accuracy of your model across a range of export formats.



Pass auf: Ultralytics Modi Tutorial: Benchmark

Warum ist Benchmarking so wichtig?

  • Informierte Entscheidungen: Erhalte Einblicke in die Kompromisse zwischen Geschwindigkeit und Genauigkeit.
  • Ressourcenzuweisung: Verstehe, wie verschiedene Exportformate auf unterschiedlicher Hardware funktionieren.
  • Optimierung: Erfahre, welches Exportformat die beste Leistung für deinen speziellen Anwendungsfall bietet.
  • Kosteneffizienz: Nutze die Hardware-Ressourcen auf der Grundlage von Benchmark-Ergebnissen effizienter.

Schlüsselmetriken im Benchmark-Modus

Unterstützte Exportformate

  • ONNX: Für optimale Leistung CPU
  • TensorRT: Für maximale GPU Effizienz
  • OpenVINO: Für Intel Hardware-Optimierung
  • CoreML, TensorFlow SavedModel , und mehr: Für verschiedene Einsatzzwecke.

Tipp

  • Exportiere nach ONNX oder OpenVINO , um die Geschwindigkeit von CPU bis zu 3x zu erhöhen.
  • Exportiere nach TensorRT , um bis zu 5x schneller zu sein GPU .

Verwendungsbeispiele

Run YOLO11n benchmarks on all supported export formats including ONNX, TensorRT etc. See Arguments section below for a full list of export arguments.

Beispiel

from ultralytics.utils.benchmarks import benchmark

# Benchmark on GPU
benchmark(model="yolo11n.pt", data="coco8.yaml", imgsz=640, half=False, device=0)
yolo benchmark model=yolo11n.pt data='coco8.yaml' imgsz=640 half=False device=0

Argumente

Argumente wie model, data, imgsz, half, device, und verbose bieten den Nutzern die Flexibilität, die Benchmarks auf ihre spezifischen Bedürfnisse abzustimmen und die Leistung verschiedener Exportformate mühelos zu vergleichen.

SchlüsselStandardwertBeschreibung
modelNoneGibt den Pfad zur Modelldatei an. Akzeptiert sowohl .pt und .yaml Formate, z. B., "yolo11n.pt" für vortrainierte Modelle oder Konfigurationsdateien.
dataNonePath to a YAML file defining the dataset for benchmarking, typically including paths and settings for validation data. Example: "coco8.yaml".
imgsz640Die Größe des Eingabebildes für das Modell. Kann eine einzelne Ganzzahl für quadratische Bilder oder ein Tupel sein (width, height) für nicht quadratisch, z.B., (640, 480).
halfFalseErmöglicht FP16 (halbpräzise) Inferenz, was den Speicherverbrauch reduziert und möglicherweise die Geschwindigkeit auf kompatibler Hardware erhöht. verwenden half=True zu ermöglichen.
int8FalseAktiviert die INT8-Quantisierung für eine weiter optimierte Leistung auf unterstützten Geräten, besonders nützlich für Edge-Geräte. setzen int8=True zu verwenden.
deviceNoneLegt das/die Rechengerät(e) für das Benchmarking fest, wie z. B. "cpu", "cuda:0"oder eine Liste von Geräten wie "cuda:0,1" für mehrereGPU Aufstellungen.
verboseFalseSteuert den Detailgrad der Logging-Ausgabe. Ein boolescher Wert; gesetzt verbose=True für detaillierte Protokolle oder einen Float für Schwellenwertfehler.

Formate exportieren

Die Benchmarks versuchen, automatisch in allen unten aufgeführten möglichen Exportformaten zu laufen.

Formatformat ArgumentModellMetadatenArgumente
PyTorch-yolo11n.pt-
TorchScripttorchscriptyolo11n.torchscriptimgsz, optimize, batch
ONNXonnxyolo11n.onnximgsz, half, dynamic, simplify, opset, batch
OpenVINOopenvinoyolo11n_openvino_model/imgsz, half, int8, batch
TensorRTengineyolo11n.engineimgsz, half, dynamic, simplify, workspace, int8, batch
CoreMLcoremlyolo11n.mlpackageimgsz, half, int8, nms, batch
TF SavedModelsaved_modelyolo11n_saved_model/imgsz, keras, int8, batch
TF GraphDefpbyolo11n.pbimgsz, batch
TF Litetfliteyolo11n.tfliteimgsz, half, int8, batch
TF Kante TPUedgetpuyolo11n_edgetpu.tfliteimgsz
TF.jstfjsyolo11n_web_model/imgsz, half, int8, batch
PaddlePaddlepaddleyolo11n_paddle_model/imgsz, batch
NCNNncnnyolo11n_ncnn_model/imgsz, half, batch

Siehe voll export Details in der exportieren Seite.

FAQ

How do I benchmark my YOLO11 model's performance using Ultralytics?

Ultralytics YOLO11 offers a Benchmark mode to assess your model's performance across different export formats. This mode provides insights into key metrics such as mean Average Precision (mAP50-95), accuracy, and inference time in milliseconds. To run benchmarks, you can use either Python or CLI commands. For example, to benchmark on a GPU:

Beispiel

from ultralytics.utils.benchmarks import benchmark

# Benchmark on GPU
benchmark(model="yolo11n.pt", data="coco8.yaml", imgsz=640, half=False, device=0)
yolo benchmark model=yolo11n.pt data='coco8.yaml' imgsz=640 half=False device=0

Weitere Details zu den Benchmark-Argumenten findest du im Abschnitt " Argumente".

What are the benefits of exporting YOLO11 models to different formats?

Exporting YOLO11 models to different formats such as ONNX, TensorRT, and OpenVINO allows you to optimize performance based on your deployment environment. For instance:

  • ONNX: Bietet bis zu 3x mehr Geschwindigkeit CPU .
  • TensorRT: Bietet eine bis zu 5x höhere Geschwindigkeit GPU .
  • OpenVINO: Specifically optimized for Intel hardware. These formats enhance both the speed and accuracy of your models, making them more efficient for various real-world applications. Visit the Export page for complete details.

Why is benchmarking crucial in evaluating YOLO11 models?

Benchmarking your YOLO11 models is essential for several reasons:

  • Informierte Entscheidungen: Verstehe die Kompromisse zwischen Geschwindigkeit und Genauigkeit.
  • Ressourcenzuweisung: Prüfe die Leistung verschiedener Hardware-Optionen.
  • Optimieren: Bestimme, welches Exportformat die beste Leistung für bestimmte Anwendungsfälle bietet.
  • Cost Efficiency: Optimize hardware usage based on benchmark results. Key metrics such as mAP50-95, Top-5 accuracy, and inference time help in making these evaluations. Refer to the Key Metrics section for more information.

Which export formats are supported by YOLO11, and what are their advantages?

YOLO11 supports a variety of export formats, each tailored for specific hardware and use cases:

  • ONNX: Am besten für CPU Leistung.
  • TensorRT: Ideal für GPU Effizienz.
  • OpenVINO: Optimiert für Intel Hardware.
  • CoreML & TensorFlow: Useful for iOS and general ML applications. For a complete list of supported formats and their respective advantages, check out the Supported Export Formats section.

What arguments can I use to fine-tune my YOLO11 benchmarks?

Bei der Durchführung von Benchmarks können verschiedene Argumente an die jeweiligen Bedürfnisse angepasst werden:

  • model: Path to the model file (e.g., "yolo11n.pt").
  • Daten: Pfad zu einer YAML-Datei, die den Datensatz definiert (z. B. "coco8.yaml").
  • imgsz: Die Größe des Eingangsbildes, entweder als einzelne Ganzzahl oder als Tupel.
  • halb: Aktiviere FP16-Inferenz für bessere Leistung.
  • int8: Aktiviere die INT8-Quantisierung für Edge Devices.
  • Gerät: Gib das Berechnungsgerät an (z. B. "cpu", "cuda:0").
  • verbose: Control the level of logging detail. For a full list of arguments, refer to the Arguments section.
📅 Created 11 months ago ✏️ Updated 22 days ago

Kommentare