ultralytics / ultralytics

NEW - YOLOv8 πŸš€ in PyTorch > ONNX > OpenVINO > CoreML > TFLite
https://docs.ultralytics.com
GNU Affero General Public License v3.0
23.76k stars 4.74k forks source link

No labels found #11268

Open Basim592003 opened 2 weeks ago

Basim592003 commented 2 weeks ago

Search before asking

Question

i am trying to detect cells but it keeps throwing this error -> WARNING ⚠️ No labels found in D:\data\labels\train.cache. i have images and labels folder set up like specified from yolo documentations bur still have an issue.

Additional

--python code-- from ultralytics import YOLO model = YOLO("yolov8s.yaml") results = model.train(data=r"D:\UNIVERSITY\SEM6\Mia\config.yaml", epochs=1)

--yaml file-- path: D:/UNIVERSITY/SEM6/Mia/data train: images/train
val: images/train

Classes

names: 0: probes

github-actions[bot] commented 2 weeks ago

πŸ‘‹ Hello @Basim592003, thank you for your interest in Ultralytics YOLOv8 πŸš€! We recommend a visit to the Docs for new users where you can find many Python and CLI usage examples and where many of the most common questions may already be answered.

If this is a πŸ› Bug Report, please provide a minimum reproducible example to help us debug it.

If this is a custom training ❓ Question, please provide as much information as possible, including dataset image examples and training logs, and verify you are following our Tips for Best Training Results.

Join the vibrant Ultralytics Discord 🎧 community for real-time conversations and collaborations. This platform offers a perfect space to inquire, showcase your work, and connect with fellow Ultralytics users.

Install

Pip install the ultralytics package including all requirements in a Python>=3.8 environment with PyTorch>=1.8.

pip install ultralytics

Environments

YOLOv8 may be run in any of the following up-to-date verified environments (with all dependencies including CUDA/CUDNN, Python and PyTorch preinstalled):

Status

Ultralytics CI

If this badge is green, all Ultralytics CI tests are currently passing. CI tests verify correct operation of all YOLOv8 Modes and Tasks on macOS, Windows, and Ubuntu every 24 hours and on every commit.

glenn-jocher commented 2 weeks ago

Hello! It looks like the issue may be related to where the model is looking for your label files. Based on the error message you're receiving, it's possible that the labels are not correctly matched or located where the model expects.

First, ensure that your labels in D:\UNIVERSITY\SEM6\Mia\data\labels\train match the images in D:\UNIVERSITY\SEM6\Mia\data\images\train in terms of naming and format. Each label file should have the same basename as its corresponding image file.

Also, in your training YAML file, you should specify the location of both the images and labels directories explicitly. Here's a suggested correction for your YAML configuration:

path: D:/UNIVERSITY/SEM6/Mia/data
train: images/train  
val: images/val  # Make sure to validate on different data if possible

# Directories
train_label_dir: labels/train
val_label_dir: labels/val

# Classes
names:
  - probes

Make sure the train_label_dir and val_label_dir are correctly pointing to where your labels are stored.

Try these adjustments and see if it resolves the issue. πŸ‘

TheMattBin commented 2 weeks ago

hi @Basim592003

from ultralytics import YOLO
model = YOLO("yolov8s.yaml")
results = model.train(data=r"D:\UNIVERSITY\SEM6\Mia\config.yaml", epochs=1)

I guess would be line 2, you might not add proper format for model

Basim592003 commented 1 week ago

i tried adding label directories as you said but it still gives the same error. Also why is a cache being created and why does it look for labels in thee created cache? train: New cache created: D:\UNIVERSITY\SEM6\Mia\Training\Images\Train.cache WARNING ⚠️ No labels found in D:\UNIVERSITY\SEM6\Mia\Training\Images\Train.cache

glenn-jocher commented 1 week ago

@Basim592003 hello!

For the issue where you're encountering missing labels even after specifying the directories, it sounds like there might be a disconnect in how the paths are referenced in your configuration. Here’s a quick checklist:

  1. Ensure the labels folder structure mirrors that of your images. Each label file name should exactly match its corresponding image file name, except the extension.
  2. Make sure the label files are in the correct format – typically, a .txt file for YOLO.

Regarding the cache, YOLO creates a .cache file to speed up subsequent trainings by saving the loaded datasets. It's checking the cache for labels, implying possibly the cache didn't store paths correctly the first time or the labels are indeed missing/incorrectly named.

If the issue persists, try clearing the cache by deleting the .cache file, and rerun your training. Make sure your paths in the YAML are correct and double-check any typographical errors.

Hope this helps!

Basim592003 commented 1 week ago

@glenn-jocher Hey! Both my labels and images files content have the same exact names. And yes, i have also tried deleting the .cache file and running but i get the same results.

Maybe its because the images i am using are tiff images ?