Başla

Nesne Algılama Veri Kümelerine Genel Bakış

Sağlam ve doğru bir nesne algılama modeli eğitmek için kapsamlı bir veri kümesi gerekir. Bu kılavuz, Ultralytics YOLO modeliyle uyumlu çeşitli veri kümesi biçimlerini tanıtır; yapılarına ve kullanımlarına, ayrıca farklı biçimler arasında dönüştürme yöntemlerine dair bilgiler sunar.

Desteklenen Veri Kümesi Biçimleri#

Ultralytics YOLO biçimi#

Ultralytics YOLO biçimi; veri kümesinin kök dizinini, eğitim/doğrulama/test görüntü dizinlerinin göreli yollarını veya görüntü yollarını içeren *.txt dosyalarını ve sınıf adlarından oluşan bir sözlüğü tanımlamanı sağlayan bir veri kümesi yapılandırma biçimidir. İşte bir örnek:

ultralytics/cfg/datasets/coco8.yaml
# 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 ve test seçeneklerinin her biri bir dizini, bir görüntü dosyasını, dizin veya görüntü dosyası listesini ya da satır başına bir görüntü yolu içeren UTF-8 *.txt dosyasını kabul eder (./ ile başlayan yollar, *.txt dosyasına göre çözümlenir). *.txt dosyası, bir dizinin alt kümesiyle eğitim yapmak, etiketlenmemiş görüntüleri atlamak veya birden fazla kaynaktaki görüntüleri tek bir bölmede birleştirmek için kullanışlıdır.

`*.txt` dosyasında görüntü yolları
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

(İsteğe bağlı) colors, her sınıfa sınıf kimliğine göre indekslenmiş, tırnak içine alınmış bir "#rrggbb" dizesi olarak görüntü rengi verir; ör. colors: ["#042aff", "#ff0000"]. Eğitilmiş ve dışa aktarılmış modeller, tahminlerinde bu renkleri korur; rengi olmayan sınıflar varsayılan paleti kullanır. Bir NDJSON veri kümesi kaydı aynı colors alanını taşıyabilir.

Bu biçime ait etiketler, her görüntü için bir *.txt dosyası olacak şekilde YOLO biçiminde dışa aktarılmalıdır. Bir görüntüde nesne yoksa *.txt dosyası gerekmez. *.txt dosyası, class x_center y_center width height biçiminde her nesne için bir satır içerecek şekilde düzenlenmelidir. Sınırlayıcı kutu koordinatları normalize edilmiş xywh biçiminde (0 ile 1 arasında) olmalıdır. Kutuların piksel cinsinden olması durumunda, x_center ve width değerlerini görüntü genişliğine, y_center ve height değerlerini ise görüntü yüksekliğine bölmelisin. Koordinatlar, Ultralytics'in her görüntüyü okuma biçimiyle aynı şekilde, EXIF yönelimi uygulanmış ve görüntüleyicilerin gördüğü görüntüyü esas alır. Sınıf numaraları sıfır tabanlı olmalıdır (0'dan başlamalıdır).

YOLO labeled image with bounding boxes on persons and tie

Yukarıdaki görüntüye karşılık gelen etiket dosyasında 2 kişi (sınıf 0) ve bir kravat (sınıf 27) bulunur:

YOLO format label file with normalized coordinates

Ultralytics YOLO biçimini kullanırken eğitim ve doğrulama görüntülerini ve etiketlerini aşağıdaki COCO8 veri kümesi örneğinde gösterildiği gibi düzenle.

YOLO dataset directory structure with train and val folders

Kullanım Örneği#

Modelini eğitmek için YOLO biçimindeki veri kümelerini şöyle kullanabilirsin:

Örnek
from ultralytics import YOLO

# Bir model yükle
model = YOLO("yolo26n.pt")  # Önceden eğitilmiş bir model yükle (eğitim için önerilir)

# Modeli eğit
results = model.train(data="coco8.yaml", epochs=100, imgsz=640)

Ultralytics NDJSON biçimi#

NDJSON (Yeni Satırla Sınırlandırılmış JSON) biçimi, Ultralytics YOLO modelleri için veri kümelerini tanımlamanın alternatif bir yolunu sunar. Bu biçimde, veri kümesi meta verileri ve etiketleri tek bir dosyada saklanır ve her satır ayrı bir JSON nesnesi içerir.

