Zum Inhalt springen

Einblicke in die Modellbewertung und Feinabstimmung

Einführung

Nachdem Sie Ihr Computer-Vision-Modell trainiert haben, ist es wichtig, es zu bewerten und zu verfeinern, um eine optimale Leistung zu erzielen. Es reicht nicht aus, nur Ihr Modell zu trainieren. Sie müssen sicherstellen, dass Ihr Modell genau und effizient ist und das Ziel Ihres Computer-Vision-Projekts erfüllt. Durch die Bewertung und Feinabstimmung Ihres Modells können Sie Schwachstellen identifizieren, seine Genauigkeit verbessern und die Gesamtleistung steigern.

In diesem Leitfaden geben wir Einblicke in die Modellbewertung und Feinabstimmung, die diesen Schritt eines Computer-Vision-Projekts zugänglicher machen. Wir besprechen, wie Sie Bewertungsmetriken verstehen und Feinabstimmungstechniken implementieren, um Ihnen das Wissen zu vermitteln, um die Fähigkeiten Ihres Modells zu verbessern.

Auswerten der Modellleistung mithilfe von Metriken

Die Bewertung der Leistung eines Modells hilft uns zu verstehen, wie effektiv es funktioniert. Zur Leistungsmessung werden verschiedene Metriken verwendet. Diese Leistungsmetriken bieten klare, numerische Einblicke, die Verbesserungen ermöglichen können, um sicherzustellen, dass das Modell die beabsichtigten Ziele erreicht. Schauen wir uns einige wichtige Kennzahlen genauer an.

Konfidenz-Score

Der Konfidenzwert stellt die Gewissheit des Modells dar, dass ein erkanntes Objekt zu einer bestimmten Klasse gehört. Sie reicht von 0 bis 1, wobei höhere Werte auf ein höheres Vertrauen hinweisen. Der Konfidenzwert hilft beim Filtern von Vorhersagen. Nur Erkennungen mit Konfidenzwerten über einem bestimmten Schwellenwert werden als gültig angesehen.

Kurzer Tipp: Wenn beim Ausführen von Rückschlüssen keine Vorhersagen angezeigt werden und Sie alles andere überprüft haben, versuchen Sie, die Zuverlässigkeitsbewertung zu verringern. Manchmal ist der Schwellenwert zu hoch, was dazu führt, dass das Modell gültige Vorhersagen ignoriert. Durch das Verringern der Punktzahl kann das Modell mehr Möglichkeiten in Betracht ziehen. Dies entspricht möglicherweise nicht Ihren Projektzielen, aber es ist eine gute Möglichkeit, um zu sehen, was das Modell leisten kann, und zu entscheiden, wie es optimiert werden kann.

Schnittpunkt über Union

Intersection over Union (IoU) is a metric in object detection that measures how well the predicted bounding box overlaps with the ground truth bounding box. IoU values range from 0 to 1, where one stands for a perfect match. IoU is essential because it measures how closely the predicted boundaries match the actual object boundaries.

Intersection over Union Übersicht

Mean Average Precision

Mean Average Precision (mAP) is a way to measure how well an object detection model performs. It looks at the precision of detecting each object class, averages these scores, and gives an overall number that shows how accurately the model can identify and classify objects.

Konzentrieren wir uns auf zwei spezifische mAP-Metriken:

  • mAP@.5: Measures the average precision at a single IoU (Intersection over Union) threshold of 0.5. This metric checks if the model can correctly find objects with a looser accuracy requirement. It focuses on whether the object is roughly in the right place, not needing perfect placement. It helps see if the model is generally good at spotting objects.
  • mAP@.5:.95: Mittelt die mAP-Werte, die bei mehreren IoU-Schwellenwerten berechnet wurden, von 0,5 bis 0,95 in Schritten von 0,05. Diese Metrik ist detaillierter und strenger. Es gibt ein vollständigeres Bild davon, wie genau das Modell Objekte auf verschiedenen Strengegraden finden kann, und ist besonders nützlich für Anwendungen, die eine präzise Objekterkennung erfordern.

Andere mAP-Metriken sind mAP@0.75, die einen strengeren IoU-Schwellenwert von 0,75 verwendet, und mAP@small, medium und large, die die Genauigkeit bei Objekten unterschiedlicher Größe bewerten.

Mittlere durchschnittliche Genauigkeit Übersicht

