نظرة عامة على مجموعات بيانات كشف الكائنات
يتطلب تدريب نموذج متين ودقيق لـكشف الكائنات مجموعة بيانات شاملة. يقدم هذا الدليل تنسيقات مختلفة لمجموعات البيانات المتوافقة مع نموذج Ultralytics YOLO، ويعرض معلومات عن بنيتها واستخدامها وكيفية التحويل بين التنسيقات المختلفة.
تنسيقات مجموعات البيانات المدعومة#
تنسيق Ultralytics YOLO#
تنسيق Ultralytics YOLO هو تنسيق إعداد لمجموعة البيانات يتيح لك تحديد الدليل الجذر لمجموعة البيانات، والمسارات النسبية إلى أدلة صور التدريب/التحقق/الاختبار أو ملفات *.txt التي تحتوي على مسارات الصور، وقاموسًا بأسماء الفئات. إليك مثالًا:
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
# COCO8 dataset (first 8 images from COCO train2017) by Ultralytics
# Documentation: https://docs.ultralytics.com/datasets/detect/coco8
# Example usage: yolo train data=coco8.yaml
# parent
# ├── ultralytics
# └── datasets
# └── coco8 ← downloads here (1 MB)
# Train/val/test sets as 1) dir: path/to/imgs, 2) file: path/to/imgs.txt, or 3) list: [path/to/imgs1, path/to/imgs2, ..]
path: coco8 # dataset root dir
train: images/train # train images (relative to 'path') 4 images
val: images/val # val images (relative to 'path') 4 images
test: # test images (optional)
# Classes
names:
0: person
1: bicycle
2: car
3: motorcycle
4: airplane
5: bus
6: train
7: truck
8: boat
9: traffic light
10: fire hydrant
11: stop sign
12: parking meter
13: bench
14: bird
15: cat
16: dog
17: horse
18: sheep
19: cow
20: elephant
21: bear
22: zebra
23: giraffe
24: backpack
25: umbrella
26: handbag
27: tie
28: suitcase
29: frisbee
30: skis
31: snowboard
32: sports ball
33: kite
34: baseball bat
35: baseball glove
36: skateboard
37: surfboard
38: tennis racket
39: bottle
40: wine glass
41: cup
42: fork
43: knife
44: spoon
45: bowl
46: banana
47: apple
48: sandwich
49: orange
50: broccoli
51: carrot
52: hot dog
53: pizza
54: donut
55: cake
56: chair
57: couch
58: potted plant
59: bed
60: dining table
61: toilet
62: tv
63: laptop
64: mouse
65: remote
66: keyboard
67: cell phone
68: microwave
69: oven
70: toaster
71: sink
72: refrigerator
73: book
74: clock
75: vase
76: scissors
77: teddy bear
78: hair drier
79: toothbrush
# Download script/URL (optional)
download: https://github.com/ultralytics/assets/releases/download/v0.0.0/coco8.zipيقبل كل من train وval وtest دليلاً أو ملف صورة أو قائمة من الأدلة أو ملفات الصور أو ملف *.txt بترميز UTF-8 يسرد مسار صورة واحداً في كل سطر (تُحل المسارات التي تبدأ بـ ./ نسبةً إلى الملف *.txt). يفيد ملف *.txt في التدريب على مجموعة فرعية من دليل، أو تخطي الصور غير الموسومة، أو جمع الصور من مصادر متعددة في تقسيم واحد.
path: datasets/coco8 # dataset root
train: train.txt # a directory, an image, a list e.g. [images/a, images/b], or a *.txt file
val: val.txt
names:
0: person(اختياري) يعيّن colors لكل فئة لون عرض على هيئة سلسلة "#rrggbb" مقتبسة ومفهرسة حسب معرّف الفئة، مثل colors: ["#042aff", "#ff0000"]. تحتفظ النماذج المدرَّبة والمصدَّرة بهذه الألوان لتنبؤاتها؛ أما الفئات التي لا تملك لونًا فتستخدم لوحة الألوان الافتراضية. ويمكن لسجل مجموعة بيانات NDJSON أن يتضمن الحقل نفسه colors.
ينبغي تصدير التسميات بهذا التنسيق إلى تنسيق YOLO، مع ملف *.txt واحد لكل صورة. إذا لم تتضمن الصورة أي كائنات، فلا يلزم توفير ملف *.txt. ينبغي تنسيق ملف *.txt بحيث يحتوي على صف واحد لكل كائن بتنسيق class x_center y_center width height. يجب أن تكون إحداثيات مربع الإحاطة بتنسيق normalized xywh (من 0 إلى 1). إذا كانت مربعاتك محددة بالبكسل، فقسّم x_center وwidth على عرض الصورة، وy_center وheight على ارتفاعها. تشير الإحداثيات إلى الصورة كما يعرضها المشاهدون، بعد تطبيق اتجاه EXIF عليها، وهو الأسلوب الذي تستخدمه Ultralytics لقراءة كل صورة. ينبغي أن تكون أرقام الفئات مفهرسة ابتداءً من الصفر (تبدأ من 0).

