Skip to content

Instantly share code, notes, and snippets.

@gamename
Created March 23, 2024 02:03
Show Gist options
  • Save gamename/f153ea32be430edf300297908af9e430 to your computer and use it in GitHub Desktop.
Save gamename/f153ea32be430edf300297908af9e430 to your computer and use it in GitHub Desktop.
Model Plots & output
/Users/tennis/src/tflite-micro-fork/.venv/bin/python /Users/tennis/src/tflite-micro-fork/tensorflow/lite/micro/examples/micro_speech/train/meow_train.py
Training these words: meow
Training steps in each stage: 12000,3000
Learning rate in each stage: 0.001,0.0001
Total number of training steps: 15000
Training the model (this will take quite a while)...
2024-03-22 20:14:59.914956: I tensorflow/compiler/mlir/mlir_graph_optimization_pass.cc:388] MLIR V1 optimization pass is not enabled
WARNING:tensorflow:From /Users/tennis/src/tflite-micro-fork/.venv/lib/python3.11/site-packages/tensorflow/python/training/saver.py:1068: remove_checkpoint (from tensorflow.python.checkpoint.checkpoint_management) is deprecated and will be removed in a future version.
Instructions for updating:
Use standard file APIs to delete files with this prefix.
W0322 20:31:06.524762 8038076416 deprecation.py:50] From /Users/tennis/src/tflite-micro-fork/.venv/lib/python3.11/site-packages/tensorflow/python/training/saver.py:1068: remove_checkpoint (from tensorflow.python.checkpoint.checkpoint_management) is deprecated and will be removed in a future version.
Instructions for updating:
Use standard file APIs to delete files with this prefix.
WARNING:tensorflow:Confusion Matrix:
[[19 0 2]
[ 0 6 1]
[ 5 0 37]]
W0322 20:55:33.872423 8038076416 train.py:314] Confusion Matrix:
[[19 0 2]
[ 0 6 1]
[ 5 0 37]]
WARNING:tensorflow:Final test accuracy = 88.6% (N=70)
W0322 20:55:33.872520 8038076416 train.py:315] Final test accuracy = 88.6% (N=70)
Freezing the model
INFO:tensorflow:Restoring parameters from 2024-03-22_20-14-58/train/tiny_conv.ckpt-15000
I0322 20:55:36.142434 8038076416 saver.py:1417] Restoring parameters from 2024-03-22_20-14-58/train/tiny_conv.ckpt-15000
2024-03-22 20:55:36.143003: I tensorflow/compiler/mlir/mlir_graph_optimization_pass.cc:388] MLIR V1 optimization pass is not enabled
WARNING:tensorflow:From /Users/tennis/src/tflite-micro-fork/tensorflow/lite/micro/examples/micro_speech/tensorflow/tensorflow/examples/speech_commands/freeze.py:229: convert_variables_to_constants (from tensorflow.python.framework.convert_to_constants) is deprecated and will be removed in a future version.
Instructions for updating:
This API was designed for TensorFlow v1. See https://www.tensorflow.org/guide/migrate for instructions on how to migrate your code to TensorFlow v2.
W0322 20:55:36.146030 8038076416 deprecation.py:50] From /Users/tennis/src/tflite-micro-fork/tensorflow/lite/micro/examples/micro_speech/tensorflow/tensorflow/examples/speech_commands/freeze.py:229: convert_variables_to_constants (from tensorflow.python.framework.convert_to_constants) is deprecated and will be removed in a future version.
Instructions for updating:
This API was designed for TensorFlow v1. See https://www.tensorflow.org/guide/migrate for instructions on how to migrate your code to TensorFlow v2.
WARNING:tensorflow:From /Users/tennis/src/tflite-micro-fork/.venv/lib/python3.11/site-packages/tensorflow/python/framework/convert_to_constants.py:946: extract_sub_graph (from tensorflow.python.framework.graph_util_impl) is deprecated and will be removed in a future version.
Instructions for updating:
This API was designed for TensorFlow v1. See https://www.tensorflow.org/guide/migrate for instructions on how to migrate your code to TensorFlow v2.
W0322 20:55:36.146106 8038076416 deprecation.py:50] From /Users/tennis/src/tflite-micro-fork/.venv/lib/python3.11/site-packages/tensorflow/python/framework/convert_to_constants.py:946: extract_sub_graph (from tensorflow.python.framework.graph_util_impl) is deprecated and will be removed in a future version.
Instructions for updating:
This API was designed for TensorFlow v1. See https://www.tensorflow.org/guide/migrate for instructions on how to migrate your code to TensorFlow v2.
WARNING:tensorflow:From /Users/tennis/src/tflite-micro-fork/tensorflow/lite/micro/examples/micro_speech/tensorflow/tensorflow/examples/speech_commands/freeze.py:183: build_tensor_info (from tensorflow.python.saved_model.utils_impl) is deprecated and will be removed in a future version.
Instructions for updating:
This API was designed for TensorFlow v1. See https://www.tensorflow.org/guide/migrate for instructions on how to migrate your code to TensorFlow v2.
W0322 20:55:36.147600 8038076416 deprecation.py:50] From /Users/tennis/src/tflite-micro-fork/tensorflow/lite/micro/examples/micro_speech/tensorflow/tensorflow/examples/speech_commands/freeze.py:183: build_tensor_info (from tensorflow.python.saved_model.utils_impl) is deprecated and will be removed in a future version.
Instructions for updating:
This API was designed for TensorFlow v1. See https://www.tensorflow.org/guide/migrate for instructions on how to migrate your code to TensorFlow v2.
INFO:tensorflow:No assets to save.
I0322 20:55:36.147732 8038076416 builder_impl.py:679] No assets to save.
INFO:tensorflow:No assets to write.
I0322 20:55:36.147761 8038076416 builder_impl.py:497] No assets to write.
INFO:tensorflow:SavedModel written to: 2024-03-22_20-14-58/models/saved_model/saved_model.pb
I0322 20:55:36.156637 8038076416 builder_impl.py:461] SavedModel written to: 2024-03-22_20-14-58/models/saved_model/saved_model.pb
2024-03-22 20:55:36.418003: I tensorflow/compiler/mlir/mlir_graph_optimization_pass.cc:388] MLIR V1 optimization pass is not enabled
WARNING:absl:Invoking the TF1 implementation of TFLiteConverter because eager is disabled. Consider enabling eager.
WARNING:tensorflow:From /Users/tennis/src/tflite-micro-fork/.venv/lib/python3.11/site-packages/tensorflow/lite/python/convert_saved_model.py:42: load (from tensorflow.python.saved_model.loader_impl) is deprecated and will be removed in a future version.
Instructions for updating:
Use `tf.saved_model.load` instead.
WARNING:tensorflow:From /Users/tennis/src/tflite-micro-fork/.venv/lib/python3.11/site-packages/tensorflow/lite/python/convert_saved_model.py:42: load (from tensorflow.python.saved_model.loader_impl) is deprecated and will be removed in a future version.
Instructions for updating:
Use `tf.saved_model.load` instead.
2024-03-22 20:55:36.499892: I tensorflow/core/grappler/devices.cc:75] Number of eligible GPUs (core count >= 8, compute capability >= 0.0): 0 (Note: TensorFlow was not compiled with CUDA or ROCm support)
2024-03-22 20:55:36.499971: I tensorflow/core/grappler/clusters/single_machine.cc:361] Starting new session
WARNING:tensorflow:From /Users/tennis/src/tflite-micro-fork/.venv/lib/python3.11/site-packages/tensorflow/lite/python/util.py:305: convert_variables_to_constants (from tensorflow.python.framework.convert_to_constants) is deprecated and will be removed in a future version.
Instructions for updating:
This API was designed for TensorFlow v1. See https://www.tensorflow.org/guide/migrate for instructions on how to migrate your code to TensorFlow v2.
WARNING:tensorflow:From /Users/tennis/src/tflite-micro-fork/.venv/lib/python3.11/site-packages/tensorflow/lite/python/util.py:305: convert_variables_to_constants (from tensorflow.python.framework.convert_to_constants) is deprecated and will be removed in a future version.
Instructions for updating:
This API was designed for TensorFlow v1. See https://www.tensorflow.org/guide/migrate for instructions on how to migrate your code to TensorFlow v2.
WARNING:tensorflow:From /Users/tennis/src/tflite-micro-fork/.venv/lib/python3.11/site-packages/tensorflow/python/framework/convert_to_constants.py:946: extract_sub_graph (from tensorflow.python.framework.graph_util_impl) is deprecated and will be removed in a future version.
Instructions for updating:
This API was designed for TensorFlow v1. See https://www.tensorflow.org/guide/migrate for instructions on how to migrate your code to TensorFlow v2.
WARNING:tensorflow:From /Users/tennis/src/tflite-micro-fork/.venv/lib/python3.11/site-packages/tensorflow/python/framework/convert_to_constants.py:946: extract_sub_graph (from tensorflow.python.framework.graph_util_impl) is deprecated and will be removed in a future version.
Instructions for updating:
This API was designed for TensorFlow v1. See https://www.tensorflow.org/guide/migrate for instructions on how to migrate your code to TensorFlow v2.
2024-03-22 20:55:36.530662: I tensorflow/core/grappler/devices.cc:75] Number of eligible GPUs (core count >= 8, compute capability >= 0.0): 0 (Note: TensorFlow was not compiled with CUDA or ROCm support)
2024-03-22 20:55:36.530729: I tensorflow/core/grappler/clusters/single_machine.cc:361] Starting new session
2024-03-22 20:55:36.538103: I tensorflow/core/grappler/devices.cc:75] Number of eligible GPUs (core count >= 8, compute capability >= 0.0): 0 (Note: TensorFlow was not compiled with CUDA or ROCm support)
2024-03-22 20:55:36.538167: I tensorflow/core/grappler/clusters/single_machine.cc:361] Starting new session
WARNING: All log messages before absl::InitializeLog() is called are written to STDERR
W0000 00:00:1711158936.540740 171423422 tf_tfl_flatbuffer_helpers.cc:390] Ignored output_format.
W0000 00:00:1711158936.540757 171423422 tf_tfl_flatbuffer_helpers.cc:393] Ignored drop_control_dependency.
2024-03-22 20:55:36.555443: I tensorflow/compiler/mlir/lite/flatbuffer_export.cc:3064] Estimated count of arithmetic ops: 0.668 M ops, equivalently 0.334 M MACs
WARNING:absl:Invoking the TF1 implementation of TFLiteConverter because eager is disabled. Consider enabling eager.
Float model is 52360 bytes
2024-03-22 20:55:36.584286: I tensorflow/core/grappler/devices.cc:75] Number of eligible GPUs (core count >= 8, compute capability >= 0.0): 0 (Note: TensorFlow was not compiled with CUDA or ROCm support)
2024-03-22 20:55:36.584364: I tensorflow/core/grappler/clusters/single_machine.cc:361] Starting new session
2024-03-22 20:55:36.611344: I tensorflow/core/grappler/devices.cc:75] Number of eligible GPUs (core count >= 8, compute capability >= 0.0): 0 (Note: TensorFlow was not compiled with CUDA or ROCm support)
2024-03-22 20:55:36.611418: I tensorflow/core/grappler/clusters/single_machine.cc:361] Starting new session
2024-03-22 20:55:36.618568: I tensorflow/core/grappler/devices.cc:75] Number of eligible GPUs (core count >= 8, compute capability >= 0.0): 0 (Note: TensorFlow was not compiled with CUDA or ROCm support)
2024-03-22 20:55:36.618638: I tensorflow/core/grappler/clusters/single_machine.cc:361] Starting new session
W0000 00:00:1711158936.620652 171423422 tf_tfl_flatbuffer_helpers.cc:390] Ignored output_format.
W0000 00:00:1711158936.620661 171423422 tf_tfl_flatbuffer_helpers.cc:393] Ignored drop_control_dependency.
2024-03-22 20:55:36.631113: I tensorflow/compiler/mlir/lite/flatbuffer_export.cc:3064] Estimated count of arithmetic ops: 0.668 M ops, equivalently 0.334 M MACs
fully_quantize: 0, inference_type: 6, input_inference_type: INT8, output_inference_type: INT8
2024-03-22 20:55:36.781632: I tensorflow/compiler/mlir/lite/flatbuffer_export.cc:3064] Estimated count of arithmetic ops: 0.668 M ops, equivalently 0.334 M MACs
Quantized model is 15056 bytes
Compute float model accuracy
Float model Precision: 0.886, Recall: 0.886, F1 Score: 0.886 (Number of test samples=70)
Compute quantized model accuracy
Quantized model Precision: 0.886, Recall: 0.886, F1 Score: 0.886 (Number of test samples=70)
Input details: {'name': 'Reshape_1', 'index': 0, 'shape': array([ 1, 1960], dtype=int32), 'shape_signature': array([ 1, 1960], dtype=int32), 'dtype': <class 'numpy.int8'>, 'quantization': (0.1015625, -128), 'quantization_parameters': {'scales': array([0.1015625], dtype=float32), 'zero_points': array([-128], dtype=int32), 'quantized_dimension': 0}, 'sparsity_parameters': {}}
Output details: {'name': 'labels_softmax', 'index': 11, 'shape': array([1, 3], dtype=int32), 'shape_signature': array([1, 3], dtype=int32), 'dtype': <class 'numpy.int8'>, 'quantization': (0.00390625, -128), 'quantization_parameters': {'scales': array([0.00390625], dtype=float32), 'zero_points': array([-128], dtype=int32), 'quantized_dimension': 0}, 'sparsity_parameters': {}}
{0: {'precision': array([0.31428571, 0.44 , 0.45833333, 0.51162791, 0.52380952,
0.53658537, 0.55 , 0.56410256, 0.57894737, 0.59459459,
0.61111111, 0.62857143, 0.64705882, 0.66666667, 0.6875 ,
0.70967742, 0.73333333, 0.75862069, 0.78571429, 0.77777778,
0.80769231, 0.84 , 0.83333333, 0.86956522, 0.90909091,
0.9047619 , 0.95 , 0.94736842, 0.94444444, 0.94117647,
0.9375 , 0.93333333, 0.92857143, 0.92307692, 0.91666667,
0.90909091, 0.9 , 0.88888889, 0.875 , 0.85714286,
0.83333333, 0.75 , 0.66666667, 0.5 , 1. ,
1. ]), 'recall': array([1. , 1. , 1. , 1. , 1. ,
1. , 1. , 1. , 1. , 1. ,
1. , 1. , 1. , 1. , 1. ,
1. , 1. , 1. , 1. , 0.95454545,
0.95454545, 0.95454545, 0.90909091, 0.90909091, 0.90909091,
0.86363636, 0.86363636, 0.81818182, 0.77272727, 0.72727273,
0.68181818, 0.63636364, 0.59090909, 0.54545455, 0.5 ,
0.45454545, 0.40909091, 0.36363636, 0.31818182, 0.27272727,
0.22727273, 0.13636364, 0.09090909, 0.04545455, 0.04545455,
0. ]), 'average_precision': 0.8850181304997657}, 1: {'precision': array([0.08571429, 0.14634146, 0.19354839, 0.24 , 0.35294118,
0.5 , 0.54545455, 0.66666667, 0.75 , 0.85714286,
0.83333333, 1. , 1. , 1. ]), 'recall': array([1. , 1. , 1. , 1. , 1. ,
1. , 1. , 1. , 1. , 1. ,
0.83333333, 0.83333333, 0.66666667, 0. ]), 'average_precision': 0.9761904761904762}, 2: {'precision': array([0.6 , 0.61764706, 0.63636364, 0.64615385, 0.640625 ,
0.65079365, 0.66129032, 0.67213115, 0.69491525, 0.70689655,
0.71929825, 0.73214286, 0.74545455, 0.75925926, 0.77358491,
0.80392157, 0.82 , 0.83673469, 0.85416667, 0.87234043,
0.89130435, 0.91111111, 0.90909091, 0.93023256, 0.92857143,
0.95 , 0.94871795, 0.94736842, 0.97297297, 0.97222222,
0.97142857, 0.97058824, 0.96969697, 0.96875 , 1. ,
1. , 1. , 1. , 1. , 1. ,
1. , 1. , 1. , 1. , 1. ,
1. , 1. , 1. , 1. , 1. ,
1. ]), 'recall': array([1. , 1. , 1. , 1. , 0.97619048,
0.97619048, 0.97619048, 0.97619048, 0.97619048, 0.97619048,
0.97619048, 0.97619048, 0.97619048, 0.97619048, 0.97619048,
0.97619048, 0.97619048, 0.97619048, 0.97619048, 0.97619048,
0.97619048, 0.97619048, 0.95238095, 0.95238095, 0.92857143,
0.9047619 , 0.88095238, 0.85714286, 0.85714286, 0.83333333,
0.80952381, 0.78571429, 0.76190476, 0.73809524, 0.73809524,
0.71428571, 0.69047619, 0.66666667, 0.64285714, 0.61904762,
0.5952381 , 0.57142857, 0.54761905, 0.52380952, 0.5 ,
0.47619048, 0.45238095, 0.42857143, 0.35714286, 0.30952381,
0. ]), 'average_precision': 0.9802784729597316}}
Class with the lowest AP score: 0, AP: 0.8850181304997657
kAudioSampleFrequency = 16000
kMaxAudioSampleSize = 480
kFeatureSize = 40
kFeatureCount = 49.0
kFeatureElementCount (kFeatureSize * kFeatureCount) = 1960.0
kFeatureStrideMs = 20
kFeatureDurationMs = 30.0
Total execution time: 0 hours and 40 minutes
Process finished with exit code 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment