Vai al contenuto

Approfondimenti sulla valutazione e la messa a punto del modello

Introduzione

Una volta addestrato il modello di computer vision, è essenziale valutarlo e perfezionarlo per ottenere prestazioni ottimali. Il solo addestramento del modello non è sufficiente. Devi assicurarti che il tuo modello sia accurato, efficiente e che raggiunga l'obiettivo del tuo progetto di computer vision. Valutando e perfezionando il tuo modello, puoi identificare i punti deboli, migliorarne l'accuratezza e aumentare le prestazioni complessive.

In questa guida, condivideremo le informazioni sulla valutazione e la messa a punto del modello che renderanno questa fase del progetto di computer vision più accessibile. Parleremo di come comprendere le metriche di valutazione e implementare le tecniche di messa a punto, fornendoti le conoscenze necessarie per migliorare le capacità del tuo modello.

Valutazione delle prestazioni del modello tramite le metriche

Valutare le prestazioni di un modello ci aiuta a capire quanto sia efficace il suo funzionamento. Per misurare le prestazioni vengono utilizzate diverse metriche. Queste metriche forniscono informazioni chiare e numeriche che possono guidare i miglioramenti per garantire che il modello raggiunga gli obiettivi prefissati. Diamo un'occhiata più da vicino ad alcune metriche chiave.

Punteggio di confidenza

Il punteggio di attendibilità rappresenta la certezza del modello che un oggetto rilevato appartenga a una determinata classe. Va da 0 a 1, con punteggi più alti che indicano una maggiore sicurezza. Il punteggio di attendibilità consente di filtrare le previsioni; Solo i rilevamenti con punteggi di attendibilità superiori a una soglia specificata sono considerati validi.

Suggerimento rapido: Quando esegui le inferenze, se non vedi alcuna previsione e hai controllato tutto il resto, prova a diminuire il punteggio di confidenza. A volte la soglia è troppo alta e il modello ignora le previsioni valide. Abbassare il punteggio permette al modello di considerare più possibilità. Questo potrebbe non soddisfare gli obiettivi del tuo progetto, ma è un buon modo per vedere cosa può fare il modello e decidere come perfezionarlo.

Intersezione sopra l'Unione

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.

Intersezione con Union Panoramica

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.

Concentriamoci su due metriche mAP specifiche:

  • 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: Calcola la media dei valori di mAP calcolati a diverse soglie IoU, da 0,5 a 0,95 in incrementi di 0,05. Questa metrica è più dettagliata e rigorosa. Fornisce un quadro più completo dell'accuratezza con cui il modello è in grado di trovare gli oggetti a diversi livelli di severità ed è particolarmente utile per le applicazioni che richiedono un rilevamento preciso degli oggetti.

Altre metriche mAP includono mAP@0.75, che utilizza una soglia IoU più rigida di 0,75, e mAP@small, medium e large, che valutano la precisione di oggetti di dimensioni diverse.

Media Media Precisione Panoramica

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.

Domande comuni della 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:

Gestione di immagini di dimensioni variabili

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.

Il imgsz Il parametro di convalida imposta la dimensione massima per il ridimensionamento dell'immagine, che è 640 per impostazione predefinita. Puoi regolare questo valore in base alle dimensioni massime del tuo set di dati e alla memoria disponibile su GPU . Anche con imgsz mettere rect=true Consente al modello di gestire in modo efficace le diverse dimensioni dell'immagine regolando dinamicamente la falcata.

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.

Utilizzo

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.

Come funziona la messa a punto?

L'ottimizzazione comporta l'acquisizione di un modello pre-addestrato e la regolazione dei suoi parametri per migliorare le prestazioni su un'attività o un set di dati specifico. Il processo, noto anche come riaddestramento del modello, consente al modello di comprendere e prevedere meglio i risultati per i dati specifici che incontrerà nelle applicazioni del mondo reale. È possibile ripetere il training del modello in base alla valutazione del modello per ottenere risultati ottimali.

Suggerimenti per la messa a punto del modello

Mettere a punto un modello significa prestare molta attenzione a diversi parametri e tecniche vitali per ottenere prestazioni ottimali. Ecco alcuni suggerimenti essenziali per guidarti attraverso il processo.

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 parametro di convalida a warmup_epochs=0 per evitare che il tasso di apprendimento inizi troppo alto. Seguendo questo processo, l'allenamento continuerà dai pesi forniti, adattandosi alle sfumature dei tuoi nuovi dati.

Affiancamento di immagini per oggetti di piccole dimensioni

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.

Interagisci con la 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.

Trovare aiuto e supporto

  • 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 Server Discord: Unisciti al server Discord diUltralytics per connetterti con altri utenti e sviluppatori, ricevere supporto, condividere conoscenze e fare brainstorming di idee.

Documentazione ufficiale

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

Considerazioni finali

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!

DOMANDE FREQUENTI

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 a 0 per ottenere una stabilità immediata. Usa parametri come rect=true per gestire efficacemente immagini di dimensioni diverse. Per una guida più dettagliata, consulta la nostra sezione su fine-tuning YOLO11 models.

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

Per gestire le dimensioni variabili delle immagini durante la valutazione, usa l'opzione rect=true parameter in YOLO11, which adjusts the network's stride for each batch based on image sizes. The imgsz imposta la dimensione massima per il ridimensionamento dell'immagine, per default 640. Regola imgsz per adattarsi al tuo set di dati e alla memoria di GPU . Per maggiori dettagli, visita il nostro sito sezione sulla gestione di immagini di dimensioni variabili.

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:

Utilizzo

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

Commenti