Upload existing data question

I have images to be uploaded for training.
I can see a mechanism to either add a label manually - presumably for batches of same label images
and I can see that I can label by virtue of the filename.

My question is: is there a mechanism to define the bounding box of the item in the image?

I already have this bounding box of the item in each image - how is it uploaded?
I’m hoping that I do not have to manually apply the bounding box after upload when I already have this information.

Is it possible - for instance to upload via filename, e.g.

label_boundx_boundy_widthx_widthy.instance.png

or similar

Or is the perferred method to use the edge impulse API? I notice there is a ‘bounding-boxes’ call.

So on further reading it seems I could:

  1. Upload the images via the browser based image uploader
  2. Then use the edge API to list the uploaded sample files and set the label bounding boxes

OR

  1. Use the ‘edge impulse injestion service’ to upload the images
  2. Then use the edge API to list the uploaded sample files and set the label bounding boxes

Is there an alternative? Can I set the bounding box in one go with the injestion service?

Hello @gjsmith,

Usually, what I do is use the Edge Impulse CLI Uploader to push my data to EI studio:

In the same folder as your images, you need to add a custom file bounding_boxes.labels being JSON-formated as follow:

{
    "version": 1,
    "type": "bounding-box-labels",
    "boundingBoxes": {
        "mypicture.jpg": [{
            "label": "jan",
            "x": 119,
            "y": 64,
            "width": 206,
            "height": 291
        }, {
            "label": "sami",
            "x": 377,
            "y": 270,
            "width": 158,
            "height": 165
        }]
    }
}

Here is an example I have been using to convert Yolo v5 PyTorch bounding box to Edge Impulse Bounding Box ingestion format: https://colab.research.google.com/drive/1ff-T7J2o4tLA4bgiqFvigJML4YMv3xJQ?usp=sharing:

What I have been doing is:

  • Get the public dataset, unzip it
  • Create a ei_dataset folder
  • Create a base json file with the following properties:
bounding_boxes_json = {
    "version": 1,
    "type": "bounding-box-labels",
    "boundingBoxes": {
        
    }
}
  • Loop over all the images and bounding boxes to convert it to Edge Impulse format
  • Copy the pictures I needed to ei_dataset folder and update the bounding_boxes.labels file
  • Install Edge Impulse CLI
  • Upload everything in the ei_dataset folder to Edge Impulse

With this base Jupyter notebook, you can easily modify / adapt it and extract the bounding boxes from the image name (like you suggested label_boundx_boundy_widthx_widthy.instance.png) or convert other format of datasets with images & bounding boxes to EI format.

I hope this will help you,

Regards,

Louis

1 Like