انتقل إلى المحتوى

رؤى حول تقييم النموذج وضبطه

مقدمة

بمجرد أن تقوم بتدريب نموذج الرؤية الحاسوبية الخاص بك، فإن تقييمه وتنقيحه لتحقيق الأداء الأمثل أمر ضروري. مجرد تدريب نموذجك لا يكفي. تحتاج إلى التأكد من أن نموذجك دقيق وفعال ويحقق الهدف من مشروع الرؤية الحاسوبية الخاص بك. من خلال تقييم نموذجك وصقله، يمكنك تحديد نقاط الضعف وتحسين دقته وتعزيز الأداء العام.

في هذا الدليل، سنشارك رؤى حول تقييم النموذج والضبط الدقيق الذي سيجعل هذه الخطوة من مشروع الرؤية الحاسوبية أكثر سهولة. سنناقش كيفية فهم مقاييس التقييم وتنفيذ تقنيات الضبط الدقيق، مما يمنحك المعرفة اللازمة لرفع قدرات نموذجك.

تقييم أداء النموذج باستخدام المقاييس

يساعدنا تقييم مدى جودة أداء النموذج على فهم مدى فعاليته. تُستخدم مقاييس مختلفة لقياس الأداء. توفر مقاييس الأداء هذه رؤى رقمية واضحة يمكن أن توجه التحسينات نحو التأكد من أن النموذج يحقق الأهداف المرجوة منه. دعنا نلقي نظرة فاحصة على بعض المقاييس الرئيسية.

درجة الثقة

تمثل درجة الثقة يقين النموذج بأن الكائن المكتشف ينتمي إلى فئة معينة. يتراوح من 0 إلى 1 ، مع درجات أعلى تشير إلى ثقة أكبر. تساعد درجة الثقة في تصفية التنبؤات. تعتبر فقط الاكتشافات ذات درجات الثقة أعلى من عتبة محددة صالحة.

نصيحة سريعة: عند تشغيل الاستدلالات، إذا كنت لا ترى أي تنبؤات وكنت قد تحققت من كل شيء آخر، حاول خفض درجة الثقة. في بعض الأحيان، تكون العتبة عالية جدًا، مما يتسبب في تجاهل النموذج للتنبؤات الصحيحة. يسمح خفض الدرجة للنموذج بالنظر في المزيد من الاحتمالات. قد لا يفي هذا بأهداف مشروعك، لكنها طريقة جيدة لمعرفة ما يمكن أن يفعله النموذج وتحديد كيفية ضبطه.

التقاطع فوق الاتحاد

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.

نظرة عامة على التقاطع على الاتحاد

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.

دعنا نركز على مقياسين محددين ل mAP:

  • 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: متوسطات قيم mAP المحسوبة عند عتبات IoU متعددة، من 0.5 إلى 0.95 بزيادات قدرها 0.05. هذا المقياس أكثر تفصيلاً وصرامة. وهو يعطي صورة أكمل عن مدى دقة النموذج في العثور على الأجسام عند مستويات مختلفة من الدقة، وهو مفيد بشكل خاص للتطبيقات التي تحتاج إلى اكتشاف دقيق للأجسام.

تشمل مقاييس mAP الأخرى mAP@0.75، والتي تستخدم عتبة أكثر صرامة لوحدة قياس IoU تبلغ 0.75، و mAP@ الصغير والمتوسط والكبير، والتي تقيّم الدقة عبر كائنات ذات أحجام مختلفة.

نظرة عامة على متوسط الدقة المتوسطة

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.

أسئلة المجتمع الشائعة

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:

التعامل مع أحجام الصور المتغيرة

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.

ال imgsz تحدد معلمة التحقق من الصحة الحد الأقصى لأبعاد تغيير حجم الصورة، وهو 640 بشكل افتراضي. يمكنك ضبط ذلك بناءً على الأبعاد القصوى لمجموعة البيانات الخاصة بك والذاكرة GPU المتاحة. حتى مع imgsz جبر rect=true يتيح للنموذج إدارة أحجام الصور المختلفة بشكل فعال عن طريق ضبط الخطوة ديناميكيا.

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.

استخدام

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.

كيف يعمل الضبط الدقيق؟

يتضمن الضبط الدقيق أخذ نموذج مدرب مسبقا وتعديل معلماته لتحسين الأداء في مهمة أو مجموعة بيانات محددة. تسمح العملية ، المعروفة أيضا باسم إعادة تدريب النموذج ، للنموذج بفهم النتائج والتنبؤ بها بشكل أفضل للبيانات المحددة التي سيواجهها في تطبيقات العالم الحقيقي. يمكنك إعادة تدريب نموذجك بناء على تقييم النموذج الخاص بك لتحقيق أفضل النتائج.

نصائح لضبط النموذج الخاص بك

يعني الضبط الدقيق للنموذج إيلاء اهتمام وثيق للعديد من المعلمات والتقنيات الحيوية لتحقيق الأداء الأمثل. فيما يلي بعض النصائح الأساسية لإرشادك خلال العملية.

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 معلمة التحقق من الصحة إلى warmup_epochs=0 لمنع معدل التعلم من البدء بشكل مرتفع للغاية. باتباع هذه العملية ، سيستمر التدريب من الأوزان المقدمة ، مع التكيف مع الفروق الدقيقة في بياناتك الجديدة.

تبليط الصور للكائنات الصغيرة

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.

الانخراط مع المجتمع

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.

العثور على المساعدة والدعم

  • 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 خادم ديسكورد: انضم إلى خادم Ultralytics Discord Server للتواصل مع المستخدمين والمطورين الآخرين والحصول على الدعم ومشاركة المعرفة وتبادل الأفكار وتبادل الأفكار.

الوثائق الرسمية

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

افكار اخيرة

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!

الأسئلة المتداولة

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 إلى 0 للاستقرار الفوري. استخدم معلمات مثل rect=true للتعامل مع أحجام الصور المتنوعة بفعالية. لمزيد من الإرشادات التفصيلية، راجع القسم الخاص بنا عن fine-tuning YOLO11 models.

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

للتعامل مع أحجام الصور المتغيرة أثناء التقييم، استخدم الدالة rect=true parameter in YOLO11, which adjusts the network's stride for each batch based on image sizes. The imgsz تُعيِّن المعلمة الحد الأقصى للبُعد الأقصى لتغيير حجم الصورة، ويكون افتراضيًا 640. ضبط imgsz لتتناسب مع مجموعة بياناتك وذاكرة GPU . لمزيد من التفاصيل، تفضل بزيارة قسم التعامل مع أحجام الصور المتغيرة.

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:

استخدام

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

التعليقات