Evaluating YOLO11 Model Performance

With respect to YOLO11, you can use the validation mode to evaluate the model. Also, be sure to take a look at our guide that goes in-depth into YOLO11 performance metrics and how they can be interpreted.

Häufige Fragen zur Community

When evaluating your YOLO11 model, you might run into a few hiccups. Based on common community questions, here are some tips to help you get the most out of your YOLO11 model:

Umgang mit variablen Bildgrößen

Evaluating your YOLO11 model with images of different sizes can help you understand its performance on diverse datasets. Using the rect=true validation parameter, YOLO11 adjusts the network's stride for each batch based on the image sizes, allowing the model to handle rectangular images without forcing them to a single size.

Die imgsz Validierungsparameter legt die maximale Abmessung für die Bildgrößenänderung fest, die standardmäßig 640 beträgt. Du kannst diesen Wert je nach den maximalen Abmessungen deines Datensatzes und dem verfügbaren GPU Speicherplatz anpassen. Auch bei imgsz Garnitur rect=true ermöglicht es dem Modell, unterschiedliche Bildgrößen effektiv zu verwalten, indem es den Schritt dynamisch anpasst.

Accessing YOLO11 Metrics

If you want to get a deeper understanding of your YOLO11 model's performance, you can easily access specific evaluation metrics with a few lines of Python code. The code snippet below will let you load your model, run an evaluation, and print out various metrics that show how well your model is doing.

Verwendung

from ultralytics import YOLO

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

# Run the evaluation
results = model.val(data="coco8.yaml")

# Print specific metrics
print("Class indices with average precision:", results.ap_class_index)
print("Average precision for all classes:", results.box.all_ap)
print("Average precision:", results.box.ap)
print("Average precision at IoU=0.50:", results.box.ap50)
print("Class indices for average precision:", results.box.ap_class_index)
print("Class-specific results:", results.box.class_result)
print("F1 score:", results.box.f1)
print("F1 score curve:", results.box.f1_curve)
print("Overall fitness score:", results.box.fitness)
print("Mean average precision:", results.box.map)
print("Mean average precision at IoU=0.50:", results.box.map50)
print("Mean average precision at IoU=0.75:", results.box.map75)
print("Mean average precision for different IoU thresholds:", results.box.maps)
print("Mean results for different metrics:", results.box.mean_results)
print("Mean precision:", results.box.mp)
print("Mean recall:", results.box.mr)
print("Precision:", results.box.p)
print("Precision curve:", results.box.p_curve)
print("Precision values:", results.box.prec_values)
print("Specific precision metrics:", results.box.px)
print("Recall:", results.box.r)
print("Recall curve:", results.box.r_curve)

The results object also includes speed metrics like preprocess time, inference time, loss, and postprocess time. By analyzing these metrics, you can fine-tune and optimize your YOLO11 model for better performance, making it more effective for your specific use case.

Wie funktioniert die Feinabstimmung?

Bei der Feinabstimmung wird ein vortrainiertes Modell verwendet und seine Parameter angepasst, um die Leistung bei einer bestimmten Aufgabe oder einem bestimmten Datensatz zu verbessern. Der Prozess, der auch als Modell-Retraining bezeichnet wird, ermöglicht es dem Modell, die Ergebnisse für die spezifischen Daten, auf die es in realen Anwendungen stoßen wird, besser zu verstehen und vorherzusagen. Sie können Ihr Modell basierend auf Ihrer Modellauswertung neu trainieren, um optimale Ergebnisse zu erzielen.

Tipps zur Feinabstimmung Ihres Modells

Die Feinabstimmung eines Modells bedeutet, dass mehrere wichtige Parameter und Techniken genau beachtet werden, um eine optimale Leistung zu erzielen. Hier sind einige wichtige Tipps, die Sie durch den Prozess führen.

Starting With a Higher Learning Rate

Usually, during the initial training epochs, the learning rate starts low and gradually increases to stabilize the training process. However, since your model has already learned some features from the previous dataset, starting with a higher learning rate right away can be more beneficial.

When evaluating your YOLO11 model, you can set the warmup_epochs Validierungsparameter auf warmup_epochs=0 um zu verhindern, dass die Lernrate zu hoch beginnt. Wenn Sie diesem Prozess folgen, wird das Training von den bereitgestellten Gewichten aus fortgesetzt und an die Nuancen Ihrer neuen Daten angepasst.

Bildkachelung für kleine Objekte

Image tiling can improve detection accuracy for small objects. By dividing larger images into smaller segments, such as splitting 1280x1280 images into multiple 640x640 segments, you maintain the original resolution, and the model can learn from high-resolution fragments. When using YOLO11, make sure to adjust your labels for these new segments correctly.

Engagieren Sie sich in der Community

Sharing your ideas and questions with other computer vision enthusiasts can inspire creative solutions to roadblocks in your projects. Here are some excellent ways to learn, troubleshoot, and connect.

Hilfe und Unterstützung finden

  • GitHub Issues: Explore the YOLO11 GitHub repository and use the Issues tab to ask questions, report bugs, and suggest features. The community and maintainers are available to assist with any issues you encounter.
  • Ultralytics Discord-Server: Treten Sie dem Ultralytics Discord-Server , um sich mit anderen Benutzern und Entwicklern zu verbinden, Unterstützung zu erhalten, Wissen auszutauschen und Ideen zu sammeln.

Offizielle Dokumentation

  • Ultralytics YOLO11 Documentation: Check out the official YOLO11 documentation for comprehensive guides and valuable insights on various computer vision tasks and projects.

Abschließende Gedanken

Evaluating and fine-tuning your computer vision model are important steps for successful model deployment. These steps help make sure that your model is accurate, efficient, and suited to your overall application. The key to training the best model possible is continuous experimentation and learning. Don't hesitate to tweak parameters, try new techniques, and explore different datasets. Keep experimenting and pushing the boundaries of what's possible!

FAQ

What are the key metrics for evaluating YOLO11 model performance?

To evaluate YOLO11 model performance, important metrics include Confidence Score, Intersection over Union (IoU), and Mean Average Precision (mAP). Confidence Score measures the model's certainty for each detected object class. IoU evaluates how well the predicted bounding box overlaps with the ground truth. Mean Average Precision (mAP) aggregates precision scores across classes, with mAP@.5 and mAP@.5:.95 being two common types for varying IoU thresholds. Learn more about these metrics in our YOLO11 performance metrics guide.

How can I fine-tune a pre-trained YOLO11 model for my specific dataset?

Fine-tuning a pre-trained YOLO11 model involves adjusting its parameters to improve performance on a specific task or dataset. Start by evaluating your model using metrics, then set a higher initial learning rate by adjusting the warmup_epochs Parameter auf 0, um sofortige Stabilität zu erreichen. Verwende Parameter wie rect=true für den effektiven Umgang mit unterschiedlichen Bildgrößen. Ausführlichere Anleitungen findest du in unserem Abschnitt über fine-tuning YOLO11 models.

How can I handle variable image sizes when evaluating my YOLO11 model?

Um mit variablen Bildgrößen während der Auswertung umzugehen, verwendest du die rect=true parameter in YOLO11, which adjusts the network's stride for each batch based on image sizes. The imgsz legt die maximale Größe für die Bildanpassung fest, die standardmäßig 640 beträgt. anpassen imgsz für deinen Datensatz und GPU Speicher. Für weitere Details besuche unsere Abschnitt über den Umgang mit variablen Bildgrößen.

What practical steps can I take to improve mean average precision for my YOLO11 model?

Improving mean average precision (mAP) for a YOLO11 model involves several steps:

  1. Tuning Hyperparameters: Experiment with different learning rates, batch sizes, and image augmentations.
  2. Data Augmentation: Use techniques like Mosaic and MixUp to create diverse training samples.
  3. Image Tiling: Split larger images into smaller tiles to improve detection accuracy for small objects. Refer to our detailed guide on model fine-tuning for specific strategies.

How do I access YOLO11 model evaluation metrics in Python?

You can access YOLO11 model evaluation metrics using Python with the following steps:

Verwendung

from ultralytics import YOLO

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

# Run the evaluation
results = model.val(data="coco8.yaml")

# Print specific metrics
print("Class indices with average precision:", results.ap_class_index)
print("Average precision for all classes:", results.box.all_ap)
print("Mean average precision at IoU=0.50:", results.box.map50)
print("Mean recall:", results.box.mr)

Analyzing these metrics helps fine-tune and optimize your YOLO11 model. For a deeper dive, check out our guide on YOLO11 metrics.

📅 Created 3 months ago ✏️ Updated 22 days ago

Kommentare