Uploading a .wav file with Ingestion

Hello,
I’m currently trying the ingestion service and wish to upload a .wav file via ingestion API. I used the documentation example to just rewrite the following:
with open(‘somefile.wav’, ‘r’) as file:
res = requests.post(url=‘https://ingestion.edgeimpulse.com/api/training/data’,
data=file,
headers={
‘Content-Type’: ‘application/wav’,
‘x-file-name’: ‘idle.01’,
‘x-label’: ‘idle’,
‘x-api-key’: API_KEY
})
This results in res.status_code = 422.
Are JSON and CBOR files the only ones allowed to be uploaded this way?
Would I first need to convert the.wav files into one of them to upload it?

@jtiglao You indeed need to wrap it in a JSON or CBOR structure indeed it in that case (give information about the device that collected it, information about the data, optionally sign the data, pull the raw PCM values out). Here’s an example in Node: https://github.com/edgeimpulse/edge-impulse-cli/blob/690c7811cf6c0847e378ff480a8c988986a735bd/cli/make-image.ts#L53

Or just invoke the edge-impulse-uploader from Python.

1 Like