How to import (map?) class names

Hi there - I’m new to the platform so this question is probably simple to answer. How do I get roboflow to recognize my class names? Right now, I only have numbers as classes because I use a dataset.yaml file to map numbers (open image v7) to names.

I have a dataset on my local machine. Standard folder structure:

/dataset
├── dataset.yaml
├── images
│   ├── train
│   └── val
└── labels
    ├── train
    └── val

I uploaded this using the CLI roboflow import -w myupload -p myproject_id ./dataset

My dataset.yaml contains the mapping of class names, like so

train: ./images/train/
val: ./images/val/
nc: 601
names:
  0: Accordion
  1: Adhesive tape
  2: Aircraft
  3: Airplane
...

On Roboflow, I only see numbers as class names.

Roboflow doesn’t seem to recognize the dataset.yaml at all when importing.

I have around 600 classes so ideally there’s a way to programmatically do the mapping?

I’m on the free plan and don’t really want to upgrade to do something as simple as mapping names - any ideas?

Hi @sp88011!
Welcome to the Roboflow community!! I am sorry you have run into this issue. I am reaching out to the appropriate team and will keep you in the loop.

Thanks for your patience!

thanks @Ford - any insights so far?

Hi @sp88011!
Thank you for your patience! In talking with our team, you can upload any format listed on our accepted annotation formats page. Otherwise you can manually convert to an accepted format and then upload images and annotations via the SDK, API, or web app.

You can drag and drop to upload annotations in the Roboflow web app. See the screenshot below:

Thanks for getting back to me, and sorry to be dense…it seems like the YOLOv5 format that you expect differs from the official one?

You expect:

nc: 3
names: ['head', 'helmet', 'person']
...

The official YOLO v5 format looks like this:

...

# Classes
names:
  0: person
  11: bicycle
  20: car
  32: motorcycle
  99: airplane
...

So when trying to upload my .yaml file through the web app, the screen flashes quickly but nothing happens. No error message, no classes imported.

So I’m wondering whether my .yaml file just isn’t working for you due to its format.

Based upon this behavior, its important to note that annotations must be uploaded with their corresponding images in the same batch. If you attempt to upload annotations without their associated images, you receive this aforementioned behavior.

We will clarify this in the upload page, thank you for the feedback!!

Okay, it seems like there may be a bug when you upload via the CLI.

When I use the web app and simply drag and drop my folder (my-dataset), the names of my classes are imported correctly.

When I use the CLI like so, the names are not imported:

roboflow import -w my-user -p my-project-id ./datasets/my-dataset

Hi @sp88011!
I’ve been testing this today and was able to replicate the disparity. Thank you for bringing this to our attention, I will notify the appropriate teams.

In the meantime, I suggest using the drag & drop upload while we address this. Thanks again for bringing this forward!

Hi @sp88011!
Great news! We’ve deployed the fix, please update your library to Roboflow 1.2.1

Roboflow now supports both List and Key-Value pair formatted data.yaml files for upload via the CLI.

nc: 3
names: ['head', 'helmet', 'person']
...

OR

...

# Classes
names:
  0: person
  11: bicycle
  20: car
  32: motorcycle
  99: airplane
...

Side note for community visibility. When installing the CLI, please install from pypi using pip install roboflow. Installing from npm will install a deprecated version.