Search code examples
imagelabelyolov5roboflow

Labelling data in order to train a YOLOv5 model on a custom dataset


I used the source code (ModifiedOpenLabelling) to label my images for Train YOLOv5 Object Detection.

The problem is that after labeling my images, I tried to train a model in roboflow, but I could not use the annotations of the images.

My annotations are in a txt file, in the following format:

2 0.3107142857142857 0.5509554140127388 0.30714285714285716 0.89171974522293
1 0.9696428571428571 0.39331210191082805 0.060714285714285714 0.7292993630573248
1 0.7241071428571428 0.5047770700636943 0.23035714285714284 0.9713375796178344
1 0.07946428571428571 0.4968152866242038 0.15892857142857142 0.9745222929936306
1 0.4982142857142857 0.5031847133757962 0.17857142857142858 0.9617834394904459

When I tried to upload in roboflow, the message was shown: Please add your labelmap text file (if you have one) to translate the numeric class identifiers into human-readable names.

Does anyone know what is the best way to do this conversion or how I can make the labelmap?


Solution

  • this article explains labelmaps: https://blog.roboflow.com/label-map/

    I would suggest creating a "data.yaml" file. Be sure to update the references to the folder paths for your "train" and "validation" set folders; ensure the "nc" (number of classes) field matches the number of classes in your dataset; and update the label names in the list. Example data.yaml file from Roboflow - exported in YOLOv5 Pytorch format

    Another option is to upload the images to Roboflow, use Modify Classes to generate a version of the dataset with the class names you desire, and continue your project from there, or export the Modified Classes dataset version to a new project and continue with the permanent "new" label names from there.

    Additionally, I highly recommend continuing to label new projects on Roboflow, as we have the ability to ingest and convert datasets with annotations in 26 different formats: https://roboflow.com/formats