ML-examples
ML-examples copied to clipboard
Freez.py for tensrflow2.5 versin
Hi,
I'm trying to edit the freez.py from the main project folder( which is Tensorflow 1.X). to make it suitable for thates project files( Tensorflow 2.5) However, when running
python freeze.py --model_architecture ds_cnn --model_size_info 5 64 10 4 2 2 64 3 3 1 1 64 3 3 1 1 64 3 3 1 1 64 3 3 1 1 --checkpoint ../Pretrained_models/DS_CNN/DS_CNN_S/ckpt/ds_cnn_0.94_ckpt --output_file ds_cnn.pb
I'm getting the following error
2021-08-05 15:42:18.490308: I tensorflow/core/platform/cpu_feature_guard.cc:142] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations: AVX2
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
2021-08-05 15:42:18.491455: I tensorflow/core/common_runtime/process_util.cc:146] Creating new thread pool with default inter op setting: 2. Tune using inter_op_parallelism_threads for best performance.
WARNING:tensorflow:From C:\Users\ash_j\anaconda3\envs\newenvt\lib\site-packages\tensorflow\python\keras\layers\normalization.py:534: _colocate_with (from tensorflow.python.framework.ops) is deprecated and will be removed in a future version.
Instructions for updating:
Colocations handled automatically by placer.
W0805 15:42:18.584352 17588 deprecation.py:336] From C:\Users\ash_j\anaconda3\envs\newenvt\lib\site-packages\tensorflow\python\keras\layers\normalization.py:534: _colocate_with (from tensorflow.python.framework.ops) is deprecated and will be removed in a future version.
Instructions for updating:
Colocations handled automatically by placer.
Traceback (most recent call last):
File "C:\Users\x\anaconda3\envs\newenvt\lib\site-packages\tensorflow\python\framework\tensor_util.py", line 549, in make_tensor_proto
str_values = [compat.as_bytes(x) for x in proto_values]
File "C:\Users\x\anaconda3\envs\newenvt\lib\site-packages\tensorflow\python\framework\tensor_util.py", line 549, in
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "freeze.py", line 248, in
Would appreciate any help regarding this. Thanks
freeze.py
in the original repository was for generating a frozen .pb model file for inference. This model format is exclusive to TensorFlow 1 and is not supported in TensorFlow 2.
In this repository you can instead generate a TFLite file using convert.py
that will be suitable for deployment. You can pass in --no-quantize
to generate a floating point file if you wish so that it matches the .pb model.
The reason of me trying to create the freez.py is because I want to use label_wav.py. So I want to send a sound file to the model. However, label_wav.py requires a .pb file
This merge request https://github.com/ARM-software/ML-examples/pull/72 has a new label_wav.py file that should work with tflite files, give it a try and see if it works for you.