-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
'No labels found' after 'Caching labels' #1024
Comments
I also got the same error. |
I resolved it.
remove one '.' from class files. |
but you put the coco folder outside of yolo folder, right? |
Inside the yolo folder where train.py exists. |
all paths are relative to the yolov3 folder. In the tutorials the coco folder is alongside the yolov3 folder, not inside it. |
@glenn-jocher I also tried with coco. I left everything as it is in the tutorial. I tried with the image set of data/coco1cls.txt, and coco alongside with yolo. Only created a coco1.names file with one class in it, and a coco1cls.data file: And the training died just like before: |
@emmbertelen I updated the error message to show you exactly where it is looking in f54d28b If you git pull and try again it will show you the search folder. You should use the directory structure established in the tutorial and go from there. |
For example, if I rename my coco folder and try to train, I see this. This path is relative to the yolov3 folder. Namespace(accumulate=4, adam=False, batch_size=16, bucket='', cache_images=False, cfg='cfg/yolov3-spp.cfg', data='data/coco16.data', device='', epochs=300, evolve=False, img_size=[416], multi_scale=False, name='', nosave=False, notest=False, rect=False, resume=False, single_cls=False, weights='weights/yolov3-spp-ultralytics.pt')
Using CPU
Run 'tensorboard --logdir=runs' to view tensorboard at http://localhost:6006/
Model Summary: 225 layers, 6.29987e+07 parameters, 6.29987e+07 gradients
Caching labels: 100%|██████████| 16/16 [00:00<00:00, 86928.58it/s]
Traceback (most recent call last):
File "/Users/glennjocher/PycharmProjects/yolov3/train.py", line 425, in <module>
train() # train normally
File "/Users/glennjocher/PycharmProjects/yolov3/train.py", line 178, in train
single_cls=opt.single_cls)
File "/Users/glennjocher/PycharmProjects/yolov3/utils/datasets.py", line 382, in __init__
assert nf > 0, 'No labels found in %s. See %s' % (os.path.dirname(file) + os.sep, help_url)
AssertionError: No labels found in ../coco/labels/train2017/. See https://docs.ultralytics.com/yolov5/tutorials/train_custom_data
|
@glenn-jocher Thank you very much for your help, it made me identify the problem. My "parent" directory, where I stored my custom images and labels was: 'tower_images'. And look at this: datasets.py replaced every "images" in the path. Im not sure if it is a bug, but this is one of the most hilarious thing that was blocking me for 2 days... Btw Im very thankful for your work and for this yolo implenetation, it really inspires me. |
@emmbertelen ah great! No this is not a bug, it searches for /labels/ next to an /images/ folder. |
please ignore the imagesfake and labelsfake folders |
@Nishaghoul follow the YOLOv5 Train Custom Data Tutorial to get started. You can use COCO128 as an example of the proper dataset structure. YOLOv5 Tutorials
|
I was facing the same issue. I found that my labelling was not in right format. For example my label corresponding to image.jpg should be image.txt but my labeling was image.jpg.txt. |
I am having the same "No labels found error" . Please help! Traceback (most recent call last): |
@pavi2707 if not labels are found then you have set up your dataset incorrectly. See https://docs.ultralytics.com/yolov5/tutorials/train_custom_data for directions of dataset creation. 1.1 Create dataset.yamlCOCO128 is an example small tutorial dataset composed of the first 128 images in COCO train2017. These same 128 images are used for both training and validation to verify our training pipeline is capable of overfitting. data/coco128.yaml, shown below, is the dataset config file that defines 1) the dataset root directory # 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: ../datasets/coco128 # dataset root dir
train: images/train2017 # train images (relative to 'path') 128 images
val: images/train2017 # val images (relative to 'path') 128 images
test: # test images (optional)
# Classes
nc: 80 # number of classes
names: [ 'person', 'bicycle', 'car', 'motorcycle', 'airplane', 'bus', 'train', 'truck', 'boat', 'traffic light',
'fire hydrant', 'stop sign', 'parking meter', 'bench', 'bird', 'cat', 'dog', 'horse', 'sheep', 'cow',
'elephant', 'bear', 'zebra', 'giraffe', 'backpack', 'umbrella', 'handbag', 'tie', 'suitcase', 'frisbee',
'skis', 'snowboard', 'sports ball', 'kite', 'baseball bat', 'baseball glove', 'skateboard', 'surfboard',
'tennis racket', 'bottle', 'wine glass', 'cup', 'fork', 'knife', 'spoon', 'bowl', 'banana', 'apple',
'sandwich', 'orange', 'broccoli', 'carrot', 'hot dog', 'pizza', 'donut', 'cake', 'chair', 'couch',
'potted plant', 'bed', 'dining table', 'toilet', 'tv', 'laptop', 'mouse', 'remote', 'keyboard', 'cell phone',
'microwave', 'oven', 'toaster', 'sink', 'refrigerator', 'book', 'clock', 'vase', 'scissors', 'teddy bear',
'hair drier', 'toothbrush' ] # class names 1.2 Create LabelsAfter using a tool like Roboflow Annotate to label your images, export your labels to YOLO format, with one
The label file corresponding to the above image contains 2 persons (class 1.3 Organize DirectoriesOrganize your train and val images and labels according to the example below. YOLOv5 assumes ../datasets/coco128/images/im0.jpg # image
../datasets/coco128/labels/im0.txt # label |
I am also facing the same error |
@RAravindDS 👋 Hello! Thanks for asking about YOLOv5 🚀 dataset formatting. To train correctly your data must be in YOLOv5 format. Please see our Train Custom Data tutorial for full documentation on dataset setup and all steps required to start training your first model. A few excerpts from the tutorial: 1.1 Create dataset.yamlCOCO128 is an example small tutorial dataset composed of the first 128 images in COCO train2017. These same 128 images are used for both training and validation to verify our training pipeline is capable of overfitting. data/coco128.yaml, shown below, is the dataset config file that defines 1) the dataset root directory # 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: ../datasets/coco128 # dataset root dir
train: images/train2017 # train images (relative to 'path') 128 images
val: images/train2017 # val images (relative to 'path') 128 images
test: # test images (optional)
# Classes
nc: 80 # number of classes
names: [ 'person', 'bicycle', 'car', 'motorcycle', 'airplane', 'bus', 'train', 'truck', 'boat', 'traffic light',
'fire hydrant', 'stop sign', 'parking meter', 'bench', 'bird', 'cat', 'dog', 'horse', 'sheep', 'cow',
'elephant', 'bear', 'zebra', 'giraffe', 'backpack', 'umbrella', 'handbag', 'tie', 'suitcase', 'frisbee',
'skis', 'snowboard', 'sports ball', 'kite', 'baseball bat', 'baseball glove', 'skateboard', 'surfboard',
'tennis racket', 'bottle', 'wine glass', 'cup', 'fork', 'knife', 'spoon', 'bowl', 'banana', 'apple',
'sandwich', 'orange', 'broccoli', 'carrot', 'hot dog', 'pizza', 'donut', 'cake', 'chair', 'couch',
'potted plant', 'bed', 'dining table', 'toilet', 'tv', 'laptop', 'mouse', 'remote', 'keyboard', 'cell phone',
'microwave', 'oven', 'toaster', 'sink', 'refrigerator', 'book', 'clock', 'vase', 'scissors', 'teddy bear',
'hair drier', 'toothbrush' ] # class names 1.2 Create LabelsAfter using a tool like Roboflow Annotate to label your images, export your labels to YOLO format, with one
The label file corresponding to the above image contains 2 persons (class 1.3 Organize DirectoriesOrganize your train and val images and labels according to the example below. YOLOv5 assumes ../datasets/coco128/images/im0.jpg # image
../datasets/coco128/labels/im0.txt # label Good luck 🍀 and let us know if you have any other questions! |
It's really helpful, I'm facing no labels, (but we have labels), is that
anywhere we need to place the "labels" file directory.
…On Thu, 21 Apr 2022 at 06:31, Glenn Jocher ***@***.***> wrote:
@RAravindDS <https://github.com/RAravindDS> 👋 Hello! Thanks for asking
about YOLOv5 🚀 *dataset formatting*. To train correctly your data must
be in YOLOv5 format. Please see our Train Custom Data
<https://docs.ultralytics.com/yolov5/tutorials/pytorch_hub_model_loading> tutorial for full
documentation on dataset setup and all steps required to start training
your first model. A few excerpts from the tutorial:
1.1 Create dataset.yaml
COCO128 <https://www.kaggle.com/datasets/ultralytics/coco128> is an example small
tutorial dataset composed of the first 128 images in COCO
<http://cocodataset.org/#home> train2017. These same 128 images are used
for both training and validation to verify our training pipeline is capable
of overfitting. data/coco128.yaml
<https://github.com/ultralytics/yolov5/blob/master/data/coco128.yaml>,
shown below, is the dataset config file that defines 1) the dataset root
directory path and relative paths to train / val / test image directories
(or *.txt files with image paths), 2) the number of classes nc and 3) a
list of class names:
# 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: ../datasets/coco128 # dataset root dir
train: images/train2017 # train images (relative to 'path') 128 images
val: images/train2017 # val images (relative to 'path') 128 images
test: # test images (optional)
# Classes
nc: 80 # number of classes
names: [ 'person', 'bicycle', 'car', 'motorcycle', 'airplane', 'bus', 'train', 'truck', 'boat', 'traffic light',
'fire hydrant', 'stop sign', 'parking meter', 'bench', 'bird', 'cat', 'dog', 'horse', 'sheep', 'cow',
'elephant', 'bear', 'zebra', 'giraffe', 'backpack', 'umbrella', 'handbag', 'tie', 'suitcase', 'frisbee',
'skis', 'snowboard', 'sports ball', 'kite', 'baseball bat', 'baseball glove', 'skateboard', 'surfboard',
'tennis racket', 'bottle', 'wine glass', 'cup', 'fork', 'knife', 'spoon', 'bowl', 'banana', 'apple',
'sandwich', 'orange', 'broccoli', 'carrot', 'hot dog', 'pizza', 'donut', 'cake', 'chair', 'couch',
'potted plant', 'bed', 'dining table', 'toilet', 'tv', 'laptop', 'mouse', 'remote', 'keyboard', 'cell phone',
'microwave', 'oven', 'toaster', 'sink', 'refrigerator', 'book', 'clock', 'vase', 'scissors', 'teddy bear',
'hair drier', 'toothbrush' ] # class names
1.2 Create Labels
After using a tool like Roboflow Annotate
<https://roboflow.com/annotate?ref=ultralytics> to label your images,
export your labels to *YOLO format*, with one *.txt file per image (if no
objects in image, no *.txt file is required). The *.txt file
specifications are:
- One row per object
- Each row is class x_center y_center width height format.
- Box coordinates must be in *normalized xywh* format (from 0 - 1). If
your boxes are in pixels, divide x_center and width by image width,
and y_center and height by image height.
- Class numbers are zero-indexed (start from 0).
[image: Image Labels]
<https://user-images.githubusercontent.com/26833433/91506361-c7965000-e886-11ea-8291-c72b98c25eec.jpg>
The label file corresponding to the above image contains 2 persons (class
0) and a tie (class 27):
<https://user-images.githubusercontent.com/26833433/112467037-d2568c00-8d66-11eb-8796-55402ac0d62f.png>
1.3 Organize Directories
Organize your train and val images and labels according to the example
below. YOLOv5 assumes /coco128 is inside a /datasets directory *next to*
the /yolov5 directory. *YOLOv5 locates labels automatically for each
image* by replacing the last instance of /images/ in each image path with
/labels/. For example:
../datasets/coco128/images/im0.jpg # image
../datasets/coco128/labels/im0.txt # label
<https://user-images.githubusercontent.com/26833433/134436012-65111ad1-9541-4853-81a6-f19a3468b75f.png>
Good luck 🍀 and let us know if you have any other questions!
—
Reply to this email directly, view it on GitHub
<#1024 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AUJVEFWBWFFI7X3M2NVQKT3VGCSGVANCNFSM4MDX54DQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
It is not clear what is the difference between the annotations/ folder to the labels/ folder, and why do you need labels/ if the annotations/ includes exactly that. |
👋 Hello! Thanks for asking about YOLOv5 🚀 dataset formatting. To train correctly your data must be in YOLOv5 format. Please see our Train Custom Data tutorial for full documentation on dataset setup and all steps required to start training your first model. A few excerpts from the tutorial: 1.1 Create dataset.yamlCOCO128 is an example small tutorial dataset composed of the first 128 images in COCO train2017. These same 128 images are used for both training and validation to verify our training pipeline is capable of overfitting. data/coco128.yaml, shown below, is the dataset config file that defines 1) the dataset root directory # 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: ../datasets/coco128 # dataset root dir
train: images/train2017 # train images (relative to 'path') 128 images
val: images/train2017 # val images (relative to 'path') 128 images
test: # test images (optional)
# Classes (80 COCO classes)
names:
0: person
1: bicycle
2: car
...
77: teddy bear
78: hair drier
79: toothbrush
1.2 Create LabelsAfter using a tool like Roboflow Annotate to label your images, export your labels to YOLO format, with one
The label file corresponding to the above image contains 2 persons (class 1.3 Organize DirectoriesOrganize your train and val images and labels according to the example below. YOLOv5 assumes ../datasets/coco128/images/im0.jpg # image
../datasets/coco128/labels/im0.txt # label Good luck 🍀 and let us know if you have any other questions! |
@Nishaghoul , @glenn-jocher Hey I'm getting same error for YOLO v7 model. Can you help to solve this error...... |
Is it possible to test using a pretreined model, on a custom dataset?
Is there any solution? |
same error here, did you find a solution? |
!chmod +w /content/gdrive/My\ Drive/{your path here}/data/labels |
@songfy825 hello, Thank you for sharing your solution to the YOLOv3 issue. It is great to hear that the If you have any further questions or require additional support, please do not hesitate to ask. Best, |
thank you for your reply |
@songfy825 hello, You're welcome. If you have any more questions or run into any issues, please don't hesitate to ask. We are here to help. Best, |
I uploaded labels file in my drive .rar then extracted on google drive this solved the problem of no labels , as Idiscovered when upload file in google drive it changes it's format but if you extracted it in your drive it will keep the same format thank you |
@rigvedrs thank you for sharing your solution to the issue. It's great to hear that extracting the labels file directly in your Google Drive helped resolve the problem of missing labels. It seems that uploading the file to Google Drive might change its format, whereas extracting it in your own drive preserves the original format. We appreciate you sharing this insight with the community. If you have any more questions or need further assistance, please feel free to ask. |
@glenn-jocher I am experiencing a similar issue while using YOLO V8 and have added it as an issue here ultralytics/ultralytics#3485 (comment) . Can you check that out please whenever you have time. |
@rigvedrs hi there, Thank you for reaching out and letting us know about the issue you're experiencing with YOLOv8. I understand that you have already added it as an issue on the Ultralytics GitHub repository. As a reminder, please keep in mind that I am the author and maintainer of the Ultralytics YOLOv3 repository, and not the YOLOv8 repository. However, I will do my best to assist you and provide guidance. To ensure your issue receives proper attention, I recommend providing as much detail as possible in your GitHub issue, such as the specific error message, steps to reproduce the issue, and any relevant code snippets. This will help the Ultralytics team and the community understand the problem you are facing and provide effective solutions. Thank you for your understanding, and I hope your issue gets resolved soon. Kind regards, |
Ensure your labels directory is correctly structured. Each image should have a corresponding |
@RAravindDS ensure your labels are in the correct directory structure. Each image should have a corresponding |
🐛 Bug
I work in JupyterLab. I am trying to train with custom data. I have the exact same copy of my directory structure that Train Custom Data showed with Coco. The training stops with 'No labels found' after 'Caching labels'.
Any idea on this?
Thanks.
The text was updated successfully, but these errors were encountered: