I was trying to use the Edge Impulse API & CLI to fully develop a model (from uploading data to deploying as an Arduino library).
I used https://docs.edgeimpulse.com/reference/createimpulse to create the impulse in my project. I wanted the DSP block to be MFCC. However, when I use https://docs.edgeimpulse.com/reference/generatefeaturesjob to generate the features, I get an error. The error is: “at least one row of the mel filterbank contains all zeros”
But, when I use the regular UI in the Edge Impulse Studio, I don’t get this error. I used the same data. The only difference is how I created the Impulse. Is the MFCC block created in the API different than the one in the studio?
Additionally, in the UI, you can choose “Classifier” as your learning block. Of the options in the API, which one functions in the most similar way? I am using audio .wav files, so I assumed keras-transfer-kws would work best.
Below I have the code for how I uploaded my data and created the impulse. As in the code, my Project ID is 336512. Please let me know if you have any questions!
#set basic ei proj settings
project_id = 336512 # YOUR PROJECT ID
api_key = "ei_9b98922c498895589e062ea4d5afa3022b03af67c67d21a52d4225d06b275568" # YOUR API KEY
deploy_type = "arduino" # CAN CHANGE TO DIFFERENT TYPE
headers = {
"accept": "application/json",
"content-type": "application/json",
"x-api-key": api_key
}
#------------------------------------------------------#
#import all dataset(s)
os.system(f"edge-impulse-uploader --directory dataset --api-key {api_key} --silent")
#------------------------------------------------------#
#create impulse
url = f"https://studio.edgeimpulse.com/v1/api/{project_id}/impulse"
payload = {
"inputBlocks": [
{
"type": "time-series",
"id": 1,
"name": "Time series data",
"title": "Time series data",
"windowSizeMs": 1000,
"windowIncreaseMs": 500,
"frequencyHz": 16000,
"padZeros": True
}
],
"dspBlocks": [
{
"id": 2,
"type": "mfcc",
"name": "MFCC",
"title": "MFCC",
"axes": ["audio"],
"implementationVersion": 1
}
],
"learnBlocks": [
{
"type": "keras-transfer-kws",
"primaryVersion": True,
"id": 3,
"name": "Classifier",
"dsp": [2],
"title": "Classifier"
}
]
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)