يحتوي ملف التسمية المقابل للصورة أعلاه على شخصين (الفئة 0) وربطة عنق (الفئة 27):

عند استخدام تنسيق Ultralytics YOLO، نظّم صور التدريب والتحقق وتسمياتها كما هو موضح في المثال أدناه من مجموعة بيانات COCO8.

مثال على الاستخدام#
إليك كيفية استخدام مجموعات البيانات بتنسيق YOLO لتدريب نموذجك:
from ultralytics import YOLO
# تحميل نموذج
model = YOLO("yolo26n.pt") # تحميل نموذج مدرّب مسبقًا (موصى به للتدريب)
# تدريب النموذج
results = model.train(data="coco8.yaml", epochs=100, imgsz=640)تنسيق Ultralytics NDJSON#
يوفر تنسيق NDJSON (JSON المحدد بفواصل الأسطر) طريقة بديلة لتعريف مجموعات البيانات لنماذج Ultralytics YOLO. يخزن هذا التنسيق بيانات مجموعة البيانات الوصفية والتعليقات التوضيحية في ملف واحد، بحيث يحتوي كل سطر على كائن JSON منفصل.
يحتوي ملف مجموعة بيانات NDJSON على:
- سجل مجموعة البيانات (السطر الأول): يحتوي على البيانات الوصفية لمجموعة البيانات، بما في ذلك نوع المهمة وأسماء الفئات والمعلومات العامة
- سجلات الصور (الأسطر اللاحقة): تحتوي على بيانات كل صورة على حدة، بما في ذلك الأبعاد والتعليقات التوضيحية ومسارات الملفات
{
"type": "dataset",
"task": "detect",
"name": "Example",
"description": "COCO NDJSON example dataset",
"url": "https://platform.ultralytics.com/user/datasets/example",
"class_names": { "0": "person", "1": "bicycle", "2": "car" },
"bytes": 426342,
"version": 0,
"created_at": "2024-01-01T00:00:00Z",
"updated_at": "2025-01-01T00:00:00Z"
}بيانات وصفية مخصصة للصور#
قد يتضمن كل سجل صورة كائن JSON باسم metadata لتوفير سياق خاص بالتطبيق، مثل ظروف الالتقاط أو معرّفات المعدات أو حالة المراجعة. وتُدعم القيم المتداخلة. عند الاستيراد إلى منصة Ultralytics، تُخزّن البيانات الوصفية مع الصورة ويمكن عرضها أو تحريرها من لوحة المعلومات بملء الشاشة.
{
"type": "image",
"file": "airbus-wing.jpg",
"url": "https://example.com/airbus-wing.jpg",
"split": "train",
"metadata": {
"aircraft": { "family": "A350", "section": "wing" },
"inspectionStatus": "reviewed"
}
}تحدد المنصة الحد الأقصى لمفاتيح البيانات الوصفية ذات المستوى الأعلى بـ128 حرفًا، وللكائن المتسلسل للبيانات الوصفية لكل صورة بـ500,000 حرف، ولإجمالي البيانات الوصفية الفعالة في عملية استيراد NDJSON واحدة بـ500,000 حرف.
مثال على الاستخدام#
لاستخدام مجموعة بيانات NDJSON مع YOLO26، حدّد ببساطة مسار ملف .ndjson:
from ultralytics import YOLO
# تحميل نموذج
model = YOLO("yolo26n.pt")
# التدريب باستخدام مجموعة بيانات NDJSON
results = model.train(data="path/to/dataset.ndjson", epochs=100, imgsz=640)مزايا تنسيق NDJSON#
- ملف واحد: تُحفظ جميع معلومات مجموعة البيانات في ملف واحد
- المعالجة المتدفقة: يمكن معالجة مجموعات البيانات الكبيرة سطرًا بسطر دون تحميلها بالكامل إلى الذاكرة
- التكامل السحابي: يدعم عناوين URL للصور البعيدة من أجل التدريب السحابي
- قابلية التوسعة: يسهل إضافة حقول بيانات وصفية مخصصة
- التحكم في الإصدارات: يعمل تنسيق الملف الواحد جيدًا مع git وأنظمة التحكم في الإصدارات
مجموعات البيانات المدعومة#
فيما يلي قائمة بمجموعات البيانات المدعومة ووصف موجز لكل منها. وتُستضاف معظم هذه المجموعات أيضًا على منصة Ultralytics، حيث يمكنك تصفح الصور والتعليقات التوضيحية، وعرض إحصاءات مجموعة البيانات، واستنساخها للتدريب السحابي.
- African-wildlife: مجموعة بيانات تضم صورًا للحياة البرية الأفريقية، بما فيها الجاموس والفيل ووحيد القرن والحمار الوحشي.
- Argoverse: مجموعة بيانات Argoverse-HD لكشف الكائنات ثنائية الأبعاد، تضم 54,446 صورة للقيادة الذاتية في المناطق الحضرية عبر 8 فئات من كائنات الطريق.
- أورام الدماغ: مجموعة بيانات لاكتشاف أورام الدماغ في صور التصوير بالرنين المغناطيسي للدماغ، موسومة بصناديق إحاطة للأورام ضمن فئة واحدة.
- COCO: مجموعة بيانات الأجسام الشائعة في السياقات (COCO) واسعة النطاق، مخصصة لاكتشاف الأجسام وتجزئتها وإنشاء التسميات التوضيحية، وتضم 80 فئة من الأجسام.
- COCO8: مجموعة فرعية أصغر تضم أول 8 صور من COCO train2017، منها 4 للتدريب و4 للتحقق، وهي مناسبة للاختبارات السريعة.
- COCO8-Grayscale: إصدار بتدرج الرمادي من COCO8 أُنشئ بتحويل RGB إلى تدرج الرمادي، وهو مفيد لتقييم النماذج أحادية القناة.
- COCO8-Multispectral: إصدار متعدد الأطياف من COCO8 ذي 10 قنوات، أُنشئ بالاستيفاء بين أطوال موجات RGB، وهو مفيد لتقييم النماذج المراعية للطيف.
- COCO12-Formats: مجموعة بيانات اختبار تضم 12 صورة تغطي 12 تنسيقًا مدعومًا للصور (AVIF وBMP وDNG وHEIC وJP2 وJPEG وJPG وMPO وPNG وTIF وTIFF وWebP) للتحقق من مسارات تحميل الصور.
- COCO16: مجموعة فرعية من أول 16 صورة من COCO train2017 (8 للتدريب و8 للتحقق)، مناسبة للاختبارات السريعة.
- COCO32: مجموعة فرعية من أول 32 صورة من COCO train2017 (16 للتدريب و16 للتحقق)، مناسبة للاختبارات السريعة.
- COCO64: مجموعة فرعية من أول 64 صورة من COCO train2017 (32 للتدريب و32 للتحقق)، مناسبة للاختبارات السريعة.
- COCO128: مجموعة فرعية أصغر تضم أول 128 صورة من COCO train2017، وهي مناسبة للاختبارات.
- Construction-PPE: مجموعة بيانات تضم عمال مواقع البناء مع معدات السلامة الموسومة، مثل الخوذ والسترات والقفازات والأحذية والنظارات الواقية، بما في ذلك تعليقات توضيحية عن المعدات المفقودة مثل no_helmet وno_goggle لمراقبة الامتثال في العالم الحقيقي.
- Global Wheat 2020: مجموعة بيانات تتضمن صورًا لسنابل القمح، أُعدّت لتحدي القمح العالمي لعام 2020.
- HomeObjects-3K: مجموعة بيانات للأغراض المنزلية الداخلية، بما في ذلك الأسرّة والكراسي وأجهزة التلفاز وغيرها؛ وهي مثالية لتطبيقات أتمتة المنازل الذكية والروبوتات والواقع المعزز وتحليل تخطيط الغرف.
- KITTI: مجموعة بيانات تعرض مشاهد قيادة واقعية مع بيانات مجسمة وLiDAR وGPS/IMU، وتُستخدم هنا لمهام كشف الكائنات ثنائية الأبعاد، مثل تحديد السيارات والمشاة وراكبي الدراجات في البيئات الحضرية والريفية وعلى الطرق السريعة.
- LVIS: مجموعة بيانات واسعة النطاق لاكتشاف الأجسام وتجزئة المثيلات، تضم 1,203 فئة من الأجسام.
- Medical-pills: مجموعة بيانات تضم صورًا للأقراص الطبية، مع تعليقات توضيحية لتطبيقات مثل ضمان جودة المستحضرات الصيدلانية وفرز الأقراص والامتثال التنظيمي.
- Objects365: مجموعة بيانات عالية الجودة وواسعة النطاق لكشف الكائنات، تضم 365 فئة من الكائنات وأكثر من 1.7 مليون صورة تدريب.
- OpenImagesV7: مجموعة بيانات شاملة من Google تضم 1.7 مليون صورة تدريب و42 ألف صورة تحقق.
- Roboflow 100: معيار متنوع لاكتشاف الكائنات يضم 100 مجموعة بيانات تغطي سبعة مجالات تصوير لتقييم النماذج تقييمًا شاملًا.
- Signature: مجموعة بيانات تضم صورًا لوثائق متنوعة مع توقيعات موضّح عليها، وتدعم أبحاث التحقق من الوثائق واكتشاف الاحتيال.
- SKU-110K: مجموعة بيانات للكشف الكثيف عن الأجسام في بيئات البيع بالتجزئة، تضم أكثر من 11 ألف صورة و1.7 مليون مربع إحاطة.
- TT100K: مجموعة بيانات إشارات المرور Tsinghua-Tencent 100K (TT100K)، تضم 16,817 صورة لمناظر شوارع موزعة على 221 فئة من الإشارات، لمهمتي الكشف والتصنيف.
- معيار Ultralytics: مجموعة معايير مرجعية رسمية تضم 37 مجموعة بيانات منتقاة للكشف في مجالات الطب والتصوير الجوي والصناعة والتجزئة وغيرها، مع بروتوكول ثابت لقياس قدرة النماذج على التعميم في العالم الحقيقي.
- VisDrone: مجموعة بيانات تتضمن بيانات اكتشاف الأجسام وتتبع الأجسام المتعددة في صور التقطتها طائرات مسيّرة، وتضم أكثر من 10 آلاف صورة ومقاطع فيديو.
- VOC: مجموعة بيانات Pascal Visual Object Classes (VOC) لاكتشاف الكائنات وتقسيمها، وتضم 20 فئة من الكائنات وأكثر من 11 ألف صورة.
- xView: مجموعة بيانات لاكتشاف الأجسام في الصور الملتقطة من الأعلى، تضم 60 فئة من الأجسام وأكثر من مليون جسم مشروح.
إضافة مجموعة البيانات الخاصة بك#
إذا كانت لديك مجموعة بيانات خاصة بك وترغب في استخدامها لتدريب نماذج الكشف بتنسيق Ultralytics YOLO، فتأكد من توافقها مع التنسيق الموضح أعلاه ضمن «تنسيق Ultralytics YOLO». حوّل التعليقات التوضيحية إلى التنسيق المطلوب، وحدد المسارات وعدد الفئات وأسماءها في ملف إعداد YAML.
نقل تنسيقات التسميات أو تحويلها#
تحويل تنسيق مجموعة بيانات COCO إلى تنسيق YOLO#
يمكنك تحويل التسميات من تنسيق مجموعة بيانات COCO الشائعة إلى تنسيق YOLO باستخدام مقتطف الشيفرة التالي:
from ultralytics.data.converter import convert_coco
convert_coco(labels_dir="path/to/coco/annotations/")يمكن استخدام أداة التحويل هذه لتحويل مجموعة بيانات COCO أو أي مجموعة بيانات بتنسيق COCO إلى تنسيق Ultralytics YOLO. تحوّل العملية التعليقات التوضيحية لـ COCO المستندة إلى JSON إلى تنسيق YOLO الأبسط المستند إلى النص، ما يجعله متوافقًا مع نماذج Ultralytics YOLO. للاطلاع على سير العمل الكامل — بما في ذلك تعيين معرّفات الفئات وتخطيط المجلدات والتعليقات التوضيحية للتقسيم أو الوضعية — راجع تحويل تعليقات COCO التوضيحية إلى YOLO.
تذكّر التحقق جيدًا من توافق مجموعة البيانات التي تريد استخدامها مع نموذجك واتباعها قواعد التنسيق المطلوبة. فتنسيق مجموعات البيانات على النحو الصحيح ضروري لتدريب نماذج ناجحة لاكتشاف الكائنات.
ما الخطوة التالية؟#
بعد تنسيق مجموعة البيانات، ابدأ تدريب نموذجك. ألست متأكدًا من النموذج المدرّب مسبقًا الذي ينبغي البدء به؟ قارن الخيارات ضمن عائلة نماذج YOLO26.
الأسئلة الشائعة#
تنسيق Ultralytics YOLO هو إعداد منظّم لتعريف مجموعات البيانات في مشاريع التدريب. ويتضمن تحديد مسارات صور التدريب والتحقق والاختبار والتسميات المقابلة لها. على سبيل المثال:
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license # COCO8 dataset (first 8 images from COCO train2017) by Ultralytics # Documentation: https://docs.ultralytics.com/datasets/detect/coco8 # Example usage: yolo train data=coco8.yaml # parent # ├── ultralytics # └── datasets # └── coco8 ← downloads here (1 MB) # Train/val/test sets as 1) dir: path/to/imgs, 2) file: path/to/imgs.txt, or 3) list: [path/to/imgs1, path/to/imgs2, ..] path: coco8 # dataset root dir train: images/train # train images (relative to 'path') 4 images val: images/val # val images (relative to 'path') 4 images test: # test images (optional) # Classes names: 0: person 1: bicycle 2: car 3: motorcycle 4: airplane 5: bus 6: train 7: truck 8: boat 9: traffic light 10: fire hydrant 11: stop sign 12: parking meter 13: bench 14: bird 15: cat 16: dog 17: horse 18: sheep 19: cow 20: elephant 21: bear 22: zebra 23: giraffe 24: backpack 25: umbrella 26: handbag 27: tie 28: suitcase 29: frisbee 30: skis 31: snowboard 32: sports ball 33: kite 34: baseball bat 35: baseball glove 36: skateboard 37: surfboard 38: tennis racket 39: bottle 40: wine glass 41: cup 42: fork 43: knife 44: spoon 45: bowl 46: banana 47: apple 48: sandwich 49: orange 50: broccoli 51: carrot 52: hot dog 53: pizza 54: donut 55: cake 56: chair 57: couch 58: potted plant 59: bed 60: dining table 61: toilet 62: tv 63: laptop 64: mouse 65: remote 66: keyboard 67: cell phone 68: microwave 69: oven 70: toaster 71: sink 72: refrigerator 73: book 74: clock 75: vase 76: scissors 77: teddy bear 78: hair drier 79: toothbrush # Download script/URL (optional) download: https://github.com/ultralytics/assets/releases/download/v0.0.0/coco8.zipتُحفظ التسميات في ملفات
*.txt، بملف واحد لكل صورة، وتُنسّق على شكلclass x_center y_center width heightبإحداثيات مُطبّعة. للاطلاع على دليل مفصل، راجع مثال مجموعة بيانات COCO8.يمكنك تحويل مجموعة بيانات COCO إلى تنسيق YOLO باستخدام أدوات التحويل من Ultralytics. إليك طريقة سريعة:
from ultralytics.data.converter import convert_coco convert_coco(labels_dir="path/to/coco/annotations/")يحوّل هذا الرمز تعليقات COCO التوضيحية إلى تنسيق YOLO لتتمكن من تدريب نماذج Ultralytics YOLO عليها.
يدعم Ultralytics YOLO مجموعة واسعة من مجموعات البيانات، ومنها:
توفّر صفحة كل مجموعة بيانات معلومات مفصلة عن بنيتها واستخدامها، بما يلائم تدريب YOLO26 بكفاءة. استكشف القائمة الكاملة في قسم مجموعات البيانات المدعومة.
لبدء تدريب نموذج YOLO26، تأكد من تنسيق مجموعة البيانات بشكل صحيح ومن تحديد المسارات في ملف YAML. استخدم النص البرمجي التالي لبدء التدريب:
مثالfrom ultralytics import YOLO model = YOLO("yolo26n.pt") # تحميل نموذج مدرَّب مسبقًا results = model.train(data="path/to/your_dataset.yaml", epochs=100, imgsz=640)توفر Ultralytics أمثلة كثيرة وأدلة عملية لاستخدام YOLO في تطبيقات متنوعة. تفضّل بزيارة مدونة Ultralytics للاطلاع على دراسات حالة ودروس تفصيلية وتجارب المجتمع التي تتناول كشف الكائنات والتجزئة والمزيد. وللاطلاع على أمثلة محددة، راجع صفحة وضع التنبؤ في الوثائق.
التعليقات54
اطرح سؤالًا، وشارك نتائجك، أو ساعد شخصًا آخر.
zcoolster11
Python Head Bop
Paula DerrengerUltralytics@zcoolster11, could you clarify what you mean by “Python Head Bop” and what you’d like to do with Ultralytics YOLO? Feel free to drop your dataset or Python questions here in the discussion so the Ultralytics team can help.
Murat Raimbekovhey @orz-serein, short answer: no, you don't need empty label files for background images - just leave the
.txtout.i verified this empirically on the current main branch. setup: 5 images, 2 with real labels, 1 with an empty
.txtfile, 2 without any.txtfile at all. building aYOLODatasetover them gives:Scanning /tmp/bgtest_full/labels... 3 images, 3 backgrounds, 0 corrupt: 100% 5/5all 5 images are kept. the 3 without labels (the empty-
.txtone and the two with no.txtat all) all end up with the same(0, 5)labels array - they are treated identically as background images.so both options work:
- no
.txtfile: counted as "missing" (nm=1), no labels -> background - empty
.txtfile: counted as "empty" (ne=1), no labels -> background
both end up in the same
backgrounds = nm + nebucket inultralytics/data/dataset.py.this is also stated in the detection dataset docs:
If there are no objects in an image, no
*.txtfile is required.how many background images: the yolov5 training tips recommend 0-10% of the dataset as background images to reduce false positives (coco has about 1% background).
hope this helps!
- no
sereinHello, I would like to ask a question. During the stage of preparing the training dataset, if some images do not have the target to be detected, do I need to add corresponding empty label files in the label folder?
Fatima-khanjar
Hello, I hope this message finds you well.
I have a question regarding fine-tuning a pre-trained YOLO model (e.g., trained on the COCO dataset) on my custom dataset. My dataset includes both new classes (not present in COCO) and the same existing classes (e.g., toothbrush, car), but with different layouts. Specifically, I would like to add my new classes starting from index 80, while still leveraging the pre-trained weights for the common classes, which are the same but with different layouts.
Is it possible to use the pre-trained weights for the common classes and only train the model on the new classes, while ensuring that the pre-trained knowledge for the common classes is preserved? If so, could you please guide me on how to proceed?
Thank you for your time and assistance. best regards,
bimal-gajera
Hello, I'm working on multiple dataset formats for object detection. For the YOLO dataset format, is there any way I can rename the labels directory and put it in yaml file? Something like this:
path: path_to_root_directory train: train\images val: val\images test: test\images labels_dir: yolo nc: 1 names: ['object']yolo directory has yolo annotations (*.txt files), and it's inside respective train, val and test directory.
Glenn JocherUltralytics(تم التعديل)@bimal-gajera currently, the
labels_dirkey is not supported in the YAML file. Ultralytics finds label files by replacing the last/images/directory in each image path with/labels/, so each split needs siblingimages/andlabels/directories (for exampletrain/imagesandtrain/labels). For more details, refer to the Object Detection Datasets Overview.1
nitya-pandey-astro
Hello Team, I am using YOLO for detecting trails of slow-moving astronomical objects in my images. While the model detects the trails, the bounding boxes predicted around the objects are not tight enough. The boxes tend to be too loose or not well-shaped to fit the elongated, irregular trails, resulting in inaccurate object localization. I suspect, YOLO's standard rectangular bounding box not being well-suited for the elongated, curving shapes of the trails. Could you provide guidance on how to improve bounding box accuracy for this specific use case?
Glenn JocherUltralytics(تم التعديل)@astronitya thank you for your question! For detecting elongated or irregular trails, consider using Oriented Bounding Boxes (OBB), which may better fit your objects' shapes compared to standard rectangular boxes. You can format your dataset in the YOLO OBB format and train a YOLO26 OBB model. Please refer to the Oriented Bounding Box (OBB) Datasets Overview for details on dataset formatting and training. Let me know if you need further clarification!
nitya-pandey-astro
@glenn-jocher Thankyou very much for the prompt response. I am going to work on your suggestions.
Yuxuan1998
Hi team, I am a little bit confused with the dataset folder structure. For most dataset I used, it strunctured in the way that each of
train/andval/folders containsimages/andlabels/folders. However, the COCO8 dataset example shows the opposite way, each ofimages/andlabels/folder containstest/andval/folders. Does the folder structure matter here? Thanks in advance
Glenn JocherUltralytics(تم التعديل)@Yuxuan1998 both layouts work, as long as each image has a sibling
labelsdirectory: Ultralytics finds the label for an image by replacing the last/images/in its path with/labels/(sotrain/images/img.jpgusestrain/labels/img.txt, andimages/train/img.jpguseslabels/train/img.txt). Set the paths in your dataset's YAML file to the image directories. For details, refer to the Object Detection Datasets Overview. Let us know if you need further clarification!1
milanaveed
Hello, can you please fix the broken images on this page? Can't see the label file example.
wgdcxy
Hello, my label and image files are stored according to the requirements, but they are still not recognized, and the following is an error message Thank you in advance
WARNING ⚠️ imgsz=[2448] must be multiple of max stride 32, updating to [2464] train: Scanning D:\Textile_testing\ultralytics-seg\cs\labels\ttb... 0 images, 30 backgrounds, 0 corrupt: 100%|██████████| 30/30 [00:00<00:00, 1138.41it/s] train: WARNING ⚠️ No labels found in D:\Textile_testing\ultralytics-seg\cs\labels\ttb.cache. See https://docs.ultralytics.com/datasets/detect for dataset formatting guidance. train: WARNING ⚠️ Cache directory D:\Textile_testing\ultralytics-seg\cs\labels is not writeable, cache not saved. WARNING ⚠️ No labels found in D:\Textile_testing\ultralytics-seg\cs\labels\ttb.cache, training may not work correctly. See https://docs.ultralytics.com/datasets/detect for dataset formatting guidance. val: Scanning D:\Textile_testing\ultralytics-seg\cs\labels\ttj... 0 images, 30 backgrounds, 0 corrupt: 100%|██████████| 30/30 [00:00<00:00, 1617.94it/s] val: WARNING ⚠️ No labels found in D:\Textile_testing\ultralytics-seg\cs\labels\ttj.cache. See https://docs.ultralytics.com/datasets/detect for dataset formatting guidance. val: WARNING ⚠️ Cache directory D:\Textile_testing\ultralytics-seg\cs\labels is not writeable, cache not saved. WARNING ⚠️ No labels found in D:\Textile_testing\ultralytics-seg\cs\labels\ttj.cache, training may not work correctly. See https://docs.ultralytics.com/datasets/detect for dataset formatting guidance. Plotting labels to runs\segment\train3\labels.jpg...
Glenn JocherUltralyticsIt seems like your dataset labels are not being recognized. Please ensure your label files are in the correct YOLO format and that the directory is writable. For detailed guidance, visit the dataset formatting section at https://docs.ultralytics.com/datasets/detect/.
wgdcxy
Hi, but my file path is very accurate, and I checked it N times, so is there any otherreason? Thank you
Glenn JocherUltralytics@wgdcxy please ensure your label files are in the correct YOLO format, with one
.txtfile per image containing normalized coordinates. Also, verify that the directory permissions allow writing. For more details, refer to the dataset formatting guide linked earlier.wgdcxy
Hello, I'm a student whose English is not particularly good, so some places may not be clear, and secondly, this is not an error but a warning.I don't know why it's the background that reads, not the images. The warnings are as follows: val: Scanning D:\Textile_testing\ultralytics-seg\cs\labels\ttj... 0 images, 30 backgrounds, 0 corrupt: 100%| 30/30 [00:00<00:00, 495.76it/s] val: WARNING ⚠️ No labels found in D:\Textile_testing\ultralytics-seg\cs\labels\ttj.cache. See https://docs.ultralytics.com/datasets/detect for dataset formatting guidance. val: WARNING ⚠️ Cache directory D:\Textile_testing\ultralytics-seg\cs\labels is not writeable, cache not saved. WARNING ⚠️ No labels found in D:\Textile_testing\ultralytics-seg\cs\labels\ttj.cache, training may not work correctly. See https://docs.ultralytics.com/datasets/detect for dataset formatting guidance. Plotting labels to runs\segment\train4\labels.jpg...
Then this warning tells me that the cache file is missing, and I don't know why I can't generate a cache file for the file I created, so I'm here to ask you guys. Below is my own yaml file: # Train/val/test sets as 1) dir: path/to/imgs, 2) file: path/to/imgs.txt, or 3) list: [path/to/imgs1, path/to/imgs2, ..] path: ../cs # dataset root dir train: images/ttb # train images (relative to 'path') 128 images val: images/ttj # val images (relative to 'path') 128 images test: # test images (optional) # Classes names : 0 : wf
Below is my label file: 0 0.6799428104575164 0.5005859375 0.6844771241830065 0.500537109375 0.6845996732026144 0.497265625 0.6802696078431373 0.497119140625 0 0.6803104575163399 0.4935546875 0.6848039215686275 0.493505859375 0.6847630718954248 0.497119140625 0.6802696078431373 0.49697265625 0 0.6802696078431373 0.49013671875 0.6849673202614379 0.490185546875 0.6849264705882353 0.49345703125 0.6803513071895425 0.493359375 0 0.6805555555555556 0.48662109375 0.6850898692810458 0.486767578125 0.6850490196078431 0.490234375 0.6803513071895425 0.490234375 0 0.6808415032679739 0.483447265625 0.6852941176470588 0.48349609375 0.6852124183006536 0.486767578125 0.6806781045751634 0.486669921875 0 0.6806372549019607 0.47998046875 0.6854166666666666 0.47998046875 0.6853349673202613 0.48349609375 0.6808415032679738 0.48359375
Finally, this yolo can be run, but I don't know why the result is 0. Here's how it works: Transferred 381/417 items from pretrained weights 195/200 8.73G 0 0 nan 0 0 2464: 100%|██████████| 8/8 [01:37<00:00, 12.13s/it] Class Images Instances Box(P R mAP50 mAP50-95) Mask(P R mAP50 mAP50-95): 100%|[00:31<00:00, 7.91s/it] all 30 0 0 0 0 0 0 0 0 0 Finally, thank you for explaining it to me
wgdcxy
By the way, the size of my picture is 2448x2048, so the imgsz entered is 2448, and your code changed the size of my picture to 2464, is it related to this. imgsz=[2448] must be multiple of max stride 32, updating to [2464]
wgdcxy
I apologize, I found a small mistake of mine. I wrote the file name as "labels" instead of "lables" which I intended to write.Please forgive my carelessness.After all, who doesn't make mistakes. I'll come back to you next time I have a problem. Thank you for your help.
wgdcxy
Transferred 417/417 items from pretrained weights Freezing layer 'model.22.dfl.conv.weight' AMP: running Automatic Mixed Precision (AMP) checks with YOLOv8n... AMP: checks passed ✅ WARNING ⚠️ imgsz=[2448] must be multiple of max stride 32, updating to [2464] train: Scanning D:\Textile_testing\ultralytics-seg\cs\labels\ttb.cache... 30 images, 0 backgrounds, 0 corrupt: 100%|██████████| 30/30 [00:00<?, ?it/s] Hello, here I am again, with a new problem, how to solve this problem about image size?Ask for answers, thank you
Glenn JocherUltralytics@wgdcxy to address the image size issue, ensure your
imgszis a multiple of 32, as required by the model's architecture. This adjustment helps maintain compatibility with the model's stride. If you have further questions, feel free to ask!wgdcxy
WARNING ⚠️ NMS time limit 0.900s exceeded. Hello, my teacher who has never met, what should I do with this warning?
Glenn JocherUltralytics(تم التعديل)@wgdcxy the "NMS time limit exceeded" warning is not controlled by an
nmsargument. It appears when too many candidate boxes need to be processed within the time limit, which is common early in training when validation uses a low confidence threshold. It usually stops as the model trains, and you can reduce it by raisingconfor loweringmax_detduring validation. If you have further questions, feel free to ask!wgdcxy
Hello, I'm here again. The issue this time is still the same warning. I adjusted the max_time_img to 0.1 in ops. py, but I don't feel it's right. So I came to ask for your help because it still shows this warning. I hope you can tell me where to make the adjustment. Thank you again. WARNING ⚠️ NMS time limit 0.900s exceeded
wgdcxy
How can these values be improved? We can only continue training or increase the training dataset. Epoch GPU_mem box_loss seg_loss cls_loss dfl_loss Instances Size 11/500 11G nan 6.21 nan nan 132 2464: 100%|██████████| 8/8 [01:56<00:00, 14.59s/it] Class Images Instances Box(P R mAP50 mAP50-95) Mask(P R mAP50 mAP50-95): 100%|██████████| 4/4 [00:54<00:00, 13.56s/it] all 30 664 0 0 0 0 0 0 0 0
Glenn JocherUltralyticsTo improve your model's performance, consider increasing the dataset size, enhancing data quality, or adjusting hyperparameters. If issues persist, reviewing the dataset for label accuracy and distribution might help.
wgdcxy
WARNING ⚠️ imgsz=[2448] must be multiple of max stride 32, updating to [2464] train: Scanning D:\Textile_testing\ultralytics-seg\cs\labels\ttb... 0 images, 30 backgrounds, 0 corrupt: 100%|██████████| 30/30 [00:00<00:00, 1138.41it/s] train: WARNING ⚠️ No labels found in D:\Textile_testing\ultralytics-seg\cs\labels\ttb.cache. See https://docs.ultralytics.com/datasets/detect for dataset formatting guidance. train: WARNING ⚠️ Cache directory D:\Textile_testing\ultralytics-seg\cs\labels is not writeable, cache not saved. WARNING ⚠️ No labels found in D:\Textile_testing\ultralytics-seg\cs\labels\ttb.cache, training may not work correctly. See https://docs.ultralytics.com/datasets/detect for dataset formatting guidance. val: Scanning D:\Textile_testing\ultralytics-seg\cs\labels\ttj... 0 images, 30 backgrounds, 0 corrupt: 100%|██████████| 30/30 [00:00<00:00, 1617.94it/s] val: WARNING ⚠️ No labels found in D:\Textile_testing\ultralytics-seg\cs\labels\ttj.cache. See https://docs.ultralytics.com/datasets/detect for dataset formatting guidance. val: WARNING ⚠️ Cache directory D:\Textile_testing\ultralytics-seg\cs\labels is not writeable, cache not saved. WARNING ⚠️ No labels found in D:\Textile_testing\ultralytics-seg\cs\labels\ttj.cache, training may not work correctly. See https://docs.ultralytics.com/datasets/detect for dataset formatting guidance. Plotting labels to runs\segment\train3\labels.jpg...
这个问题该如何解决?
Glenn JocherUltralyticsIt looks like your dataset labels are missing or not formatted correctly. Please ensure your labels are in the YOLO format and check the directory permissions. For detailed guidance, visit the dataset formatting section at https://docs.ultralytics.com/datasets/detect/.
