ARM-software / ML-KWS-for-MCU

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

Defined names in weights.h different from ds_cnn_weights.h #128

Open arvoelke opened 4 years ago

arvoelke commented 4 years ago

I tried to create a new header file for the DS-CNN by running:

python train.py --model_architecture ds_cnn ...

python fold_batchnorm.py --model_architecture ds_cnn ...

python quant_test.py --model_architecture ds_cnn ...

but the resulting weights.h file uses different #define names than those in Deployment/Source/NN/DS_CNN/ds_cnn_weights.h.

Specifically, weights.h contains definitions for:

DS-CNN_conv_1_weights_0
DS-CNN_conv_1_biases_0
DS-CNN_conv_ds_1_dw_conv_depthwise_weights_0
DS-CNN_conv_ds_1_dw_conv_biases_0
DS-CNN_conv_ds_1_pw_conv_weights_0
DS-CNN_conv_ds_1_pw_conv_biases_0
DS-CNN_conv_ds_2_dw_conv_depthwise_weights_0
DS-CNN_conv_ds_2_dw_conv_biases_0
DS-CNN_conv_ds_2_pw_conv_weights_0
DS-CNN_conv_ds_2_pw_conv_biases_0
DS-CNN_conv_ds_3_dw_conv_depthwise_weights_0
DS-CNN_conv_ds_3_dw_conv_biases_0
DS-CNN_conv_ds_3_pw_conv_weights_0
DS-CNN_conv_ds_3_pw_conv_biases_0
DS-CNN_conv_ds_4_dw_conv_depthwise_weights_0
DS-CNN_conv_ds_4_dw_conv_biases_0
DS-CNN_conv_ds_4_pw_conv_weights_0
DS-CNN_conv_ds_4_pw_conv_biases_0
DS-CNN_fc1_weights_0
DS-CNN_fc1_biases_0

whereas the original ds_cnn_weights.h contains definitions for:

CONV1_WT
CONV1_BIAS
CONV2_DS_WT
CONV2_DS_BIAS
CONV2_PW_WT
CONV2_PW_BIAS
CONV3_DS_WT
CONV3_DS_BIAS
CONV3_PW_WT
CONV3_PW_BIAS
CONV4_DS_WT
CONV4_DS_BIAS
CONV4_PW_WT
CONV4_PW_BIAS
CONV5_DS_WT
CONV5_DS_BIAS
CONV5_PW_WT
CONV5_PW_BIAS
FINAL_FC_WT
FINAL_FC_BIAS

Am I missing some step for generating weights.h? Or am I supposed to go through and modify all these names to be the same as before?

arvoelke commented 4 years ago

Update: I went through and changed all the names accordingly, and that appeared to work. However, I'm still wondering if I missed a step, or did something incorrectly to end up with all of the wrong variable names in weights.h.