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

Hi, I recently tried the uploader and the upload data button from the Dashboard… uploading works but the bounding_boxes.labels.json does not work.

I get the same old errors when I try to use * alone (instead of *.jpg).

Error #1: If you named the label file “bounding_boxes.labels” as described in the documentation, the uploader does not recognize the extension and thus will not upload the label file.

[1/1] Failed to process bounding_boxes.labels: extension not supported (only .wav, .cbor, .json, .jpg, .jpeg, .png, .mp4 and .csv supported)

Error #2: If you play smart and add JSON extension “bounding_boxes.labels.json”, you will get a different error.

[1/1] Failed to upload bounding_boxes.labels.json Missing protected header

In the uploader I get a new Error too. 404 I’m probably locked out now for uploading too much?

Also tried the upload data button

Hello @crippledko,

You need to name your label file bounding_boxes.labels and not bounding_boxes.labels.json

Let me know if that fixes your issue.

Best,

Louis

Also, the uploader is getting smarter…thankyou EdgeImpulse for keeping us out of trouble.
image
There could be another button on this popup, "Goto Dashboard". Clicking the button would open the Dashboard and scroll to the area that shows Labeling Method.

1 Like

Thank you, yes… Windows was not showing the .json, and could not rename it. Had to make a new file that Windows thought was a labels file.

1 Like

Great,

I am not super familiar with Windows but I think there is an option to display/show the extension of the files.

Best,

Louis

Hey Crippledko, How did you overcome the windows format?

Put the @ sign in front of there name and they will get notified by email that you want to message with them.

@crippledko can you help @sanjay?

1 Like

@sanjay, so – just trying to change the name did not work – I made a whole new file and made sure it ended with .labels not .json – hovering over the file will show extensions