Bir NDJSON veri kümesi dosyası şunları içerir:

  1. Veri kümesi kaydı (ilk satır): Görev türü, sınıf adları ve genel bilgiler dahil olmak üzere veri kümesi meta verilerini içerir
  2. Görüntü kayıtları (sonraki satırlar): Boyutlar, etiketler ve dosya yolları dahil olmak üzere ayrı görüntü verilerini içerir
NDJSON Örneği
{
    "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"
}

Özel görüntü meta verileri#

Her görüntü kaydı; çekim koşulları, ekipman tanımlayıcıları veya inceleme durumu gibi uygulamaya özgü bağlam bilgileri için bir metadata JSON nesnesi içerebilir. İç içe değerler desteklenir. Ultralytics Platform'a aktarıldığında meta veriler ilgili görüntüyle birlikte saklanır ve görüntünün tam ekran bilgi panelinden görüntülenebilir veya düzenlenebilir.

{
    "type": "image",
    "file": "airbus-wing.jpg",
    "url": "https://example.com/airbus-wing.jpg",
    "split": "train",
    "metadata": {
        "aircraft": { "family": "A350", "section": "wing" },
        "inspectionStatus": "reviewed"
    }
}

Platform, en üst düzey meta veri anahtarlarını 128 karakterle, her görüntünün serileştirilmiş meta veri nesnesini 500.000 karakterle ve tek bir NDJSON içe aktarımındaki toplam etkin meta veriyi 500.000 karakterle sınırlar.

Kullanım Örneği#

YOLO26 ile bir NDJSON veri kümesi kullanmak için .ndjson dosyasının yolunu belirtmen yeterlidir:

Örnek
from ultralytics import YOLO

# Bir model yükle
model = YOLO("yolo26n.pt")

# NDJSON veri kümesini kullanarak eğit
results = model.train(data="path/to/dataset.ndjson", epochs=100, imgsz=640)

NDJSON biçiminin avantajları#

  • Tek dosya: Tüm veri kümesi bilgileri tek bir dosyada bulunur
  • Akış işleme: Her şeyi belleğe yüklemeden büyük veri kümelerini satır satır işleyebilir
  • Bulut entegrasyonu: Bulut tabanlı eğitim için uzak görüntü URL'lerini destekler
  • Genişletilebilirlik: Özel meta veri alanları eklemek kolaydır
  • Sürüm denetimi: Tek dosyalı biçim, git ve sürüm denetimi sistemleriyle iyi çalışır

Desteklenen Veri Kümeleri#

