Ultralytics YOLOv5
Übersicht#
YOLOv5u ist eine aktualisierte Version von Ultralytics YOLOv5 für die Objekterkennung. Auf der Architektur des von Ultralytics entwickelten YOLOv5-Modells aufbauend, integriert YOLOv5u den anchorfreien, objektivitätsfreien geteilten Kopf, der erstmals in den YOLOv8-Modellen zum Einsatz kam. Diese Änderung verbessert das Verhältnis zwischen Genauigkeit und Geschwindigkeit und macht YOLOv5u zu einer effizienten Option für Forschung und praktische Anwendungen.

Ultralytics bietet eine anchorfreie Variante des YOLOv5-Modells. Mit dem Repository ultralytics/yolov5 trainierte Modelle lassen sich nicht mit der Bibliothek ultralytics/ultralytics laden. Um YOLOv5 hier zu verwenden, trainiere ein neues Modell ausgehend von einem Ultralytics-YOLOv5u-Checkpoint (z. B. yolov5su.pt).
Entdecke YOLOv5-Modelle und führe sie direkt auf der Ultralytics-Plattform aus.
Wichtige Funktionen#
-
Anchorfreier geteilter Ultralytics-Kopf: Herkömmliche Objekterkennungsmodelle stützen sich auf vordefinierte Ankerboxen, um Objektpositionen vorherzusagen. YOLOv5u verwendet stattdessen einen anchorfreien geteilten Ultralytics-Kopf. Dieser ermöglicht einen flexibleren Erkennungsmechanismus und verbessert die Leistung in unterschiedlichen Szenarien.
-
Optimiertes Verhältnis zwischen Genauigkeit und Geschwindigkeit: YOLOv5u vereint Geschwindigkeit und Genauigkeit und liefert Erkennungen in Echtzeit mit konkurrenzfähiger Genauigkeit. Das ist für Anwendungen wichtig, die schnelle Reaktionen erfordern, etwa autonome Fahrzeuge, Robotik und Echtzeit-Videoanalyse.
-
Verschiedene vortrainierte Modelle: YOLOv5u bietet auf COCO vortrainierte Modelle in fünf Größen (n, s, m, l, x) mit einer Eingabeauflösung von 640 sowie P6-Varianten für Eingaben mit einer Auflösung von 1280. So kannst du die passende Kombination aus Geschwindigkeit und Genauigkeit für deine Hardware wählen und das Modell mit deinen eigenen Daten feinabstimmen.
Unterstützte Aufgaben und Modi#
Die YOLOv5u-Modelle mit verschiedenen vortrainierten Gewichten unterstützen die Objekterkennung und alle Modi, die von der Entwicklung bis zur Bereitstellung benötigt werden.
| Modelltyp | Vortrainierte Gewichte | Aufgabe | Training | Validierung | Inferenz | Exportieren |
|---|---|---|---|---|---|---|
| YOLOv5u | yolov5nu, yolov5su, yolov5mu, yolov5lu, yolov5xu, yolov5n6u, yolov5s6u, yolov5m6u, yolov5l6u, yolov5x6u | Objekterkennung | ✅ | ✅ | ✅ | ✅ |
Diese Tabelle fasst die YOLOv5u-Modellvarianten und ihre Unterstützung der Modi Training, Validierung, Inferenz und Export zusammen.
Leistungskennzahlen#
Unter Dokumentation zur Erkennung findest du Anwendungsbeispiele für diese mit COCO trainierten Modelle, die 80 vortrainierte Klassen umfassen.
| Modell | YAML | Größe (Pixel) | mAPval50-95 | Geschwindigkeit CPU ONNX (ms) | Geschwindigkeit A100 TensorRT (ms) | Parameter (M) | FLOPs (B) |
|---|---|---|---|---|---|---|---|
| yolov5nu.pt | yolov5n.yaml | 640 | 34.3 | 73.6 | 1.06 | 2.6 | 7.7 |
| yolov5su.pt | yolov5s.yaml | 640 | 43.0 | 120.7 | 1.27 | 9.1 | 24.0 |
| yolov5mu.pt | yolov5m.yaml | 640 | 49.0 | 233.9 | 1.86 | 25.1 | 64.2 |
| yolov5lu.pt | yolov5l.yaml | 640 | 52.2 | 408.4 | 2.50 | 53.2 | 135.0 |
| yolov5xu.pt | yolov5x.yaml | 640 | 53.2 | 763.2 | 3.81 | 97.2 | 246.4 |
| yolov5n6u.pt | yolov5n6.yaml | 1280 | 42.1 | 211.0 | 1.83 | 4.3 | 31.3 |
| yolov5s6u.pt | yolov5s6.yaml | 1280 | 48.6 | 422.6 | 2.34 | 15.3 | 97.6 |
| yolov5m6u.pt | yolov5m6.yaml | 1280 | 53.6 | 810.9 | 4.36 | 41.2 | 261.3 |
| yolov5l6u.pt | yolov5l6.yaml | 1280 | 55.7 | 1470.9 | 5.47 | 86.1 | 549.4 |
| yolov5x6u.pt | yolov5x6.yaml | 1280 | 56.8 | 2436.5 | 8.98 | 155.5 | 1002.8 |
Anwendungsbeispiele#
Dieses Beispiel zeigt einfache Beispiele für das Training und die Inferenz mit YOLOv5.
Vortrainierte PyTorch-Modelle *.pt sowie Konfigurationsdateien *.yaml kannst du an die Klasse YOLO() übergeben, um eine Modellinstanz in Python zu erstellen:
from ultralytics import YOLO
# Ein mit COCO vortrainiertes YOLOv5nu-Modell laden
model = YOLO("yolov5nu.pt")
# Modellinformationen anzeigen (optional)
model.info()
# Das Modell 100 Epochen lang mit dem COCO8-Beispieldatensatz trainieren
results = model.train(data="coco8.yaml", epochs=100, imgsz=640)
# Mit dem YOLOv5nu-Modell eine Inferenz auf dem Bild „bus.jpg“ ausführen
results = model("path/to/bus.jpg")Zitate und Danksagungen#
Ultralytics hat keine formelle Forschungsarbeit zu YOLOv5 veröffentlicht, da sich die Modelle rasant weiterentwickeln. Unser Schwerpunkt liegt darauf, die Technologie voranzubringen und ihre Nutzung zu vereinfachen, statt statische Dokumentation zu erstellen. Die aktuellsten Informationen zur YOLO-Architektur, zu Funktionen und zur Nutzung findest du in unserem GitHub-Repository und in unserer Dokumentation.
Wenn du YOLOv5 oder YOLOv5u in deiner Forschung verwendest, zitiere bitte das Ultralytics-YOLOv5-Repository wie folgt:
@software{yolov5,
title = {Ultralytics YOLOv5},
author = {Glenn Jocher},
year = {2020},
version = {7.0},
license = {AGPL-3.0},
url = {https://github.com/ultralytics/yolov5},
doi = {10.5281/zenodo.3908559},
orcid = {0000-0001-5950-6979}
}Bitte beachte, dass YOLOv5-Modelle unter den Lizenzen AGPL-3.0 und Enterprise bereitgestellt werden.
Häufig gestellte Fragen#
Ultralytics YOLOv5u ist eine aktualisierte Version von YOLOv5, die einen ankerfreien, objektivitätsfreien, geteilten Kopf integriert und so den Kompromiss zwischen Genauigkeit und Geschwindigkeit bei der Objekterkennung in Echtzeit verbessert. Anders als das herkömmliche YOLOv5 verwendet YOLOv5u einen ankerfreien Erkennungsmechanismus, der das Modell flexibler und anpassungsfähiger für unterschiedliche Szenarien macht.
Der ankerfreie Ultralytics-Kopf in YOLOv5u verbessert die Leistung der Objekterkennung, indem er die Abhängigkeit von vordefinierten Ankerboxen beseitigt. Dadurch entsteht ein flexiblerer und anpassungsfähigerer Erkennungsmechanismus, der verschiedene Objektgrößen und -formen effizienter verarbeiten kann. Diese Verbesserung trägt direkt zu einem ausgewogenen Verhältnis zwischen Genauigkeit und Geschwindigkeit bei und macht YOLOv5u für Echtzeitanwendungen geeignet. Weitere Informationen zur Architektur findest du im Abschnitt Hauptmerkmale.
Ja. Vortrainierte YOLOv5u-Modelle unterstützen Objekterkennung in den Modi Training, Validierung, Inferenz und Export.
Die Leistungskennzahlen von YOLOv5u-Modellen unterscheiden sich je nach verwendeter Plattform und Hardware. Das YOLOv5nu-Modell erreicht beispielsweise 34,3 mAP auf dem COCO-Datensatz und benötigt 73,6 ms auf einer CPU (ONNX) sowie 1,06 ms auf einer A100 mit TensorRT. Ausführliche Kennzahlen für alle YOLOv5u-Modelle, einschließlich der CPU-ONNX- und A100-TensorRT-Geschwindigkeiten, findest du im Abschnitt Leistungskennzahlen.
Du kannst ein YOLOv5u-Modell trainieren, indem du ein vortrainiertes Modell lädst und den Trainingsbefehl mit deinem Datensatz ausführst. Hier ein kurzes Beispiel:
Beispielfrom ultralytics import YOLO # Ein mit COCO vortrainiertes YOLOv5nu-Modell laden model = YOLO("yolov5nu.pt") # Modellinformationen anzeigen (optional) model.info() # Das Modell 100 Epochen lang mit dem COCO8-Beispieldatensatz trainieren results = model.train(data="coco8.yaml", epochs=100, imgsz=640)Ausführlichere Anweisungen findest du im Abschnitt Anwendungsbeispiele.
Kommentare30
Stell eine Frage, teile deine Ergebnisse oder hilf jemand anderem.
PriyaRanjanReddy
Hi can we use yolov5nu.pt for training on my own dataset and then use the trained model for commercial use where I can build an application over it
Glenn JocherUltralytics@PriyaRanjanReddy yes, you can use YOLOv5nu.pt for training on your dataset. For commercial use, you'll need an Ultralytics Enterprise License, which allows proprietary deployment without AGPL-3.0's open-source requirements. Visit https://ultralytics.com/license for licensing details.
PriyaRanjanReddy
What if i wanted to use yolo11 yolo8 or anything what license should I purchase
PriyaRanjanReddy
and please let me know the cost of the license as well
Glenn JocherUltralytics(bearbeitet)@PriyaRanjanReddy Ultralytics models, including YOLOv5u, YOLOv8, YOLO11 and YOLO26, are released under AGPL-3.0. You can use them commercially if your application complies with AGPL-3.0 (including open-sourcing it); otherwise you need an Ultralytics Enterprise License. Pricing varies based on your project's needs, so please visit our licensing page to discuss details.
donia444
hey ,i am trying to train yolov5nu on a custom dataset that is specifically for drone detection ,every time i train using this model ,i notice that my model overfits and gives a very very high unreal accuracy , but when i train on a different model like yolov5n that problem seem to not be found ,any idea why is that happening
Glenn JocherUltralytics@donia444 it seems that your YOLOv5nu model might be overfitting due to its more complex architecture compared to YOLOv5n, which is simpler and might generalize better on your dataset. Consider using techniques like data augmentation, dropout, or early stopping to mitigate overfitting. You can find additional strategies in the Ultralytics documentation to help address this issue.
MadhavKrishna1
1.Does the kaggle dataset have a label file also? 2.How can i fine tune the model ,is there any built in library through which i could fine tune it.
On Sun, 22 Sept 2024 at 13:12, Glenn Jocher @.***> wrote:
@MadhavKrishna1 https://github.com/MadhavKrishna1 yOLOv5 models are indeed trained on the full COCO dataset, which includes 80 classes. For additional datasets similar to COCO, you might explore open-source repositories or platforms like Kaggle. Fine-tuning with your specific images should enhance performance on your target data.
— Reply to this email directly, view it on GitHub https://github.com/orgs/ultralytics/discussions/10054#discussioncomment-10716632, or unsubscribe https://github.com/notifications/unsubscribe-auth/BCVBHHUR2WRPYUK46RYYFGTZXZYHRAVCNFSM6AAAAABGG3IMDCVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTANZRGY3DGMQ . You are receiving this because you were mentioned.Message ID: @.*** com>
Glenn JocherUltralytics@MadhavKrishna1 1. Yes, Kaggle datasets often include label files, but it's best to check the specific dataset details on Kaggle. 2. You can fine-tune the model using the Ultralytics YOLO Python API, which provides built-in support for training and fine-tuning.
MadhavKrishna1
I would like to know about the training process of the YOLOv5 model. Specifically, is it trained on the entire COCO dataset? I am planning to fine-tune a downloaded YOLOv5 model using additional images that are similar to those in the COCO dataset. These images have 80 classes and similar sizes to those in COCO Could you provide guidance on finding this additional dataset?
Thank you!
Glenn JocherUltralytics@MadhavKrishna1 yOLOv5 models are indeed trained on the full COCO dataset, which includes 80 classes. For additional datasets similar to COCO, you might explore open-source repositories or platforms like Kaggle. Fine-tuning with your specific images should enhance performance on your target data.
chef-SAbhinay
Can still use yolov5su.pt with YOLO from ultralytics pip package which is mentioned in the above docs?
chef-SAbhinay
or i have use torch.hub.load for it?
chef-SAbhinay
WARNING ⚠️ yolov5su.pt appears to require 'ultralytics.yolo', which is not in Ultralytics requirements.
chef-SAbhinay
i want to install model locally and use it
Glenn JocherUltralytics(bearbeitet)@Abhinay-Sadineni yes,
yolov5su.ptis an Ultralytics YOLOv5u checkpoint and loads directly with theYOLOclass from theultralyticspackage, so ensure you have the latest version installed. Checkpoints trained with the original ultralytics/yolov5 repo are the ones that cannot be loaded this way. For more details, visit the YOLOv5 documentation.chef-SAbhinay
is this yolov5su.pt(yolov5 model) compatible with latest ultralytics package ?
my experiment setup doesn't allow the autoinstall 'ultralytics.yolo' (i mean external traffic is blocked)
will the latest package also issue autoinstall warning?
chef-SAbhinay
I believe torch.hub.load will also try to install model (which my experiment setup doesn't allow)
chef-SAbhinay
Ultralytics 8.2.81 is also giving the same error
Glenn JocherUltralyticsTo use
yolov5su.ptwith the latest Ultralytics package, ensure you have the latest version installed. If your setup blocks external traffic, you can manually download the model and dependencies. The autoinstall warning may still appear if dependencies are missing. For a seamless experience, consider using the model with the UltralyticsYOLOclass after ensuring all dependencies are locally available.kanagarajan0709
I built a custom dataset from Ultralytics Hub platform using Yolov5su model type and downloaded the trained model. When I tried to load getting this error : "An error occurred: 'Detect' object has no attribute 'grid'. "
This is how I load the model : yolov5path - points to latest yolov5 git repo. model path - refers to YOLOv5su model trained using Ultralytics Hub.
yolo_model = torch.hub.load(yolov5path, 'custom', force_reload=True, path=model_path, source='local')
YOLOv5 v7.0-338-gff063284 Python-3.12.4 torch-2.3.1+cpu CPU
YOLOv5s summary (fused): 193 layers, 9,114,632 parameters, 0 gradients, 23.8 GFLOPs Adding AutoShape... An error occurred: 'Detect' object has no attribute 'grid'.
Glenn JocherUltralytics(bearbeitet)@kanagarajan0709
yolov5su.ptis an Ultralytics YOLOv5u checkpoint and loads with theYOLOclass from the latestultralyticspackage. The "Detect object has no attribute 'grid'" error appears when a checkpoint from the original ultralytics/yolov5 repo is loaded withultralytics, or whenyolov5su.ptis loaded with the old yolov5 repo code. Loadyolov5su.ptwithfrom ultralytics import YOLO, and use the yolov5 repo only for checkpoints trained there. See the YOLOv5 documentation.kanagarajan0709(bearbeitet)
To resolve this, please ensure you are using the correct version of the YOLOv5 repository that supports the yolov5su.pt model. If the issue persists, consider using the torch.hub.load method with the appropriate YOLOv5 version.
Yes , that's what I would be interested to know about. Could you please let me know which Yolov5 git hub repo that supports loading of yolov5su model.
I am currently on latest git version of this - https://github.com/ultralytics/yolov5. Last commit e8a30cf820b273afbbf1c73a3f1088471a84fade (HEAD -> master, origin/master, origin/HEAD) Author: Glenn Jocher glenn.jocher@ultralytics.com
Also I did use torch.hub.load method to load the model as below , yolo_model = torch.hub.load(yolov5path, 'custom', force_reload=True, path=model_path, source='local')
Glenn JocherUltralytics(bearbeitet)To load
yolov5su.pt, use theYOLOclass from the latestultralyticspackage (YOLO("yolov5su.pt")). It is an Ultralytics YOLOv5u checkpoint and is not meant for the ultralytics/yolov5 repo, which loads checkpoints trained there.
Halafz7
Good Content! I want to ask something. Is it possible to use yolov5u for Classification purposes?
Paula DerrengerUltralytics(bearbeitet)@Halafz7 thank you for your kind words! 😊
YOLOv5u is designed for object detection. For classification, use a classification model such as YOLO26, which supports it directly.
Python Example
from ultralytics import YOLO # Load a pretrained YOLO26 classification model model = YOLO("yolo26n-cls.pt") # Run inference on an image results = model("path/to/image.jpg") # Display the results results[0].show()CLI Example
# Run inference with a YOLO26 classification model yolo predict model=yolo26n-cls.pt source=path/to/image.jpgFor more details, see the Classify docs.
If you have any more questions or need further assistance, feel free to ask! 🚀
MikolajBaranski
My questions (as of 12th April 2024) is whether there is any documentation regarding the Yolov5u model. The description on this page states that the Yolov5u incorporates the objectness-free split head into the Yolov5 architecture. Is there any further documentation on this model? The Yolov5 GitHub doesn't seem to present this model anywhere. While the page of v7.0 update only describes the introduction of segmentation. Is there any resource going into more detail into this specific release of the model?
I see there is also documentation regarding the architecture of the Yolov5 v6.1/6.0 model (link below for reference). Is the Yolov5u an adaptations of that architecture? If so which part is changed?
Github: https://github.com/ultralytics/yolov5 Architecture: https://docs.ultralytics.com/yolov5/tutorials/architecture_description/
Paula DerrengerUltralyticsHey there! 😊 It looks like you're exploring the details of our YOLOv5u model. Indeed, YOLOv5u builds upon the YOLOv5 architecture, especially by incorporating an anchor-free, objectness-free split head, a feature inspired by advancements in YOLOv8. This enhancement is aimed at refining the model's ability to detect objects with a better accuracy-speed tradeoff.
Although it seems there might not be detailed standalone documentation on the YOLOv5u model in the Ultralytics GitHub repo, the key updates and features you’re interested in are described in our Ultralytics YOLOv5 Overview. This page highlights the integration of the anchor-free split head into the model and its impact on performance and adaptability in various scenarios.
Regarding your question on the architecture adaptation, yes, YOLOv5u adapts the YOLOv5 v6.1/6.0 architecture. The primary change lies in the detection head of the model, which has moved towards an anchor-free, objectness-free approach. This move enhances flexibility and detection efficiency, especially in complex scenarios where predefined anchor boxes might limit the detection capabilities.
If you're looking for more technical specifics or examples, I'd recommend diving into the architecture description you mentioned. While it focuses on an earlier version, the core architectural principles remain relevant, with the YOLOv5u modifications centered around the detection head for improved performance.
For direct experimentation or further exploration of the YOLOv5u's unique features, playing with the pre-trained models and reviewing their performance metrics might also offer valuable insights.
I hope this clarifies your queries! If you have more questions or need further assistance, feel free to ask. Happy detecting! 🚀
MikolajBaranski
Thank you that is a very helpful answer! Just to make a final clarification. I am using the YOLOv5u in my Masters Thesis and I would like to appropriately record the model I have used. For the YOLOv5xu.pt (the pretrained model), should I refer to it as the extra large version of the YOLOv5u v1.0, or is it the YOLOv5 v7.0, or is there some other versioning that would correctly identify this specific release of the model?
Paula DerrengerUltralyticsHey, thanks for reaching out with your question! 😊
For your Masters Thesis, when documenting the model, it's best to refer to it as YOLOv5u, specifying the version as YOLOv5 v7.0 if that's the version you're utilizing, along with the specific variant you're using, for instance,
yolov5xu.ptfor the extra-large model. It's key to mention both the overall version (v7.0, as an example) and the specific model variant (xu) to provide clear context and specificity about the architecture and features employed in your work.Here's how you could cite it:
"I utilized the YOLOv5u extra-large variant (yolov5xu.pt) from the YOLOv5 v7.0 release for object detection tasks in my project."
This approach ensures that your documentation is clear, precise, and tracks back to the correct version of the model relevant to your study.
Hope this helps, and all the best with your thesis! 🚀 If there's anything more you need, feel free to ask.