It been a long time,dont know whether u have solved the problem.
sry that Im not capabale to embed pictures here
1:First, try to change the relative path in the yaml file into absolute path.
2:Second,In fact,here is my doc,you can have try at this.
yaml file:
train: D:\yolov5\datasets\mydata\ImageSets\Main\train.txt
val: D:\yolov5\datasets\mydata\ImageSets\Main\train.txt
test: # test images (optional)
directory:
- **D:\yolov5**
- yolov5-7.0(main project)
- train.py
- detect.py
- .......
- **datasets**(place I store my datas)
- coco128
- iamges
- labels
- readme
- **mydata**
- images(my pictures to train)
- IMG_000001.jpg
- IMG_000002.jpg
- IMG_000003.jpg
......
- labels(labels for my pictures)
- IMG_000001.txt
- IMG_000002.txt
- IMG_000003.txt
......
- **ImageSets**
- **Main**
- **train.txt**
train.txt:
You need to put the path of this folder in the yaml file,yolov5 will scan this file to find your images and labels,!!!!!!!!!!!!
You might doubt that this txt file is neither "images.txt" nor "labels.txt", then how does the model find the datasets they need.
So here is the content of the train.txt
D:\yolov5\datasets\mydata\**images**\IMG_000001.jpg
D:\yolov5\datasets\mydata\**images**\IMG_000002.jpg
......
Yes , you can see that the content of of this "train.txt" is exactly just the absolute path of the pictures that you want to train!!!
Now , you might want to ask again, "what about my labels?"
The code in yolov5 will turn the word "images" in the absolute path mentioned above "D:\yolov5\datasets\mydata\images\IMG_000001.jpg" into "labels" automatically to find your labels file. So you dont need to mention your labelfile's path in this file. And that is exactly why you need to organize your directory like that. And remeber to change the name of your "labels.txt" into "IMG_000001"(just be the same as your images name is OK,"IMG_00000n" is my project name, you dont have to be like that) ,so it can find your labels with the path after changing "images" into "labels" ,
like"D:\yolov5\datasets\mydata\ labels \IMG_000001.jpg"
Hope I can make it clear to you guys . Thanks 4 wathcing.