Skip to content

Instantly share code, notes, and snippets.

@gamename
Created March 22, 2024 02:38
Show Gist options
  • Save gamename/5b99ef117697ac57f1818bd9806dfcce to your computer and use it in GitHub Desktop.
Save gamename/5b99ef117697ac57f1818bd9806dfcce to your computer and use it in GitHub Desktop.
Meow Output 2
/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-21 17:57:04.506404: 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.
W0321 18:12:32.079557 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:
[[17 1 4]
[ 0 5 1]
[ 5 1 36]]
W0321 18:35:41.891450 8038076416 train.py:314] Confusion Matrix:
[[17 1 4]
[ 0 5 1]
[ 5 1 36]]
WARNING:tensorflow:Final test accuracy = 82.9% (N=70)
W0321 18:35:41.891538 8038076416 train.py:315] Final test accuracy = 82.9% (N=70)
Freezing the model
INFO:tensorflow:Restoring parameters from 2024-03-21_17-57-02/train/tiny_conv.ckpt-15000
I0321 18:35:43.816570 8038076416 saver.py:1417] Restoring parameters from 2024-03-21_17-57-02/train/tiny_conv.ckpt-15000
2024-03-21 18:35:43.817130: 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.
W0321 18:35:43.819713 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.
W0321 18:35:43.819784 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.
W0321 18:35:43.821599 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.
I0321 18:35:43.821762 8038076416 builder_impl.py:679] No assets to save.
INFO:tensorflow:No assets to write.
I0321 18:35:43.821786 8038076416 builder_impl.py:497] No assets to write.
INFO:tensorflow:SavedModel written to: 2024-03-21_17-57-02/models/saved_model/saved_model.pb
I0321 18:35:43.830275 8038076416 builder_impl.py:461] SavedModel written to: 2024-03-21_17-57-02/models/saved_model/saved_model.pb
2024-03-21 18:35:44.047486: 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-21 18:35:44.122204: 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-21 18:35:44.122255: 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-21 18:35:44.147500: 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-21 18:35:44.147544: I tensorflow/core/grappler/clusters/single_machine.cc:361] Starting new session
2024-03-21 18:35:44.153964: 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-21 18:35:44.154012: 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:1711064144.156158 169278485 tf_tfl_flatbuffer_helpers.cc:390] Ignored output_format.
W0000 00:00:1711064144.156178 169278485 tf_tfl_flatbuffer_helpers.cc:393] Ignored drop_control_dependency.
2024-03-21 18:35:44.167408: 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-21 18:35:44.190164: 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-21 18:35:44.190224: I tensorflow/core/grappler/clusters/single_machine.cc:361] Starting new session
2024-03-21 18:35:44.214187: 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-21 18:35:44.214248: I tensorflow/core/grappler/clusters/single_machine.cc:361] Starting new session
2024-03-21 18:35:44.220399: 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-21 18:35:44.220435: I tensorflow/core/grappler/clusters/single_machine.cc:361] Starting new session
W0000 00:00:1711064144.222276 169278485 tf_tfl_flatbuffer_helpers.cc:390] Ignored output_format.
W0000 00:00:1711064144.222283 169278485 tf_tfl_flatbuffer_helpers.cc:393] Ignored drop_control_dependency.
2024-03-21 18:35:44.229796: 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-21 18:35:44.353884: 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.943, Recall: 0.943, F1 Score: 0.943 (Number of test samples=70)
Compute quantized model accuracy
Quantized model Precision: 0.943, Recall: 0.943, F1 Score: 0.943 (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.10140931606292725, -128), 'quantization_parameters': {'scales': array([0.10140932], 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': {}}
INFO: Created TensorFlow Lite XNNPACK delegate for CPU.
Traceback (most recent call last):
File "/Users/tennis/src/tflite-micro-fork/tensorflow/lite/micro/examples/micro_speech/train/meow_train.py", line 357, in <module>
main()
File "/Users/tennis/src/tflite-micro-fork/tensorflow/lite/micro/examples/micro_speech/train/meow_train.py", line 313, in main
predictions, true_labels = get_model_predictions_and_labels(MODEL_TFLITE, test_data, test_labels)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/tennis/src/tflite-micro-fork/tensorflow/lite/micro/examples/micro_speech/train/meow_train.py", line 111, in get_model_predictions_and_labels
interpreter.set_tensor(input_details['index'], test_data[i:i + 1])
File "/Users/tennis/src/tflite-micro-fork/.venv/lib/python3.11/site-packages/tensorflow/lite/python/interpreter.py", line 720, in set_tensor
self._interpreter.SetTensor(tensor_index, value)
ValueError: Cannot set tensor: Dimension mismatch. Got 3 but expected 1960 for dimension 1 of input 0.
Process finished with exit code 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment