Hello,
I'm trying to train a custom model with yolov5 on google colab, but i'm having some problems. I have the images in /content/dataset/images/train/ and labels in /content/dataset/labels/train
The yolov5 folder is in /content/
the yaml file is like this:
train: /content/dataset/images/train/
val: /content/dataset/labels/train/
nc: 11
names: ['1', '1s', '1sit', '1clo', '1l', '2', '3b', '4ba', '3x', '1various', '1t']
Main problems is that i get "AssertionError: No images found"
But if i download the coco128 dataset, i delete its images and place my images in its folders and then modify the coco128.yaml so that it contains my classes only (as the shown above), then i'm able to train without problems, as long as i don't use --cache. If i use --cache it gives me "IndexError: pop from an empty deque"
Sometimes google colab has problems with detecting folders, could that be the problem here? But i've tried factory resetting the instance many times.
I should also mention that some of the classes do not contain any images, will this be a problem for the training in general?
thanks
Hello @amadeok, thank you for your interest in our work! Please visit our Custom Training Tutorial to get started, and see our Jupyter Notebook , Docker Image, and Google Cloud Quickstart Guide for example environments.
If this is a bug report, please provide screenshots and minimum viable code to reproduce your issue, otherwise we can not help you.
If this is a custom model or data training question, please note Ultralytics does not provide free personal support. As a leader in vision ML and AI, we do offer professional consulting, from simple expert advice up to delivery of fully customized, end-to-end production solutions for our clients, such as:
For more information please visit https://www.ultralytics.com.
@amadeok follow the custom training tutorial. Your data should mirror the coco128 layout.
https://github.com/ultralytics/yolov5/wiki/Train-Custom-Data
@amadeok looks like your .yaml file is incorrect.
At the "val:" position you're supplying the path for the (train) labels instead of a folder containing your validation images. If you check the coco128 example you can see that you have to specify only the path for the images folder:
train: ../coco128/images/train2017/
val: ../coco128/images/train2017/
y only the path for the images folder:
>
HI thanks i got it.
Do i have to provide validation images? Are they required for the training or can i leave it empty and just test the model later using detect.py?
@amadeok a validation set is required.
You can use python train.py --notest to skip testing until the final epoch.
@amadeok I would recommend you start with the custom training tutorial, as all of this info is already covered there:
https://github.com/ultralytics/yolov5/wiki/Train-Custom-Data
@amadeok a validation set is required.
You can use
python train.py --notestto skip testing until the final epoch.
I'm using all the images both for training and validation, like this:
train: /content/dataset/images/train/
val: /content/dataset/images/train/
Will that affect the training negatively?
From a theoretical point of view yes. Validation and train should be two separate entities otherwise you'll only evaluate how well the model fit the training data and not its generalization.
That said the code will work, just keep in mind that such result may be meaningless.
@amadeok yes, just as @AndreaBrg said.
I would only add that the validation set will never affect your training results. The only time it is used is to save best.pt.
Most helpful comment
@amadeok looks like your .yaml file is incorrect.
At the "val:" position you're supplying the path for the (train) labels instead of a folder containing your validation images. If you check the coco128 example you can see that you have to specify only the path for the images folder: