Zum Inhalt springen

Objekt-Erkennung

Beispiele für die Objekterkennung

Object detection is a task that involves identifying the location and class of objects in an image or video stream.

Die Ausgabe eines Objektdetektors ist eine Reihe von Begrenzungsrahmen (Bounding Boxes), die die Objekte im Bild umschließen, zusammen mit Klassenbeschriftungen und Vertrauenswerten für jeden Rahmen. Die Objekterkennung ist eine gute Wahl, wenn du interessante Objekte in einer Szene identifizieren musst, aber nicht genau wissen willst, wo das Objekt ist oder welche Form es hat.



Pass auf: Object Detection with Pre-trained Ultralytics YOLO Model.

Tipp

YOLO11 Detect models are the default YOLO11 models, i.e. yolo11n.pt und sind vorgebildet auf COCO.

Modelle

YOLO11 pretrained Detect models are shown here. Detect, Segment and Pose models are pretrained on the COCO dataset, while Classify models are pretrained on the ImageNet dataset.

Die Modelle werden bei der ersten Verwendung automatisch von der neuestenVersion von Ultralytics heruntergeladen.

ModellGröße
(Pixel)
mAPval
50-95
Geschwindigkeit
CPU ONNX
(ms)
Speed
T4 TensorRT10
(ms)
params
(M)
FLOPs
(B)
YOLO11n64039.556.1 ± 0.81.5 ± 0.02.66.5
YOLO11s64047.090.0 ± 1.22.5 ± 0.09.421.5
YOLO11m64051.5183.2 ± 2.04.7 ± 0.120.168.0
YOLO11l64053.4238.6 ± 1.46.2 ± 0.125.386.9
YOLO11x64054.7462.8 ± 6.711.3 ± 0.256.9194.9
  • mAPval Werte sind für ein Modell mit einer Skala auf COCO val2017 Datensatz.
    Reproduzieren durch yolo val detect data=coco.yaml device=0
  • Geschwindigkeit gemittelt über die COCO val-Bilder unter Verwendung eines Amazon EC2 P4d Instanz.
    Reproduzieren durch yolo val detect data=coco.yaml batch=1 device=0|cpu

Zug

Train YOLO11n on the COCO8 dataset for 100 epochs at image size 640. For a full list of available arguments see the Configuration page.

Beispiel

from ultralytics import YOLO

# Load a model
model = YOLO("yolo11n.yaml")  # build a new model from YAML
model = YOLO("yolo11n.pt")  # load a pretrained model (recommended for training)
model = YOLO("yolo11n.yaml").load("yolo11n.pt")  # build from YAML and transfer weights

# Train the model
results = model.train(data="coco8.yaml", epochs=100, imgsz=640)
# Build a new model from YAML and start training from scratch
yolo detect train data=coco8.yaml model=yolo11n.yaml epochs=100 imgsz=640

# Start training from a pretrained *.pt model
yolo detect train data=coco8.yaml model=yolo11n.pt epochs=100 imgsz=640

# Build a new model from YAML, transfer pretrained weights to it and start training
yolo detect train data=coco8.yaml model=yolo11n.yaml pretrained=yolo11n.pt epochs=100 imgsz=640

Format des Datensatzes

YOLO Das Format der Erkennungsdatensätze findest du im Detail im Dataset Guide. Um deinen bestehenden Datensatz aus anderen Formaten (wie COCO usw.) in das Format YOLO zu konvertieren, verwende bitte das JSON2YOLO-Tool von Ultralytics.

Val

Validate trained YOLO11n model accuracy on the COCO8 dataset. No arguments are needed as the model seine Ausbildung beibehält data und Argumente als Modellattribute.

Beispiel

from ultralytics import YOLO

# Load a model
model = YOLO("yolo11n.pt")  # load an official model
model = YOLO("path/to/best.pt")  # load a custom model

# Validate the model
metrics = model.val()  # no arguments needed, dataset and settings remembered
metrics.box.map  # map50-95
metrics.box.map50  # map50
metrics.box.map75  # map75
metrics.box.maps  # a list contains map50-95 of each category
yolo detect val model=yolo11n.pt  # val official model
yolo detect val model=path/to/best.pt  # val custom model

Vorhersage

Use a trained YOLO11n model to run predictions on images.

Beispiel

from ultralytics import YOLO

# Load a model
model = YOLO("yolo11n.pt")  # load an official model
model = YOLO("path/to/best.pt")  # load a custom model

# Predict with the model
results = model("https://ultralytics.com/images/bus.jpg")  # predict on an image
yolo detect predict model=yolo11n.pt source='https://ultralytics.com/images/bus.jpg'  # predict with official model
yolo detect predict model=path/to/best.pt source='https://ultralytics.com/images/bus.jpg'  # predict with custom model

Siehe voll predict Modus Details in der Vorhersage Seite.

exportieren

Export a YOLO11n model to a different format like ONNX, CoreML, etc.

Beispiel

from ultralytics import YOLO

# Load a model
model = YOLO("yolo11n.pt")  # load an official model
model = YOLO("path/to/best.pt")  # load a custom trained model

# Export the model
model.export(format="onnx")
yolo export model=yolo11n.pt format=onnx  # export official model
yolo export model=path/to/best.pt format=onnx  # export custom trained model

Available YOLO11 export formats are in the table below. You can export to any format using the format Argument, d.h. format='onnx' oder format='engine'. Du kannst exportierte Modelle direkt vorhersagen oder validieren, d.h. yolo predict model=yolo11n.onnx. Nach Abschluss des Exports werden Anwendungsbeispiele für dein Modell angezeigt.

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 train a YOLO11 model on my custom dataset?

Training a YOLO11 model on a custom dataset involves a few steps:

  1. Bereite das Dataset vor: Stelle sicher, dass dein Datensatz das Format YOLO hat. Eine Anleitung findest du in unserem Dataset Guide.
  2. Lade das Modell: Verwende die Ultralytics YOLO Bibliothek, um ein vortrainiertes Modell zu laden oder ein neues Modell aus einer YAML-Datei zu erstellen.
  3. Das Modell trainieren: Führen Sie die train Methode in Python oder die yolo detect train Befehl in CLI.

Beispiel

from ultralytics import YOLO

# Load a pretrained model
model = YOLO("yolo11n.pt")

# Train the model on your custom dataset
model.train(data="my_custom_dataset.yaml", epochs=100, imgsz=640)
yolo detect train data=my_custom_dataset.yaml model=yolo11n.pt epochs=100 imgsz=640

Ausführliche Informationen zu den Konfigurationsoptionen findest du auf der Seite Konfiguration.

What pretrained models are available in YOLO11?

Ultralytics YOLO11 offers various pretrained models for object detection, segmentation, and pose estimation. These models are pretrained on the COCO dataset or ImageNet for classification tasks. Here are some of the available models:

Eine detaillierte Liste und Leistungskennzahlen findest du im Abschnitt Modelle.

How can I validate the accuracy of my trained YOLO model?

To validate the accuracy of your trained YOLO11 model, you can use the .val() Methode in Python oder die yolo detect val Befehl in CLI. Damit erhältst du Metriken wie mAP50-95, mAP50 und mehr.

Beispiel

from ultralytics import YOLO

# Load the model
model = YOLO("path/to/best.pt")

# Validate the model
metrics = model.val()
print(metrics.box.map)  # mAP50-95
yolo detect val model=path/to/best.pt

Weitere Informationen zur Validierung findest du auf der Val-Seite.

What formats can I export a YOLO11 model to?

Ultralytics YOLO11 allows exporting models to various formats such as ONNX, TensorRT, CoreML, and more to ensure compatibility across different platforms and devices.

Beispiel

from ultralytics import YOLO

# Load the model
model = YOLO("yolo11n.pt")

# Export the model to ONNX format
model.export(format="onnx")
yolo export model=yolo11n.pt format=onnx

Die vollständige Liste der unterstützten Formate und Anweisungen findest du auf der Seite Export.

Why should I use Ultralytics YOLO11 for object detection?

Ultralytics YOLO11 is designed to offer state-of-the-art performance for object detection, segmentation, and pose estimation. Here are some key advantages:

  1. Vorgefertigte Modelle: Nutze Modelle, die auf beliebten Datensätzen wie COCO und ImageNet trainiert wurden, um die Entwicklung zu beschleunigen.
  2. Hohe Genauigkeit: Erzielt beeindruckende mAP-Werte und sorgt für eine zuverlässige Objekterkennung.
  3. Geschwindigkeit: Optimiert für Echtzeit-Inferenzen, ideal für Anwendungen, die eine schnelle Verarbeitung erfordern.
  4. Flexibilität: Exportiere Modelle in verschiedene Formate wie ONNX und TensorRT für den Einsatz auf verschiedenen Plattformen.

Explore our Blog for use cases and success stories showcasing YOLO11 in action.

📅 Created 11 months ago ✏️ Updated 20 days ago

Kommentare