ARM-software / ML-KWS-for-MCU

Keyword spotting on Arm Cortex-M Microcontrollers
Apache License 2.0
1.13k stars 417 forks source link

Quantization, what's the differenct between label_wav.py & C code #124

Open jasonwu1977 opened 4 years ago

jasonwu1977 commented 4 years ago

i follow all the tensorflow procedure, did training/foldering batch/quantize and finally generate weights.h, I use this weights.h for running c-lanugag inference and then i want to compare in between tensorflow and pure c executable, see how they are working inside.

but i get the different result between those 2 Tensorflow

root@8d2a69b04702:/srv/wu/ML-KWS-for-MCU# python label_wav.py --wav /dataset/speech_command/on/0a2b400e_nohash_1.wav --graph ds_cnn_freeze_bnfused.pb --labels Pretrained_models/labels.txt --how_many_labels 1
predictions: [0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 1. 0.]
stop (score = 1.00000)

C Language (I modify and can be run on PC

gl ds-cnn porting v0.80
prediction:[0]:0 [1]:0 [2]:0 [3]:0 [4]:0 [5]:0 [6]:0 [7]:0 [8]:127 [9]:0 [10]:0 [11]:0
[on]

I need to compare the result and procedure between tensorflow & c code, for study purpose Am i right on using label_wav on bnfused.pb? Do i need to write a quantize version of label_wav.py? so that i can use bnfused.pb