Passing data to deployed model in javascript

I have a question about how to use a model with real data.

I have deployed the model in javascript. The tutorial shows how to use it with raw features copied from edge impulse. My question is how to go to the next step and classify new audio data. I would like to pass a single recording to a model and get a response if a specific word is included in the audio file passed to the model.

Is it possible or is there something I am missing?

Hello @CzlowiekSledz,

Yes that’s feasible as long as your recording length matches your window size.
Have you used the Linux NodeJS SDK or the WebAssembly deployment method for your JS deployment?

Regards,

Louis

Thanks for the fast reply as always. I used WebAssembly.

So basically there is now a way to find a specific word that the model is trained to recognize in longer audio files right? I have to first split it into files that are for example 1 second length correct?

Yes correct.

In your case, you’ll need to split your long audio sample and then run the inference on all the sub audio files.
In a real application, you can hide the background process and just output in which subsection your keywords have been detected.

Regards,

Louis

Thank you.

Do you have maybe some tutorial or can you guide me on how to pass these splited audio files to model and get a classification?

Hello @CzlowiekSledz ,

Here is an example on how we tackle this but it’s using the NodeJS SDK:

It’s using the microphone but I guess you can easily switch to use an audio file :slight_smile:

And for the WebAssembly, I guess you can add a forEach before invoking the classifier, something like that (I have not tested):

const features_list = ['FeatureFromWindow1', 'FeatureFromWindow2', 'FeatureFromWindow3', ...]

// Initialize the classifier, and invoke with the argument passed in
let classifier = new EdgeImpulseClassifier();
classifier.init().then(async () => {
    // ---- Put your foreEach loop here ----
     features_list.forEach(features_list => {
       let result = classifier.classify(item.trim().split(',').map(n => Number(n)));
       console.log(results)
    })
   
}).catch(err => {
    console.error('Failed to initialize classifier', err);
});

Regards,

Louis