在本笔记本中:
我正在尝试运行
AssertionError: train: No labels in /content/datasets/roboflow/train/labels.cache. Can not train without labels.
我认为通常情况下,文件夹火车/测试/验证应包含一个“图像”和一个“标签”(我从带有“ labeltxt”名称的Roboflow Subfolders中获得),所以我创建了从“ labeltxt”到“标签”的重命名(请参阅第二名)。
然后,我收到了像
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'
现在的“火山”和“山”之类的警告,我的班级名称是 data.yaml
content:
path: ../datasets/roboflow
train: train/images
val: valid/images
test: test/images
nc: 3
names: ['done', 'mountain', 'volcano']
有什么想法吗?
谢谢。
编辑:yolov5也可以在实例分段上操作,如 https:https:https:https-custom-dataset/ //blog.roboflow.com/train-yolov5-instance-segentation-custom-dataset/ (现在我更改了方法)。
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.
EDIT: yolov5 can operate also on instance segmentation, as explained in https://blog.roboflow.com/train-yolov5-instance-segmentation-custom-dataset/ (right now I changed approach).
发布评论
评论(3)
Yolov5是对象检测模型。请问为什么您将其用于细分?
您需要在Roboflow上创建一个实例细分项目,然后训练它。 For example: https://blog.roboflow.com/detectron2-custom-instance- 另外,分段/
,如果您尝试对象检测并错误地分割,则这里是有关使用Yolov5培训的教程 - 确保在生成模型培训版本时,将所有带有标签的图像添加到数据集中:在Roboflow上开始您的第一个
项目a href =“ https://help.roboflow.com/en_us/roboflow-train-train/model-training-yolov5-video-tutorial” rel =“ nofollow noreferrer” - 培训/模型训练-Yolov5-Video-Tutorial
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
我认为您使用的数据集已损坏。
文件名由
.png
和.jpg
扩展程序组成,这很奇怪。我建议您将数据集作为zip文件下载,然后将其上传到cottents/
,这也不会损害图像质量。还有为什么您的数据.yaml显示不同的类而不是掩盖?这也是一个错误吗?请提供更多信息以获取更精确的答案。
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 thecontents/
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.
当您的标签不适合培训或不在路径上时,就会发生这种情况。如果路径是问题,请尝试为他们提供绝对的路径:
对我来说,这是因为使用labelimg进行注释,并且有一些预定义的类。因此,我更改了
dataset.yaml
类,因此配置会出错。This happens when your labels are not valid for training or they are not in the path. If the path is the problem, try giving absolute paths for them:
For me, it was because of using labelImg for annotations, and it had some predefined classes. Therefore, I changed the
dataset.yaml
classes and therefore the config would go wrong.