Desteklenen veri kümelerinin listesi ve her biri için kısa bir açıklama aşağıda verilmiştir. Bu veri kümelerinin çoğu, görüntülere ve etiketlere göz atabileceğin, veri kümesi istatistiklerini görüntüleyebileceğin ve bulut eğitimi için kopyalayabileceğin Ultralytics Platform üzerinde de barındırılır.

  • African-wildlife: Bufalo, fil, gergedan ve zebra dahil Afrika yaban hayatına ait görüntüler içeren bir veri kümesi.
  • Argoverse: 8 yol nesnesi sınıfını kapsayan, şehir içi otonom sürüş görüntülerinden oluşan 54.446 görüntülük Argoverse-HD 2D algılama veri kümesi.
  • Beyin tümörü: Beyin MRI görüntülerindeki beyin tümörlerini tespit etmek için kullanılan, tümörlerin tek bir sınıfta sınırlayıcı kutularla etiketlendiği bir veri kümesi.
  • COCO: Bağlam İçinde Yaygın Nesneler (COCO), 80 nesne kategorisi içeren, büyük ölçekli bir nesne algılama, segmentasyon ve altyazı veri kümesidir.
  • COCO8: COCO train2017'deki ilk 8 görüntünün 4'ü eğitim, 4'ü doğrulama için kullanılan daha küçük bir alt kümesi; hızlı testler için uygundur.
  • COCO8-Grayscale: RGB'nin gri tonlamaya dönüştürülmesiyle oluşturulan, tek kanallı model değerlendirmesi için kullanışlı bir COCO8 gri tonlama sürümü.
  • COCO8-Multispectral: RGB dalga boylarının enterpolasyonuyla oluşturulan, spektral farkındalıklı model değerlendirmesi için kullanışlı, 10 kanallı çok spektrumlu bir COCO8 sürümü.
  • COCO12-Formats: Görüntü yükleme işlem hatlarını doğrulamak için desteklenen 12 görüntü biçimini (AVIF, BMP, DNG, HEIC, JP2, JPEG, JPG, MPO, PNG, TIF, TIFF, WebP) kapsayan 12 görüntülük bir test veri kümesi.
  • COCO16: Hızlı testlere uygun, COCO train2017'nin ilk 16 görüntüsünden oluşan bir alt küme (8 eğitim + 8 doğrulama).
  • COCO32: Hızlı testlere uygun, COCO train2017'nin ilk 32 görüntüsünden oluşan bir alt küme (16 eğitim + 16 doğrulama).
  • COCO64: Hızlı testlere uygun, COCO train2017'nin ilk 64 görüntüsünden oluşan bir alt küme (32 eğitim + 32 doğrulama).
  • COCO128: COCO train2017'deki ilk 128 görüntünün testler için uygun, daha küçük bir alt kümesi.
  • Construction-PPE: Baret, yelek, eldiven, bot ve koruyucu gözlük gibi güvenlik ekipmanları etiketlenmiş şantiye çalışanlarının görüntülerini içeren; gerçek dünya uyumluluk takibi için no_helmet ve no_goggle gibi eksik ekipman etiketlerine de yer veren bir veri kümesi.
  • Global Wheat 2020: 2020 Global Wheat Challenge için buğday başaklarının görüntülerini içeren bir veri kümesi.
  • HomeObjects-3K: Yatak, sandalye, TV ve daha fazlası gibi ev eşyalarını içeren bir iç mekân veri kümesi; akıllı ev otomasyonu, robotik, artırılmış gerçeklik ve oda düzeni analizi uygulamaları için idealdir.
  • KITTI: Stereo, LiDAR ve GPS/IMU verileri içeren gerçek dünya sürüş sahnelerinden oluşan bu veri kümesi, şehir içi, kırsal ve otoyol ortamlarında otomobil, yaya ve bisikletli algılama gibi 2D nesne algılama görevlerinde kullanılır.
  • LVIS: 1.203 nesne kategorisi içeren, büyük ölçekli bir nesne algılama ve örnek segmentasyonu veri kümesi.
  • Medical-pills: İlaç kalite güvencesi, hapları ayırma ve mevzuata uygunluk gibi uygulamalar için etiketlenmiş tıbbi hap görüntülerini içeren bir veri kümesi.
  • Objects365: 365 nesne kategorisi ve 1,7 milyondan fazla eğitim görüntüsü içeren, nesne algılama için yüksek kaliteli ve büyük ölçekli bir veri kümesi.
  • OpenImagesV7: Google'ın 1,7 milyon eğitim görüntüsü ve 42 bin doğrulama görüntüsü içeren kapsamlı bir veri kümesi.
  • Roboflow 100: Kapsamlı model değerlendirmesi için yedi görüntü alanını kapsayan 100 veri kümesinden oluşan, çeşitli bir nesne algılama kıyaslama veri kümesi.
  • Signature: Belge doğrulama ve sahtecilik tespiti araştırmalarını destekleyen, imzaları işaretlenmiş çeşitli belge görüntülerini içeren bir veri kümesi.
  • SKU-110K: 11 binden fazla görüntü ve 1,7 milyon sınırlayıcı kutuyla perakende ortamlarında yoğun nesne algılamayı içeren bir veri kümesi.
  • TT100K: Algılama ve sınıflandırma için 221 trafik işareti kategorisinde 16.817 sokak görünümü görüntüsünden oluşan Tsinghua-Tencent 100K (TT100K) trafik işareti veri kümesi.
  • Ultralytics Benchmark: Tıp, hava görüntüleri, endüstri, perakende ve diğer alanları kapsayan, özenle seçilmiş 37 algılama veri kümesinden oluşan birinci taraf kıyaslama paketi; gerçek dünyada model genellemesini ölçmek için sabit bir protokol kullanır.
  • VisDrone: 10 binden fazla görüntü ve video dizisiyle, drone görüntülerinden elde edilen nesne algılama ve çoklu nesne izleme verilerini içeren bir veri kümesi.
  • VOC: 20 nesne sınıfı ve 11 binden fazla görüntü içeren, nesne algılama ve segmentasyon için Pascal Görsel Nesne Sınıfları (VOC) veri kümesi.
  • xView: 60 nesne kategorisi ve 1 milyondan fazla açıklama eklenmiş nesne içeren, havadan çekilmiş görüntülerde nesne algılamaya yönelik bir veri kümesi.

