ML-KWS-for-MCU icon indicating copy to clipboard operation
ML-KWS-for-MCU copied to clipboard

Deployment of CRNN on STM32F746 mcu

Open saichand07 opened this issue 6 years ago • 10 comments

@navsuda Thanks for this tutorial, I have a quantized version of CRNN, I would like to know, will Arm release recurrent functions for GRUs and LSTMs ?

saichand07 avatar Jan 21 '19 16:01 saichand07

Hi @saichand07 , Great ob in quantizing the CRNN model. I have a quick question for you. Could you share some insights on how did you go about quantizing the CRNN? You don't need to share your code, but if you can give me a brief overview, it would be great!

Thanks a lot.

bkanaki avatar Jan 25 '19 00:01 bkanaki

Hi @bkanaki , I have used tensorflow act_max function for the quantization process, In this tutorial they have provided us quant_models.py for DNN and DS_CNN models, I just followed their method for CRNN model. you can also read this paper for more details https://arxiv.org/abs/1801.06601

Best regards

saichand07 avatar Jan 25 '19 08:01 saichand07

Thank you, @saichand07 . ~~I believe you used fake_quant_with_min_max_vars function, correct? The examples use that. But how did you calculate the act_max for each layer? OR did you just keep it at the default 128? I am not certain about how to calculate these values as of now. I checked the examples in quant_models.py.~~

I figured out what you mean in your reply. Now I only have two questions. 1. As this CRNN model uses two GRU cells, so do you need to put the fake_quant... calls twice? If so, how do you do that as I think we will have to get rid of MultiRNNCell call. 2. Are you getting the similar accuracy as the float model?

Once again, thanks for your help.

bkanaki avatar Jan 25 '19 17:01 bkanaki

yes, I have used fake_quant_with_min_max_vars twice and I got nearly 1% depletion in accuracy.

saichand07 avatar Jan 27 '19 10:01 saichand07

Thanks! Were you able to verify that the fake quant nodes are added after each activation in the both GRU cells? For example, by inspecting the frozen graph trough tensorboard.

bkanaki avatar Jan 28 '19 18:01 bkanaki

Thanks for asking this question :), I had verified that the fake_quant nodes are added after each activation in the both GRU cells, Have you deployed any of these models on MCU boards ?

saichand07 avatar Jan 29 '19 15:01 saichand07

No. Unfortunately I cannot verify the two fake quant nodes for each GRU cell. So I haven't done the next part.

bkanaki avatar Jan 29 '19 18:01 bkanaki

@saichand07 I'm new in this topic. Would you mind to share the .py of CRNN to me?

HKLee2040 avatar Mar 29 '19 15:03 HKLee2040

@HKLee2040 CRNN GRU, LSTM were provided in this tutorial, check models.py

saichand07 avatar Apr 02 '19 10:04 saichand07

@saichand07 Got it! Thanks

HKLee2040 avatar Apr 05 '19 01:04 HKLee2040