I have started exploring Tensorflow.js and have built a speech-commands example that is based on TensorFlow.js Speech Commands Model Demo 1
Creating and using a model using transfer learning works great. It is able to detect the new commands I say correctly.
What does not work is downloading a model and uploading it again.
When I download a model with 2 words in it (including background noise), and upload the file again, the countExamples() function of the transferRecognizer shows the correct words, so I have the idea the model has loaded correctly.
However as soon as I start using it, I get the following error
speech-commands.esm.js:17 Uncaught (in promise) Error: Mismatch between the last dimension of model’s output shape (20) and number of words (2).
at t. (speech-commands.esm.js:17)
Indeed, when I make a model with 20 words (including background noise), download it and upload it again, the model runs without generating this error, but this is not really what I want.
I have a hunch that the 20 is based on the default ‘18w’ that tensorflowjs provides.
Am I overlooking something? Should I set the number of words in an uploaded model for example?