How to upload bbox coordinates from a dataframe into Roboflow

I have an annotated dataset that contains all images(both train & test) in one folder. Each image has an id associated to it. For example the images are like;
id_w55q2qr62fsk.tif, id_fvldv7o1kn9d, id_015i4fpen1ws.tif, etc

The annotations for the images in a csv file with columns id, bbox and category_id;

I want to upload this annotated dataset into Roboflow and turn it into a COCO json format to train further.

This is the dataset; Arm UNICEF Disaster Vulnerability Challenge | Kaggle hosted on Kaggle

Below are the things I need help o;

  1. How can I arrange and set up the dataset and ensure to have every image get matched to it’s own bbox coordinates and actually have the bounding boxes shown.

  2. How can I upload this dataset onto roboflow using code instead of manual upload since the dataset is not on my PC because of storage issues.

Thanks a lot and I would like to get help on this.

Hi @Kamal_Moha

Sounds like an interesting project. I have a few resources and thoughts that might help:

  • Supervision has a object detection dataset interface and the Detections interface.
  • You could write some code to translate the dataset you have to Detections in Supervision
  • Then, associate them with each image while creating the DetectionDataset
  • Then, export the dataset as a COCO dataset using the COCO export method in the DetectionsDataset class
  • Finally, upload the dataset to Roboflow

Although, if your end goal is to upload to Roboflow, I would recommend you export with the Pascal VOC dataset format, since that exports in a 1 image to 1 annotation file format which works well for the project.upload() function in the Roboflow Python SDK or through the REST API.

Hi @leo

I have tried uploading the dataset into roboflow using the roboflow API. Below is the link to the colab notebook;

I have turned the ‘bbox’ coordinates in the dataframe into a YOLO txt format and then did the uploading.

The code runs with no errors, but the images that get uploaded to my roboflow account are wrong.

The above image is one of the images that got uploaded to my roboflow, it is wrong because;

  1. Classes are not shown as expected. The image has only 1 class called ‘objects’ yet it should have classes of 1, 2, 3
  2. Annotations are being displayed on the wrong coordinates. In fact all images are having their bounding boxes at that top corner

Essentially, the whole purpose of this task is to convert the images & annotations into a COCO json format. If there’s an easier way of having it in COCO json, I might need to upload into roboflow. My initial thinking was to upload the dataset into roboflow then export it as COCO json, but if there’s a more direct way, I will do that.

Thanks and please help

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.