-
Notifications
You must be signed in to change notification settings - Fork 198
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Retraining of the KWS model #129
Comments
See here for training code for a compatible model. It is possible that the micro speech model needs different input features to what is expected of the existing kws_micronet_m model (and the ds_cnn model linked above). So if the input sizes do not match then there will be issues running the application. |
I used this scripts to train model (medium version). It did not work. I am gonna check about feature size. |
Hi Richard And i moved to weights to this file;
But it did not work? Is not it possible to share how you produce pretrained model? I can use pretrained model but others does not work? |
When you say it doesn't work is it the result of the model when used in the application are not what you expect? If that is the case then it might be caused by the labels vector here The pretrained micronet model label order is different to that from the training scripts. Try changing your labels in the application to this order and see if that helps? |
Nope. I trained ds_cnn in ML-ZOO with same label. same output size. I generated .tflite file. And I converted it with this; It did not generate anything. Empty screen. No signal has shown. It did not gave error during build project. I did not look the label order, because it did not produce output. |
Would you be able to share the tflite file, and I can try replicating the issue? |
https://drive.google.com/file/d/1xwsQFV7VS4ngEQPy-aGrvO-ZppLsdXKi/view?usp=sharing I trained ds_cnn_medium with default parameters. |
Okay, I converted your model with
It builds but I get the following output when running on Keil Studio Cloud.
Running it again locally I believe this is caused by the Softmax operator in your model that isn't present in the pretrained MicroNet one. TFLite micro needs to know what operators are present in the model for it to work otherwise it will throw an error. I manually enlisted this operator by editing the local cmsis pack at Inference now runs albeit with the wrong result, which may just be the result of the new model. Ideally we should have some way for a user to manually enlist new operators via the API, incase they have changed the model like you have done. We have a task to do this but I am not sure of when this will be completed. You can make local edits to the cmsis-packs yourself as well to get things working but this is probably not a sustainable solution, instead I think you have 2 ways to go forward:
|
Hi Richard And I gave output with "x" variable. My new code looks like;
I trained model, replaced the weigths, and got build. (Default labels, and parameters used) But now, it show the audio signal, however does not show keyword or any text. Should I change it Relu, something else i need to fix it? BR |
It matches, but it does not give any output. Even wrong keyword. It did not print any text to screen |
Are not there any open-source code for training script of micronet model which you use? |
Hi Is it possible to share your modifications in this part? So i can try same changing, and i can get result with my own model. in this part; |
Apologies for the delay responding. We don't have opensource model description of micronet but you can use the training code you already have and add micronet style model in yourself if you wish to by inspecting the tflite file in Netron and implementing it in the right place of the training code. However, that shouldn't be necessary now that you have removed softmax from your model already, your model should now work. To fix the blank output you will need to also make the change I did to these 2 lines as I think your input shape is different to the included model. They should change to this I believe: As this was getting it from the model input shape originally. Give that a try and it should hopefully not give blank output anymore (fingers crossed). |
Still blank output... can you show me these modifications also; so i can try same model which you tried.
|
After line 32 add:
Line 49 you need to increase ms_maxOpCnt by 1
Line 207 change last parameter to false so it will be: Did you try running with your new model (that doesn't have softmax) on CS300 FVP, either locally or via Keil Studio Cloud, and what output did you get on the console? I should hope to see some error or output message on the console to see at what point it is getting to when executing, which might help to debug. |
Hi Richard You referred the main wav in here; but I guess it should main_live.cc
Thanks |
I did not use CS300 FVP, or something like that before. I am getting build with .bin . And running on F46. How can i get CS300 FVP to see the errors. |
I would think you should be able to see outputs over serial for your board as well. Public CS300 FVP are available to download here. |
Hi
I am trying to create a new KWS model. I trained a model on this notebook.
https://github.com/tensorflow/tflite-micro/blob/main/tensorflow/lite/micro/examples/micro_speech/train/train_micro_speech_model.ipynb
I moved weights to nn_model variable in kws_micronet_m.tflite.cpp. And I changed Labels.cpp .
I am using Keil Studio for model deployment. I can use pretrained model.
It did not work. I deployed to MCU, but it did not open KWS. How can i train with new keywords?
MCU model: F46
The text was updated successfully, but these errors were encountered: