JSON data upload can't retain label

Question/Issue:
I tried using json file to upload data into Edge Impulse.

Here’s my JSON file,
{
“version”: 1,
“files”: [
{
“path”: “carrot_01.jpg”,
“category”: “training”,
“label”: { “type”: “label”, “label”: “carrot” }
}
]
}
So, with this JSON file, I want to import 1 carrot_01.jpg image and give a label as “carrot”. Then, I import it to Edge Impulse by running the following command.

edge-impulse-uploader --api-key ei_473767e92df511579e684691d941057914f046d05c8a6304e9038100bf2e767c --info-file dataset.json

The dataset.json is the name of JSON file.

I got the following feedback after I run the command.

Edge Impulse uploader v1.22.0
Endpoints:
API: https://studio.edgeimpulse.com
Ingestion: https://ingestion.edgeimpulse.com

Upload configuration:
Label: Not set, will be inferred from file name
Category: training

[1/1] Uploading carrot_01.jpg OK (974 ms)

Done. Files uploaded successful: 1. Files that failed to upload: 0.

It says that the file is uploaded successfully. However, when I checked at Edge Impulse, the “carrot” label is missing.

I don’t understand why from the feedback, the “Label” says “not set” even though I have specified that in the JSON file. Moreover, if it infers from filename which I have named as carrot_01, the label name still doesn’t retain. Would anyone be able to help me with this ? I am doing image classification project with many training data, so it is impossible for me to label each picture manually.

Regards,

Hi @peter511,

I just tried using your exact JSON and upload command, and it worked for me:

Screenshot 2023-11-28 at 10.22.35 AM

The feedback “not set” form the CLI tool seems to be a bug, and I will let the engineering team know.

If you want to let Studio determine the label from the filename, you must use the format <label>.<unique_id>.<ext>. For example: carrot.01.jpg. If you do that, then you don’t need the JSON file (unless you want to include metadata for each sample). For example, if I have a dataset named something like:

  • carrot.01.jpg
  • carrot.02.jpg
  • apple.01.jpg
  • apple.02.jpg

I can upload these to my project with:

edge-impulse-uploader --api-key ei_4737xxx *.jpg 

Hope that helps!