Kendi veri kümeni ekleme#

Kendi veri kümen varsa ve bunu Ultralytics YOLO biçiminde algılama modellerini eğitmek için kullanmak istiyorsan, "Ultralytics YOLO biçimi" başlığı altında yukarıda belirtilen biçime uygun olduğundan emin ol. Ek açıklamalarını gerekli biçime dönüştür ve YAML yapılandırma dosyasında yolları, sınıf sayısını ve sınıf adlarını belirt.

Etiket Biçimlerini Taşıma veya Dönüştürme#

COCO Veri Kümesi Biçiminden YOLO Biçimine#

Aşağıdaki kod parçasını kullanarak etiketleri popüler COCO veri kümesi biçiminden YOLO biçimine dönüştürebilirsin:

Örnek
from ultralytics.data.converter import convert_coco

convert_coco(labels_dir="path/to/coco/annotations/")

Bu dönüştürme aracı, COCO veri kümesini veya COCO biçimindeki herhangi bir veri kümesini Ultralytics YOLO biçimine dönüştürmek için kullanılabilir. İşlem, JSON tabanlı COCO ek açıklamalarını daha basit, metin tabanlı YOLO biçimine dönüştürerek bunları Ultralytics YOLO modelleri ile uyumlu hâle getirir. Sınıf kimliği eşlemesi, dizin düzeni ve segmentasyon veya poz ek açıklamaları dâhil tüm iş akışı için COCO Ek Açıklamalarını YOLO'ya Dönüştürme sayfasına bak.

Kullanmak istediğin veri kümesinin modelinle uyumlu olup olmadığını ve gerekli biçim kurallarına uyup uymadığını mutlaka tekrar kontrol et. Doğru biçimlendirilmiş veri kümeleri, başarılı nesne algılama modelleri eğitmek için çok önemlidir.

Sırada ne var?#

Veri kümen biçimlendirildiğine göre modelini eğitmeye başla. Hangi önceden eğitilmiş modelle başlayacağından emin değil misin? YOLO26 model ailesindeki seçenekleri karşılaştır.

Sık Sorulan Sorular#

  • Ultralytics YOLO biçimi, eğitim projelerinde veri kümelerini tanımlamak için kullanılan yapılandırılmış bir ayardır. Eğitim, doğrulama ve test görüntülerinin yollarını ve bunlara karşılık gelen etiketleri belirlemeyi içerir. Örneğin:

    # 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

    Etiketler, her görüntü için bir dosya olacak şekilde *.txt dosyalarında, normalize edilmiş koordinatlarla class x_center y_center width height biçiminde kaydedilir. Ayrıntılı bir kılavuz için COCO8 veri kümesi örneğine bak.

  • Bir COCO veri kümesini Ultralytics dönüştürme araçlarını kullanarak YOLO biçimine dönüştürebilirsin. İşte hızlı bir yöntem:

    from ultralytics.data.converter import convert_coco
    
    convert_coco(labels_dir="path/to/coco/annotations/")

    Bu kod, COCO açıklamalarını YOLO biçimine dönüştürür; böylece Ultralytics YOLO modellerini bu verilerle eğitebilirsin.

  • Ultralytics YOLO, aşağıdakiler dâhil çok çeşitli veri kümelerini destekler:

    Her veri kümesi sayfası, verimli YOLO26 eğitimi için uyarlanmış yapı ve kullanım hakkında ayrıntılı bilgi verir. Listenin tamamını Desteklenen Veri Kümeleri bölümünde keşfet.

  • YOLO26 modelini eğitmeye başlamak için veri kümenin doğru biçimlendirildiğinden ve yolların bir YAML dosyasında tanımlandığından emin ol. Eğitime başlamak için aşağıdaki betiği kullan:

    Örnek
    from ultralytics import YOLO
    
    model = YOLO("yolo26n.pt")  # Önceden eğitilmiş bir modeli yükle
    results = model.train(data="path/to/your_dataset.yaml", epochs=100, imgsz=640)
  • Ultralytics, YOLO'yu çeşitli uygulamalarda kullanmak için pek çok örnek ve uygulamalı kılavuz sunar. Nesne algılama, segmentasyon ve daha fazlasını kapsayan örnek olay incelemeleri, ayrıntılı eğitimler ve topluluk hikâyeleri için Ultralytics Blogu sayfasını ziyaret et. Belirli örnekler için belgelerdeki Tahmin modu sayfasına bak.

Yorumlar54

Bir soru sor, sonuçlarını paylaş veya başka birine yardım et.

    1. 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.

  1. Murat Raimbekov

    hey @orz-serein, short answer: no, you don't need empty label files for background images - just leave the .txt out.

    i verified this empirically on the current main branch. setup: 5 images, 2 with real labels, 1 with an empty .txt file, 2 without any .txt file at all. building a YOLODataset over them gives:

    Scanning /tmp/bgtest_full/labels... 3 images, 3 backgrounds, 0 corrupt: 100% 5/5

    all 5 images are kept. the 3 without labels (the empty-.txt one and the two with no .txt at all) all end up with the same (0, 5) labels array - they are treated identically as background images.

    so both options work:

    • no .txt file: counted as "missing" (nm=1), no labels -> background
    • empty .txt file: counted as "empty" (ne=1), no labels -> background

    both end up in the same backgrounds = nm + ne bucket in ultralytics/data/dataset.py.

    this is also stated in the detection dataset docs:

    If there are no objects in an image, no *.txt file 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!

  2. serein

    Hello, 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?

  3. Fatima-khanjarGitHub

    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,

  4. bimal-gajeraGitHub

    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.

    1. Glenn JocherUltralytics(düzenlendi)

      @bimal-gajera currently, the labels_dir key 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 sibling images/ and labels/ directories (for example train/images and train/labels). For more details, refer to the Object Detection Datasets Overview.

      1
  5. nitya-pandey-astroGitHub

    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?

    1. Glenn JocherUltralytics(düzenlendi)

      @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!

  6. Yuxuan1998GitHub

    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/ and val/ folders contains images/ and labels/ folders. However, the COCO8 dataset example shows the opposite way, each of images/ and labels/ folder contains test/ and val/ folders. Does the folder structure matter here? Thanks in advance

    1. Glenn JocherUltralytics(düzenlendi)

      @Yuxuan1998 both layouts work, as long as each image has a sibling labels directory: Ultralytics finds the label for an image by replacing the last /images/ in its path with /labels/ (so train/images/img.jpg uses train/labels/img.txt, and images/train/img.jpg uses labels/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
  7. milanaveedGitHub

    Hello, can you please fix the broken images on this page? Can't see the label file example.

  8. wgdcxyGitHub

    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...

    1. wgdcxyGitHub

      Hi, but my file path is very accurate, and I checked it N times, so is there any otherreason? Thank you

    2. Glenn JocherUltralytics

      @wgdcxy please ensure your label files are in the correct YOLO format, with one .txt file per image containing normalized coordinates. Also, verify that the directory permissions allow writing. For more details, refer to the dataset formatting guide linked earlier.

    3. wgdcxyGitHub

      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

    4. wgdcxyGitHub

      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]

    5. wgdcxyGitHub

      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.

    6. wgdcxyGitHub

      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

    7. Glenn JocherUltralytics

      @wgdcxy to address the image size issue, ensure your imgsz is 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!

    8. wgdcxyGitHub

      WARNING ⚠️ NMS time limit 0.900s exceeded. Hello, my teacher who has never met, what should I do with this warning?

    9. Glenn JocherUltralytics(düzenlendi)

      @wgdcxy the "NMS time limit exceeded" warning is not controlled by an nms argument. 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 raising conf or lowering max_det during validation. If you have further questions, feel free to ask!

    10. wgdcxyGitHub

      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

    11. wgdcxyGitHub

      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

    12. Glenn JocherUltralytics

      To 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.

  9. wgdcxyGitHub

    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...

    这个问题该如何解决?