in this notebook:
https://colab.research.google.com/drive/1omLGQarT6-WOyQgoXK7d98rj01Ietphm#scrollTo=412Aa8kIs0mi
I am trying to run yolov5 to operate object detection. First I download a dataset (originally created in coco format, then converted in yolov5 format). However when I run the code I got an exception (and before a warning)
AssertionError: train: No labels in /content/datasets/roboflow/train/labels.cache. Can not train without labels.
I think normally folders train/test/validation should contains a "images" and a "labels" (I got from roboflow subfolders with "labelTxt" name), so I created renaming from "labelTxt" to "labels" (see second notebook link).
Then instead I got warnings like
train: WARNING: /content/datasets/roboflow/train/images/hybrid_rgb_0297__volcano_39_ero1_ecc1_rcrat1_png.rf.ab11b2a7ee4ef956fa1439b144057bc9.jpg: ignoring corrupt image/label: could not convert string to float: 'volcano'
train: WARNING: /content/datasets/roboflow/train/images/hybrid_rgb_0305__mountain_0_ero0_ecc0_rcrat0_png.rf.ece26ced043322846c804623ce4a44af.jpg: ignoring corrupt image/label: could not convert string to float: 'mountain'
Now the strings 'volcano' and 'mountain' are my class names, as from data.yaml
content:
path: ../datasets/roboflow
train: train/images
val: valid/images
test: test/images
nc: 3
names: ['done', 'mountain', 'volcano']
Any idea? Thank you.
CodePudding user response:
YOLOv5 is an object detection model. May I ask why you’re using it for segmentation?
You’d want to create an instance segmentation project on Roboflow and then train it. For example: https://blog.roboflow.com/detectron2-custom-instance-segmentation/
Additionally, if you were attempting object detection and said segmentation by mistake, here’s a tutorial on training with YOLOv5 - be sure all images with labels were added to your dataset when you generate the version for model training: Starting Your First Project on Roboflow
Training a YOLOv5 model: https://help.roboflow.com/en_US/roboflow-train/model-training-yolov5-video-tutorial
CodePudding user response:
I assume that the dataset that you are using is corrupted.
The file name consists of .png
and .jpg
extension as well,which is weird. I'll suggest you to download your dataset as zip file and then upload it to the contents/
which will not compromise the image quality also.
And also why your data.yaml shows different classes instead of mask? Is that also an error? Kindly provide more info for more precise answers.