tflite_micro_speech

TF-Lite Micro Speech reference model

Taken from: https://github.com/SiliconLabs/platform_ml_models/tree/master/eembc/TFLite_micro_speech

Dataset

Model Topology & Training

Performance (floating point model)

  • Accuracy - 93.7%

  • AUC - .993

Note

Performance is somewhat sensitive to the exact process of spectrogram generation. We may need to precisely define that.

Performance (quantized tflite model)

  • Accuracy - 93.1%

  • AUC -* .992

Commands

# Do a "dry run" test training of the model
mltk train tflite_micro_speech-test

# Train the model
mltk train tflite_micro_speech

# Evaluate the trained model .tflite model
mltk evaluate tflite_micro_speech --tflite

# Profile the model in the MVP hardware accelerator simulator
mltk profile tflite_micro_speech --accelerator MVP

# Profile the model on a physical development board
mltk profile tflite_micro_speech --accelerator MVP --device

Model Summary

mltk summarize tflite_micro_speech --tflite

+-------+-----------------+----------------+----------------+-----------------------------------------+
| Index | OpCode          | Input(s)       | Output(s)      | Config                                  |
+-------+-----------------+----------------+----------------+-----------------------------------------+
| 0     | conv_2d         | 49x40x1 (int8) | 25x20x8 (int8) | Padding:same stride:2x2 activation:relu |
|       |                 | 10x8x1 (int8)  |                |                                         |
|       |                 | 8 (int32)      |                |                                         |
| 1     | reshape         | 25x20x8 (int8) | 4000 (int8)    | BuiltinOptionsType=0                    |
|       |                 | 2 (int32)      |                |                                         |
| 2     | fully_connected | 4000 (int8)    | 4 (int8)       | Activation:none                         |
|       |                 | 4000 (int8)    |                |                                         |
|       |                 | 4 (int32)      |                |                                         |
| 3     | softmax         | 4 (int8)       | 4 (int8)       | BuiltinOptionsType=9                    |
+-------+-----------------+----------------+----------------+-----------------------------------------+
Total MACs: 336.000 k
Total OPs: 680.012 k
Name: tflite_micro_speech
Version: 1
Description: TFLite-Micro speech
Classes: yes, no, _unknown_, _silence_
hash: 36dd6db8f633c9fca61b418402ea698f
date: 2022-02-04T19:13:52.143Z
runtime_memory_size: 9028
average_window_duration_ms: 1000
detection_threshold: 185
suppression_ms: 1500
minimum_count: 3
volume_db: 5.0
latency_ms: 0
log_level: info
samplewise_norm.rescale: 0.0
samplewise_norm.mean_and_std: False
fe.sample_rate_hz: 16000
fe.sample_length_ms: 1000
fe.window_size_ms: 30
fe.window_step_ms: 20
fe.filterbank_n_channels: 40
fe.filterbank_upper_band_limit: 7500.0
fe.filterbank_lower_band_limit: 125.0
fe.noise_reduction_enable: True
fe.noise_reduction_smoothing_bits: 10
fe.noise_reduction_even_smoothing: 0.02500000037252903
fe.noise_reduction_odd_smoothing: 0.05999999865889549
fe.noise_reduction_min_signal_remaining: 0.05000000074505806
fe.pcan_enable: True
fe.pcan_strength: 0.949999988079071
fe.pcan_offset: 80.0
fe.pcan_gain_bits: 21
fe.log_scale_enable: True
fe.log_scale_shift: 6
fe.fft_length: 512
.tflite file size: 21.6kB

Model Profiling Report

# Profile on physical EFR32xG24 using MVP accelerator
mltk profile tflite_micro_speech --device --accelerator MVP

 Profiling Summary
 Name: tflite_micro_speech
 Accelerator: MVP
 Input Shape: 1x49x40x1
 Input Data Type: int8
 Output Shape: 1x4
 Output Data Type: int8
 Flash, Model File Size (bytes): 21.6k
 RAM, Runtime Memory Size (bytes): 11.3k
 Operation Count: 684.0k
 Multiply-Accumulate Count: 336.0k
 Layer Count: 4
 Unsupported Layer Count: 1
 Accelerator Cycle Count: 404.6k
 CPU Cycle Count: 115.0k
 CPU Utilization (%): 24.2
 Clock Rate (hz): 78.0M
 Time (s): 6.1m
 Ops/s: 112.3M
 MACs/s: 55.2M
 Inference/s: 164.2

 Model Layers
 +-------+-----------------+--------+--------+------------+------------+----------+----------------------+--------------+-----------------------------------------+------------+--------------------------------+
 | Index | OpCode          | # Ops  | # MACs | Acc Cycles | CPU Cycles | Time (s) | Input Shape          | Output Shape | Options                                 | Supported? | Error Msg                      |
 +-------+-----------------+--------+--------+------------+------------+----------+----------------------+--------------+-----------------------------------------+------------+--------------------------------+
 | 0     | conv_2d         | 652.0k | 320.0k | 380.5k     | 85.7k      | 5.4m     | 1x49x40x1,8x10x8x1,8 | 1x25x20x8    | Padding:same stride:2x2 activation:relu | True       |                                |
 | 1     | reshape         | 0      | 0      | 0          | 20.5k      | 270.0u   | 1x25x20x8,2          | 1x4000       | Type=none                               | True       |                                |
 | 2     | fully_connected | 32.0k  | 16.0k  | 24.1k      | 5.1k       | 360.0u   | 1x4000,4x4000,4      | 1x4          | Activation:none                         | False      | weights_shape[1] (4000) > 2048 |
 | 3     | softmax         | 20.0   | 0      | 0          | 3.7k       | 60.0u    | 1x4                  | 1x4          | Type=softmaxoptions                     | True       |                                |
 +-------+-----------------+--------+--------+------------+------------+----------+----------------------+--------------+-----------------------------------------+------------+--------------------------------+

Model Diagram

mltk view tflite_micro_speech --tflite