ultralytics / yolov5

YOLOv5 🚀 in PyTorch > ONNX > CoreML > TFLite
https://docs.ultralytics.com
GNU Affero General Public License v3.0
50.96k stars 16.4k forks source link

No lables found even though the lables are there in the drive folder #12094

Closed MSR2201 closed 1 year ago

MSR2201 commented 1 year ago

Search before asking

YOLOv5 Component

No response

Bug

optimizer: SGD(lr=0.01) with parameter groups 57 weight(decay=0.0), 60 weight(decay=0.0005), 60 bias albumentations: Blur(p=0.01, blur_limit=(3, 7)), MedianBlur(p=0.01, blur_limit=(3, 7)), ToGray(p=0.01), CLAHE(p=0.01, clip_limit=(1, 4.0), tile_grid_size=(8, 8)) train: Scanning /content/drive/MyDrive/Colab Notebooks/yolo/train_data/labels/train... 0 images, 100 backgrounds, 0 corrupt: 100%|██████████| 100/100 [00:00<00:00, 242.31it/s] train: WARNING ⚠️ No labels found in /content/drive/MyDrive/Colab Notebooks/yolo/train_data/labels/train.cache. See https://docs.ultralytics.com/yolov5/tutorials/train_custom_data train: WARNING ⚠️ Cache directory /content/drive/MyDrive/Colab Notebooks/yolo/train_data/labels is not writeable: [Errno 2] No such file or directory: '/content/drive/MyDrive/Colab Notebooks/yolo/train_data/labels/train.cache.npy' Traceback (most recent call last): File "/content/yolov5/yolov5/train.py", line 647, in main(opt) File "/content/yolov5/yolov5/train.py", line 536, in main train(opt.hyp, opt, device, callbacks) File "/content/yolov5/yolov5/train.py", line 195, in train train_loader, dataset = create_dataloader(train_path, File "/content/yolov5/yolov5/utils/dataloaders.py", line 124, in create_dataloader dataset = LoadImagesAndLabels( File "/content/yolov5/yolov5/utils/dataloaders.py", line 502, in init assert nf > 0 or not augment, f'{prefix}No labels found in {cache_path}, can not start training. {HELP_URL}' AssertionError

image

Environment

Using google colab and using google drive data

Minimal Reproducible Example

No response

Additional

No response

Are you willing to submit a PR?

github-actions[bot] commented 1 year ago

👋 Hello @MSR2201, thank you for your interest in YOLOv5 🚀! Please visit our ⭐️ Tutorials to get started, where you can find quickstart guides for simple tasks like Custom Data Training all the way to advanced concepts like Hyperparameter Evolution.

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.

Requirements

Python>=3.8.0 with all requirements.txt installed including PyTorch>=1.8. To get started:

git clone https://github.com/ultralytics/yolov5  # clone
cd yolov5
pip install -r requirements.txt  # install

Environments

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

Status

YOLOv5 CI

If this badge is green, all YOLOv5 GitHub Actions Continuous Integration (CI) tests are currently passing. CI tests verify correct operation of YOLOv5 training, validation, inference, export and benchmarks on macOS, Windows, and Ubuntu every 24 hours and on every commit.

Introducing YOLOv8 🚀

We're excited to announce the launch of our latest state-of-the-art (SOTA) object detection model for 2023 - YOLOv8 🚀!

Designed to be fast, accurate, and easy to use, YOLOv8 is an ideal choice for a wide range of object detection, image segmentation and image classification tasks. With YOLOv8, you'll be able to quickly and accurately detect objects in real-time, streamline your workflows, and achieve new levels of accuracy in your projects.

Check out our YOLOv8 Docs for details and get started with:

pip install ultralytics
MSR2201 commented 1 year ago

Yes I have followed the tips and best training results and i am doing custom training and just now i have changed the location of the dataset to local thing even though i did that i am getting same error there is only one class i even mentioned how the lables are present in the train data and the custom.yaml is like this

image

and i have provided enough data as it is to solve the bug please resolve the issue

MSR2201 commented 1 year ago

Sorry by mistake i closed the issue

glenn-jocher commented 1 year ago

@MSR2201 no problem at all! If you encounter any further issues or have any other questions, please feel free to open a new issue. We are here to help!

MSR2201 commented 1 year ago

The issue is still persisting can you check the previous error screen shot and give me the solution please

MSR2201 commented 1 year ago

image This is the issue

glenn-jocher commented 1 year ago

@MSR2201 thank you for reaching out, and I apologize for the difficulties you are facing. From the error screenshot you provided, it seems that the labels are not being detected in the specified directory. Please ensure that you have the correct directory path and that you have labels present in the correct format.

Additionally, please make sure that the cache directory for the labels is writable. You might need to check the permissions or create the necessary directories.

If you have already verified these aspects and the issue persists, please provide more details about your dataset structure and any relevant logs or error messages. This will help us further investigate and provide you with a solution.

Thank you for your patience, and we appreciate your interest in YOLOv5.

MSR2201 commented 1 year ago

How to give writable permissions in colab i dont know how to give them still got the same issue after running several times how to give this writable permissions train: WARNING ⚠️ No labels found in /content/train_data/labels/train.cache. See https://docs.ultralytics.com/yolov5/tutorials/train_custom_data train: WARNING ⚠️ Cache directory /content/train_data/labels is not writeable: [Errno 2] No such file or directory: '/content/train_data/labels/train.cache.npy' Traceback (most recent call last):

glenn-jocher commented 1 year ago

@MSR2201 permissions in Google Colab can be managed using the chmod command. To give writable permissions to a directory, you can use the following command:

!chmod +w /content/train_data/labels

This will allow write access to the labels directory. Please make sure that the directory path is correct.

If you encounter a No such file or directory error, you may need to create the directory first using the mkdir command:

!mkdir /content/train_data/labels

After creating the directory, use the chmod command to give it writable permissions as mentioned before.

Please run these commands and check if the issue persists. If you have any further questions or need additional assistance, feel free to ask.

glenn-jocher commented 1 year ago

@MSR2201 based on the provided information, it seems that the issue persists even after granting writable permissions and configuring the labels correctly. Let's try a few troubleshooting steps to further investigate the problem:

  1. Double-check the path to the labels directory: Ensure that the path /content/train_data/labels is correct and matches the directory structure of your dataset.

  2. Verify the formatting of the labels: Ensure that the labels are in the correct format and correspond to the images in your dataset.

  3. Check the file types of the labels: Make sure that the label files have the correct file extension, such as .txt, and match the corresponding image file names.

  4. Confirm the cache directory: Verify that the cache directory path /content/train_data/labels/train.cache.npy is writable and exists. If it doesn't exist, create it using the mkdir command:

!mkdir /content/train_data/labels
  1. Restart the runtime: Sometimes, restarting the Colab runtime can resolve issues related to file permissions or caching. You can restart the runtime by following these steps: Runtime -> Restart Runtime.

If the issue persists after following these troubleshooting steps, please provide additional information, such as the dataset structure, sample images and labels, and any relevant training logs or error messages. This will help us further investigate the problem and provide you with a more specific solution.

Thank you for your patience, and we appreciate your interest in YOLOv5.

MSR2201 commented 1 year ago

Now i got it Thanks the name of the labels is wrong i kept lables but the trained model is labels sorry for the inconvenience

glenn-jocher commented 1 year ago

@MSR2201 thank you for the update. I'm glad to hear that you found the issue. It's common to overlook small details like file names, so no worries!

If you have any further questions or need assistance with anything else, feel free to ask. We're here to help.

Happy training!

15738281321 commented 11 months ago

@MSR2201 I still don't quite understand how to solve this problem, can you help me? AssertionError: train: No labels in F:\remote\yolo\yolov7-main\datasets\defect\Images\train.cache. Can not train without labels. See https://docs.ultralytics.com/yolov5/tutorials/train_custom_data 我的文件结构和路径是这样的 image image image