1{
2 "cells": [
3  {
4   "cell_type": "markdown",
5   "source": [
6    "# 训练唤醒词模型"
7   ],
8   "metadata": {
9    "colab_type": "text",
10    "id": "pO4-CY_TCZZS"
11   }
12  },
13  {
14   "cell_type": "markdown",
15   "source": [
16    "This notebook demonstrates how to train a 20 kB [Simple Audio Recognition](https://www.tensorflow.org/tutorials/sequences/audio_recognition) model to recognize keywords in speech.\n",
17    "\n",
18    "The model created in this notebook is used in the [micro_speech](https://github.com/tensorflow/tensorflow/tree/master/tensorflow/lite/micro/examples/micro_speech) example for [TensorFlow Lite for MicroControllers](https://www.tensorflow.org/lite/microcontrollers/overview).\n",
19    "\n"
20   ],
21   "metadata": {
22    "colab_type": "text",
23    "id": "BaFfr7DHRmGF"
24   }
25  },
26  {
27   "cell_type": "markdown",
28   "source": [
29    "**Training is much faster using GPU acceleration.** Before you proceed, ensure you are using a GPU runtime by going to **Runtime -> Change runtime type** and set **Hardware accelerator: GPU**. Training 15,000 iterations will take 1.5 - 2 hours on a GPU runtime.\n",
30    "\n",
31    "## 模型配置\n",
32    "\n",
33    "**MODIFY** the following constants for your specific use case."
34   ],
35   "metadata": {
36    "colab_type": "text",
37    "id": "XaVtYN4nlCft"
38   }
39  },
40  {
41   "cell_type": "code",
42   "execution_count": null,
43   "source": [
44    "# A comma-delimited list of the words you want to train for.\n",
45    "# The options are: yes,no,up,down,left,right,on,off,stop,go\n",
46    "# All the other words will be used to train an \"unknown\" label and silent\n",
47    "# audio data with no spoken words will be used to train a \"silence\" label.\n",
48    "WANTED_WORDS = \"on,off\"\n",
49    "\n",
50    "# The number of steps and learning rates can be specified as comma-separated\n",
51    "# lists to define the rate at each stage. For example,\n",
52    "# TRAINING_STEPS=12000,3000 and LEARNING_RATE=0.001,0.0001\n",
53    "# will run 12,000 training loops in total, with a rate of 0.001 for the first\n",
54    "# 8,000, and 0.0001 for the final 3,000.\n",
55    "# TRAINING_STEPS = \"15000,3000\"\n",
56    "TRAINING_STEPS = \"15000,3000\"\n",
57    "LEARNING_RATE = \"0.001,0.0001\"\n",
58    "\n",
59    "# Calculate the total number of steps, which is used to identify the checkpoint\n",
60    "# file name.\n",
61    "TOTAL_STEPS = str(sum(map(lambda string: int(string), TRAINING_STEPS.split(\",\"))))\n",
62    "\n",
63    "# Print the configuration to confirm it\n",
64    "print(\"Training these words: %s\" % WANTED_WORDS)\n",
65    "print(\"Training steps in each stage: %s\" % TRAINING_STEPS)\n",
66    "print(\"Learning rate in each stage: %s\" % LEARNING_RATE)\n",
67    "print(\"Total number of training steps: %s\" % TOTAL_STEPS)"
68   ],
69   "outputs": [],
70   "metadata": {
71    "colab": {},
72    "colab_type": "code",
73    "id": "ludfxbNIaegy"
74   }
75  },
76  {
77   "cell_type": "markdown",
78   "source": [
79    "**DO NOT MODIFY** the following constants as they include filepaths used in this notebook and data that is shared during training and inference."
80   ],
81   "metadata": {
82    "colab_type": "text",
83    "id": "gCgeOpvY9pAi"
84   }
85  },
86  {
87   "cell_type": "code",
88   "execution_count": null,
89   "source": [
90    "# Calculate the percentage of 'silence' and 'unknown' training samples required\n",
91    "# to ensure that we have equal number of samples for each label.\n",
92    "number_of_labels = WANTED_WORDS.count(',') + 1\n",
93    "number_of_total_labels = number_of_labels + 2 # for 'silence' and 'unknown' label\n",
94    "equal_percentage_of_training_samples = int(100.0/(number_of_total_labels))\n",
95    "SILENT_PERCENTAGE = equal_percentage_of_training_samples\n",
96    "UNKNOWN_PERCENTAGE = equal_percentage_of_training_samples\n",
97    "VALIDATION_PERCENTAGE = 10 #10\n",
98    "TESTING_PERCENTAGE = 10 # 10\n",
99    "\n",
100    "print('SILENT_PERCENTAGE : %d' % SILENT_PERCENTAGE)\n",
101    "print('UNKNOWN_PERCENTAGE : %d' % UNKNOWN_PERCENTAGE)\n",
102    "print('VALIDATION_PERCENTAGE : %d' % VALIDATION_PERCENTAGE)\n",
103    "print('TESTING_PERCENTAGE : %d' % TESTING_PERCENTAGE)\n",
104    "\n",
105    "# Constants which are shared during training and inference\n",
106    "PREPROCESS = 'micro'\n",
107    "WINDOW_STRIDE = 20\n",
108    "MODEL_ARCHITECTURE = 'tiny_conv' # Other options include: single_fc, conv,\n",
109    "                      # low_latency_conv, low_latency_svdf, tiny_embedding_conv\n",
110    "\n",
111    "# Constants used during training only\n",
112    "VERBOSITY = 'WARN'\n",
113    "EVAL_STEP_INTERVAL = '100' # '1000'\n",
114    "SAVE_STEP_INTERVAL = '100' # '1000'\n",
115    "BATCH_SIZE = '64' # default 100\n",
116    "\n",
117    "# Constants for training directories and filepaths\n",
118    "DATASET_DIR =  './dataset/'\n",
119    "\n",
120    "LOGS_DIR = 'logs/'\n",
121    "TRAIN_DIR = 'train/' # for training checkpoints and other files.\n",
122    "\n",
123    "# Constants for inference directories and filepaths\n",
124    "import os\n",
125    "MODELS_DIR = 'models'\n",
126    "if not os.path.exists(MODELS_DIR):\n",
127    "  os.mkdir(MODELS_DIR)\n",
128    "MODEL_TF = os.path.join(MODELS_DIR, 'model.pb')\n",
129    "MODEL_TFLITE = os.path.join(MODELS_DIR, 'model.tflite')\n",
130    "FLOAT_MODEL_TFLITE = os.path.join(MODELS_DIR, 'float_model.tflite')\n",
131    "MODEL_TFLITE_MICRO = os.path.join(MODELS_DIR, 'model.cc')\n",
132    "SAVED_MODEL = os.path.join(MODELS_DIR, 'saved_model')\n",
133    "\n",
134    "QUANT_INPUT_MIN = 0.0\n",
135    "QUANT_INPUT_MAX = 26.0\n",
136    "QUANT_INPUT_RANGE = QUANT_INPUT_MAX - QUANT_INPUT_MIN"
137   ],
138   "outputs": [],
139   "metadata": {
140    "colab": {},
141    "colab_type": "code",
142    "id": "Nd1iM1o2ymvA"
143   }
144  },
145  {
146   "cell_type": "markdown",
147   "source": [
148    "## 环境安装\n",
149    "\n",
150    "安装依赖项"
151   ],
152   "metadata": {
153    "colab_type": "text",
154    "id": "6rLYpvtg9P4o"
155   }
156  },
157  {
158   "cell_type": "code",
159   "execution_count": null,
160   "source": [
161    "#%tensorflow_version 1.x\n",
162    "import tensorflow as tf"
163   ],
164   "outputs": [],
165   "metadata": {
166    "colab": {},
167    "colab_type": "code",
168    "id": "ed_XpUrU5DvY"
169   }
170  },
171  {
172   "cell_type": "markdown",
173   "source": [
174    "**DELETE** any old data from previous runs\n"
175   ],
176   "metadata": {
177    "colab_type": "text",
178    "id": "T9Ty5mR58E4i"
179   }
180  },
181  {
182   "cell_type": "code",
183   "execution_count": null,
184   "source": [
185    "#!rm -rf {DATASET_DIR} {LOGS_DIR} {TRAIN_DIR} {MODELS_DIR}\n",
186    "!rm -rf {LOGS_DIR} {TRAIN_DIR} {MODELS_DIR}"
187   ],
188   "outputs": [],
189   "metadata": {
190    "colab": {},
191    "colab_type": "code",
192    "id": "APGx0fEh7hFF"
193   }
194  },
195  {
196   "cell_type": "markdown",
197   "source": [
198    "Clone the TensorFlow Github Repository, which contains the relevant code required to run this tutorial."
199   ],
200   "metadata": {
201    "colab_type": "text",
202    "id": "GfEUlfFBizio"
203   }
204  },
205  {
206   "cell_type": "code",
207   "execution_count": null,
208   "source": [
209    "#!git clone -q --depth 1 https://github.com/tensorflow/tensorflow"
210   ],
211   "outputs": [],
212   "metadata": {
213    "colab": {},
214    "colab_type": "code",
215    "id": "yZArmzT85SLq"
216   }
217  },
218  {
219   "cell_type": "markdown",
220   "source": [
221    "Load TensorBoard to visualize the accuracy and loss as training proceeds.\n"
222   ],
223   "metadata": {
224    "colab_type": "text",
225    "id": "nS9swHLSi7Bi"
226   }
227  },
228  {
229   "cell_type": "code",
230   "execution_count": null,
231   "source": [
232    "#%load_ext tensorboard\n",
233    "#%tensorboard --logdir {LOGS_DIR}"
234   ],
235   "outputs": [],
236   "metadata": {
237    "colab": {},
238    "colab_type": "code",
239    "id": "q4qF1VxP3UE4"
240   }
241  },
242  {
243   "cell_type": "markdown",
244   "source": [
245    "## 模型训练\n",
246    "\n",
247    "The following script downloads the dataset and begin training."
248   ],
249   "metadata": {
250    "colab_type": "text",
251    "id": "x1J96Ron-O4R"
252   }
253  },
254  {
255   "cell_type": "code",
256   "execution_count": null,
257   "source": [
258    "!python ./speech_commands/train.py \\\n",
259    "--data_dir={DATASET_DIR} \\\n",
260    "--wanted_words={WANTED_WORDS} \\\n",
261    "--silence_percentage={SILENT_PERCENTAGE} \\\n",
262    "--unknown_percentage={UNKNOWN_PERCENTAGE} \\\n",
263    "--validation_percentage={VALIDATION_PERCENTAGE} \\\n",
264    "--testing_percentage={TESTING_PERCENTAGE} \\\n",
265    "--batch_size={BATCH_SIZE} \\\n",
266    "--preprocess={PREPROCESS} \\\n",
267    "--window_stride={WINDOW_STRIDE} \\\n",
268    "--model_architecture={MODEL_ARCHITECTURE} \\\n",
269    "--how_many_training_steps={TRAINING_STEPS} \\\n",
270    "--learning_rate={LEARNING_RATE} \\\n",
271    "--train_dir={TRAIN_DIR} \\\n",
272    "--summaries_dir={LOGS_DIR} \\\n",
273    "--verbosity={VERBOSITY} \\\n",
274    "--eval_step_interval={EVAL_STEP_INTERVAL} \\\n",
275    "--save_step_interval={SAVE_STEP_INTERVAL}"
276   ],
277   "outputs": [],
278   "metadata": {
279    "colab": {},
280    "colab_type": "code",
281    "id": "VJsEZx6lynbY"
282   }
283  },
284  {
285   "cell_type": "markdown",
286   "source": [
287    "## 生成tensorflow模型\n",
288    "\n",
289    "Combine relevant training results (graph, weights, etc) into a single file for inference. This process is known as freezing a model and the resulting model is known as a frozen model/graph, as it cannot be further re-trained after this process."
290   ],
291   "metadata": {
292    "colab_type": "text",
293    "id": "XQUJLrdS-ftl"
294   }
295  },
296  {
297   "cell_type": "code",
298   "execution_count": null,
299   "source": [
300    "!rm -rf {SAVED_MODEL}\n",
301    "!python ./speech_commands/freeze.py \\\n",
302    "--wanted_words=$WANTED_WORDS \\\n",
303    "--window_stride_ms=$WINDOW_STRIDE \\\n",
304    "--preprocess=$PREPROCESS \\\n",
305    "--model_architecture=$MODEL_ARCHITECTURE \\\n",
306    "--start_checkpoint=$TRAIN_DIR$MODEL_ARCHITECTURE'.ckpt-'{TOTAL_STEPS} \\\n",
307    "--save_format=saved_model \\\n",
308    "--output_file={SAVED_MODEL}"
309   ],
310   "outputs": [],
311   "metadata": {
312    "colab": {},
313    "colab_type": "code",
314    "id": "xyc3_eLh9sAg"
315   }
316  },
317  {
318   "cell_type": "markdown",
319   "source": [
320    "## 生成Tensorflow Lite模型\n",
321    "\n",
322    "Convert the frozen graph into a TensorFlow Lite model, which is fully quantized for use with embedded devices.\n",
323    "\n",
324    "The following cell will also print the model size, which will be under 20 kilobytes."
325   ],
326   "metadata": {
327    "colab_type": "text",
328    "id": "_DBGDxVI-nKG"
329   }
330  },
331  {
332   "cell_type": "code",
333   "execution_count": null,
334   "source": [
335    "import sys\n",
336    "# We add this path so we can import the speech processing modules.\n",
337    "sys.path.append(\"./speech_commands/\")\n",
338    "import input_data\n",
339    "import models\n",
340    "import numpy as np"
341   ],
342   "outputs": [],
343   "metadata": {
344    "colab": {},
345    "colab_type": "code",
346    "id": "RIitkqvGWmre"
347   }
348  },
349  {
350   "cell_type": "code",
351   "execution_count": null,
352   "source": [
353    "SAMPLE_RATE = 16000\n",
354    "CLIP_DURATION_MS = 1000\n",
355    "WINDOW_SIZE_MS = 30.0\n",
356    "FEATURE_BIN_COUNT = 40\n",
357    "BACKGROUND_FREQUENCY = 0.8\n",
358    "BACKGROUND_VOLUME_RANGE = 0.1\n",
359    "TIME_SHIFT_MS = 100.0\n",
360    "\n",
361    "DATA_URL = 'https://storage.googleapis.com/download.tensorflow.org/data/speech_commands_v0.02.tar.gz'\n",
362    "VALIDATION_PERCENTAGE = 10 #10\n",
363    "TESTING_PERCENTAGE = 10 # 10"
364   ],
365   "outputs": [],
366   "metadata": {
367    "colab": {},
368    "colab_type": "code",
369    "id": "kzqECqMxgBh4"
370   }
371  },
372  {
373   "cell_type": "code",
374   "execution_count": null,
375   "source": [
376    "model_settings = models.prepare_model_settings(\n",
377    "    len(input_data.prepare_words_list(WANTED_WORDS.split(','))),\n",
378    "    SAMPLE_RATE, CLIP_DURATION_MS, WINDOW_SIZE_MS,\n",
379    "    WINDOW_STRIDE, FEATURE_BIN_COUNT, PREPROCESS)\n",
380    "audio_processor = input_data.AudioProcessor(\n",
381    "    DATA_URL, DATASET_DIR,\n",
382    "    SILENT_PERCENTAGE, UNKNOWN_PERCENTAGE,\n",
383    "    WANTED_WORDS.split(','), VALIDATION_PERCENTAGE,\n",
384    "    TESTING_PERCENTAGE, model_settings, LOGS_DIR)"
385   ],
386   "outputs": [],
387   "metadata": {
388    "colab": {},
389    "colab_type": "code",
390    "id": "rNQdAplJV1fz"
391   }
392  },
393  {
394   "cell_type": "code",
395   "execution_count": null,
396   "source": [
397    "with tf.Session() as sess:\n",
398    "  float_converter = tf.lite.TFLiteConverter.from_saved_model(SAVED_MODEL)\n",
399    "  float_tflite_model = float_converter.convert()\n",
400    "  float_tflite_model_size = open(FLOAT_MODEL_TFLITE, \"wb\").write(float_tflite_model)\n",
401    "  print(\"Float model is %d bytes\" % float_tflite_model_size)\n",
402    "\n",
403    "  converter = tf.lite.TFLiteConverter.from_saved_model(SAVED_MODEL)\n",
404    "  converter.optimizations = [tf.lite.Optimize.DEFAULT]\n",
405    "  converter.inference_input_type = tf.lite.constants.INT8\n",
406    "  converter.inference_output_type = tf.lite.constants.INT8\n",
407    "  def representative_dataset_gen():\n",
408    "    set_size = audio_processor.set_size('testing') #get test set size\n",
409    "    for i in range(set_size): # change 100 to set_size\n",
410    "      data, _ = audio_processor.get_data(1, i*1, model_settings,\n",
411    "                                         BACKGROUND_FREQUENCY, \n",
412    "                                         BACKGROUND_VOLUME_RANGE,\n",
413    "                                         TIME_SHIFT_MS,\n",
414    "                                         'testing',\n",
415    "                                         sess)\n",
416    "      flattened_data = np.array(data.flatten(), dtype=np.float32).reshape(1, 1960)\n",
417    "      yield [flattened_data]\n",
418    "  converter.representative_dataset = representative_dataset_gen\n",
419    "  tflite_model = converter.convert()\n",
420    "  tflite_model_size = open(MODEL_TFLITE, \"wb\").write(tflite_model)\n",
421    "  print(\"Quantized model is %d bytes\" % tflite_model_size)\n"
422   ],
423   "outputs": [],
424   "metadata": {
425    "colab": {},
426    "colab_type": "code",
427    "id": "lBj_AyCh1cC0"
428   }
429  },
430  {
431   "cell_type": "markdown",
432   "source": [
433    "## 测试TensorFlow Lite model的精确度\n",
434    "\n",
435    "Verify that the model we've exported is still accurate, using the TF Lite Python API and our test set."
436   ],
437   "metadata": {
438    "colab_type": "text",
439    "id": "EeLiDZTbLkzv"
440   }
441  },
442  {
443   "cell_type": "code",
444   "execution_count": null,
445   "source": [
446    "# Helper function to run inference\n",
447    "def run_tflite_inference(tflite_model_path, model_type=\"Float\"):\n",
448    "  # Load test data\n",
449    "  np.random.seed(0) # set random seed for reproducible test results.\n",
450    "  with tf.Session() as sess:\n",
451    "    test_data, test_labels = audio_processor.get_data(\n",
452    "        -1, 0, model_settings, BACKGROUND_FREQUENCY, BACKGROUND_VOLUME_RANGE,\n",
453    "        TIME_SHIFT_MS, 'testing', sess)\n",
454    "  test_data = np.expand_dims(test_data, axis=1).astype(np.float32)\n",
455    "\n",
456    "  # Initialize the interpreter\n",
457    "  interpreter = tf.lite.Interpreter(tflite_model_path)\n",
458    "  interpreter.allocate_tensors()\n",
459    "\n",
460    "  input_details = interpreter.get_input_details()[0]\n",
461    "  output_details = interpreter.get_output_details()[0]\n",
462    "\n",
463    "  # For quantized models, manually quantize the input data from float to integer\n",
464    "  if model_type == \"Quantized\":\n",
465    "    input_scale, input_zero_point = input_details[\"quantization\"]\n",
466    "    test_data = test_data / input_scale + input_zero_point\n",
467    "    test_data = test_data.astype(input_details[\"dtype\"])\n",
468    "\n",
469    "  correct_predictions = 0\n",
470    "  for i in range(len(test_data)):\n",
471    "    interpreter.set_tensor(input_details[\"index\"], test_data[i])\n",
472    "    interpreter.invoke()\n",
473    "    output = interpreter.get_tensor(output_details[\"index\"])[0]\n",
474    "    top_prediction = output.argmax()\n",
475    "    correct_predictions += (top_prediction == test_labels[i])\n",
476    "\n",
477    "  print('%s model accuracy is %f%% (Number of test samples=%d)' % (\n",
478    "      model_type, (correct_predictions * 100) / len(test_data), len(test_data)))"
479   ],
480   "outputs": [],
481   "metadata": {
482    "colab": {},
483    "colab_type": "code",
484    "id": "wQsEteKRLryJ"
485   }
486  },
487  {
488   "cell_type": "code",
489   "execution_count": null,
490   "source": [
491    "# Compute float model accuracy\n",
492    "run_tflite_inference(FLOAT_MODEL_TFLITE)\n",
493    "\n",
494    "# Compute quantized model accuracy\n",
495    "run_tflite_inference(MODEL_TFLITE, model_type='Quantized')"
496   ],
497   "outputs": [],
498   "metadata": {
499    "colab": {},
500    "colab_type": "code",
501    "id": "l-pD52Na6jRa"
502   }
503  },
504  {
505   "cell_type": "markdown",
506   "source": [
507    "## 模型转换\n",
508    "Convert the TensorFlow Lite model into a C source file that can be loaded by TensorFlow Lite for Microcontrollers."
509   ],
510   "metadata": {
511    "colab_type": "text",
512    "id": "dt6Zqbxu-wIi"
513   }
514  },
515  {
516   "cell_type": "code",
517   "execution_count": null,
518   "source": [
519    "# Install xxd if it is not available\n",
520    "#!apt-get update && apt-get -qq install xxd\n",
521    "# Convert to a C source file\n",
522    "!xxd -i {MODEL_TFLITE} > {MODEL_TFLITE_MICRO}\n",
523    "# Update variable names\n",
524    "REPLACE_TEXT = MODEL_TFLITE.replace('/', '_').replace('.', '_')\n",
525    "!sed -i 's/'{REPLACE_TEXT}'/g_model/g' {MODEL_TFLITE_MICRO}"
526   ],
527   "outputs": [],
528   "metadata": {
529    "colab": {},
530    "colab_type": "code",
531    "id": "XohZOTjR8ZyE"
532   }
533  },
534  {
535   "cell_type": "markdown",
536   "source": [
537    "## 部署到微控制器\n",
538    "\n",
539    "Follow the instructions in the [micro_speech](https://github.com/tensorflow/tensorflow/tree/master/tensorflow/lite/micro/examples/micro_speech) README.md for [TensorFlow Lite for MicroControllers](https://www.tensorflow.org/lite/microcontrollers/overview) to deploy this model on a specific microcontroller.\n",
540    "\n",
541    "**Reference Model:** If you have not modified this notebook, you can follow the instructions as is, to deploy the model. Refer to the [`micro_speech/train/models`](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/lite/micro/examples/micro_speech/train/models) directory to access the models generated in this notebook.\n",
542    "\n",
543    "**New Model:** If you have generated a new model to identify different words: (i) Update `kCategoryCount` and `kCategoryLabels` in [`micro_speech/micro_features/micro_model_settings.h`](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/lite/micro/examples/micro_speech/micro_features/micro_model_settings.h) and (ii) Update the values assigned to the variables defined in [`micro_speech/micro_features/model.cc`](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/lite/micro/examples/micro_speech/micro_features/model.cc) with values displayed after running the following cell."
544   ],
545   "metadata": {
546    "colab_type": "text",
547    "id": "2pQnN0i_-0L2"
548   }
549  },
550  {
551   "cell_type": "code",
552   "execution_count": null,
553   "source": [
554    "# Print the C source file\n",
555    "!cat {MODEL_TFLITE_MICRO}"
556   ],
557   "outputs": [],
558   "metadata": {
559    "colab": {},
560    "colab_type": "code",
561    "id": "eoYyh0VU8pca"
562   }
563  },
564  {
565   "cell_type": "markdown",
566   "source": [
567    "# 生成测试音频流\n",
568    "用于测试TFLite模型,可选。"
569   ],
570   "metadata": {}
571  },
572  {
573   "cell_type": "code",
574   "execution_count": null,
575   "source": [
576    "!python ./speech_commands/generate_streaming_test_wav.py \\\n",
577    "    --wanted_words='on,off' \\\n",
578    "    --data_dir=./my_only_dataset --background_dir=./my_only_dataset/_background_noise_ \\\n",
579    "    --background_volume=0.1 --test_duration_seconds=600 \\\n",
580    "    --output_audio_file=./tmp/streaming_test.wav \\\n",
581    "    --output_labels_file=./tmp/streaming_test_labels.txt"
582   ],
583   "outputs": [],
584   "metadata": {}
585  },
586  {
587   "cell_type": "markdown",
588   "source": [
589    "# 测试音频流准确率"
590   ],
591   "metadata": {}
592  },
593  {
594   "cell_type": "code",
595   "execution_count": null,
596   "source": [
597    "!python ./speech_commands/test_streaming_accuracy.py \\\n",
598    "    --wav=./tmp/streaming_test.wav \\\n",
599    "    --ground-truth=./tmp/streaming_test_labels.txt --verbose \\\n",
600    "    --model=./models/saved_model/ \\\n",
601    "    --labels=./train/tiny_conv_labels.txt \\\n",
602    "    --clip_duration_ms=1000 --detection_threshold=0.70 --average_window_ms=500 \\\n",
603    "    --suppression_ms=500 --time_tolerance_ms=1500"
604   ],
605   "outputs": [],
606   "metadata": {}
607  }
608 ],
609 "metadata": {
610  "accelerator": "GPU",
611  "colab": {
612   "collapsed_sections": [],
613   "name": "train_micro_speech_model.ipynb",
614   "provenance": [],
615   "toc_visible": true
616  },
617  "kernelspec": {
618   "name": "python3",
619   "display_name": "Python 3.8.6 64-bit ('ai': conda)"
620  },
621  "language_info": {
622   "codemirror_mode": {
623    "name": "ipython",
624    "version": 3
625   },
626   "file_extension": ".py",
627   "mimetype": "text/x-python",
628   "name": "python",
629   "nbconvert_exporter": "python",
630   "pygments_lexer": "ipython3",
631   "version": "3.8.6"
632  },
633  "interpreter": {
634   "hash": "abb811d8b1be5969553a0033f5a252013244c1763569cb77f5209b62dcc65a34"
635  }
636 },
637 "nbformat": 4,
638 "nbformat_minor": 4
639}