How to Upload Pre-Labeled Data to EdgeImpulse
EdgeImpulse is popular among Edge AI developers for its ease of use, but uploading your own pre-labeled data is not quite straightforward. I am sharing some tips on how to do that.
· The Official Story
∘ Actual Errors
· How to Upload Using edge-impulse-uploader
∘ Install Edge Impulse CLI
∘ Configure and Upload
∘ Labels without spaces
· Conclusion
· References

EdgeImpulse is an end-to-end platform for developing Machine Learning solutions on edge devices. You can use EdgeImpulse Studio to connect edge devices to collect and label data, train, deploy, and inference all in a single UI interface on a browser.

While EdgeImpulse Studio provides a great low-code interface for anyone interested in developing Edge AI solutions in general, there are a few rough edges (pun not intended) when it comes to uploading your own data that you already labeled outside of EdgeImpulse.
Such a scenario is quite common actually, especially for object detection. Each image needs to be annotated with carefully drawn bounding boxes. It is quite labor-intensive and time-consuming so it is best if we get professional help, like outsourcing to an annotation company like Testworks.
Once you have the labeled data, then you can upload them to EdgeImpulse and train the model immediately. EdgeImpulse does provide the functionality to upload your own labels, but the official documentation is not complete or accurate, and thus the reason for me writing the article.
The Official Story
According to EdgeImpulse documentation, here are the steps to upload your own labeled data.
- Annotate the target objects and save them in the provided JSON format. (Or alternatively, you can convert from other formats. Here are a few examples of how to convert).
- Rename the JSON file to “bounding_boxes.labels” and place it in the same folder where the images are.
- Upload the images together with the label file from the Studio.
Actual Errors
This looks easy but when you go to the uploader and select all files together with the label file, an error occurs.

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. Ouch!
[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
How to Upload Using edge-impulse-uploader
The issue with the EdgeImpulse Studio uploader might take some time to fix. If you cannot wait till the indefinite time like I was, you can follow along and try edge-impulse-cli.
Install Edge Impulse CLI
To do so, you can install it from: https://github.com/edgeimpulse/edge-impulse-cli.
- Install Node.js v12 or higher on your host computer.
- Install the CLI tools via:
$npm install -g edge-impulse-cli
To do it in Windows 10, you have to configure a few things
- Add Python to PATH:
set PATH=%PATH%;C:\Users\MyAlias\AppData\Local\Programs\Python\Python39
- Set PYTHON environment variable
set PYTHON=%PATH%;C:\Users\MyAlias\AppData\Local\Programs\Python\Python39\python.exe
Then you are set to use edge-impulse-uploader cli.
Configure and Upload
Before you start uploading, you have to configure the edge-impulse settings file. In Windows 10, it is saved as “edge-impulse-config.json” under your user folder.
C:\Users\MyAlias>more edge-impulse-config.json
{
"host": "edgeimpulse.com",
"jwtToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOjI5Mzk2LCJpYXQiOjE2MzExNzYzODYsImV4cCI6MTYzMzc2ODM4Nn0.bm_KnecxClb0zysItdC81z6vsFxwp3rKlLjSEOhsZhw",
"lastVersionCheck": 1631776837836,
"dataForwarderDevices": {},
"daemonDevices": {},
"uploaderProjectId": 48274
}
For our purpose, the most important setting is “uploaderProjectId.” You can find the project ID from the EdgeImpulse Dashboard.

Assuming that you have the correct project ID set and the label file “bounding_boxes.labels” in the same image folder “dataset”, the command for uploading images is:
edge-impulse-uploader --category split ".\dataset\*.jpg"
(The optional parameter “ — category split” splits the data automatically into training and test sets.)
Finally, you should now be able to see the labeled data in EdgeImpulse Studio.

Feature explorer shows features in reduced dimensions for visualization.

Labels without spaces
There is a final caution about using pre-labeled data. Since Edge Impulse labels are in JSON format, you would think that spaces can be inserted to help readability. For instance, here is what you might want to upload as labels:
{
"version": 1,
"type": "bounding-box-labels",
"boundingBoxes": {
"Cars0.png": [
{
"label": "license",
"x": 226,
"y": 125,
"width": 193,
"height": 48
}
]
}
}
Unfortunately, this will NOT work. If you upload the labels file with this format, Edge Impulse will interpret it as:
{
"version": 1,
"type": "bounding-box-labels",
"boundingBoxes": {
"Cars0.png": [
{
"label": "license",
"x": 0,
"y": 226,
"width": 125,
"height": 193
}
]
}
}
In other words, x will get the value of the space (the empty space is turned into 0) and the actual x value 226 will become the y value instead, and the real y value is shifted to the next, etc. You can verify what Edge Impulse does by uploading the labels file and exporting (downloading) the image data.
Once again, if you cannot wait till Edge Impulse fixes its bugs, you can work around it by removing any space between elements. In Python, this can be easily done by specifying separators when calling json.dumps:
json.dumps(labels, separators=(',', ':'))
The output JSON should be JSON without spaces:
{"version":1,"type":"bounding-box-labels","boundingBoxes":{"Cars0.png":[{"label":"license","x":226,"y":125,"width":193,"height":48}]}}
With the correctly formattedbounding_box.labels file in place, the uploader should work as expected.
Conclusion
Every software is not perfect and EdgeImpulse is no exception. While it is a great low-code tool for the general public, I stumbled upon a lot of undocumented or hard-to-find tips on how to use the tool correctly. For me, the biggest issue was the uploader issue and I hope you found my tips useful. Thanks for reading.
References
- EdgeImpulse official documentation on uploader: https://docs.edgeimpulse.com/docs/cli-uploader
- This notebook has some uploader examples that helped me discover the correct command line parameters for the uploader especially regarding the correct star (*) syntax for image files: https://colab.research.google.com/drive/1ff-T7J2o4tLA4bgiqFvigJML4YMv3xJQ?usp=sharing%3A