Comments (7)
So those warnings pop up when you are trying to convert your keras model to tf lite? Can you please share complete code snippet?
from tflite-micro.
So those warnings pop up when you are trying to convert your keras model to tf lite? Can you please share complete code snippet?
Thanks for your reply!
I don't see this warning when i am trying to convert my keras model to tf lite.
this is my code (ref : https://www.tensorflow.org/lite/performance/post_training_integer_quant):
import tensorflow as tf
import numpy as np
import pathlib
load model
model_path = "E:/tensorflow_lite_example/MNINST_form_tensorflow/save_model/"
model=tf.keras.models.load_model(model_path)
setting representative_data
(train_images, train_labels),(test_images,test_labels) = mnist.load_data()
train_images = train_images.astype(np.float32)/255.0
def representative_data_gen():
for input_value in tf.data.Dataset.from_tensor_slices(train_images).batch(1).take(100):
yield [input_value]
converter to tflite and quantization
converter = tf.lite.TFLiteConverter.from_keras_model(model)
converter.optimizations = [tf.lite.Optimize.DEFAULT]
converter.representative_dataset = representative_data_gen
converter.target_spec.supported_ops = [tf.lite.OpsSet.TFLITE_BUILTINS_INT8]
converter.inference_input_type = tf.int8
converter.inference_output_type = tf.int8
tflite_model_quant_int8 = converter.convert()
save tflite
tflite_models_dir = pathlib.Path("./tmp/tflie_test/")
tflite_models_dir.mkdir(exist_ok=True, parents=True)
tflite_model_quant_file = tflite_models_dir/"mnist_model_quant_int8.tflite"
tflite_model_quant_file.write_bytes(tflite_model_quant_int8)
from tflite-micro.
Since your goal is to use the ethos-u55, I would recommend starting with one of the TfLite Micro examples, such as the hello_world example.
I'm going to close the current issue, but please feel free to open a new one in the tflite-micro repository for any issues that you run into with the hello_world example.
Also, tagging @freddan80 in case there are any additional ethos-u55 specific examples that might be more relevant here.
from tflite-micro.
Thx for looping me in. We will check it out. Tagging @jenselofsson and @mansnils .
from tflite-micro.
@dexsr415 - As @advaitjain suggested, if you want to get started with Ethos-U55 and Vela in Tflite-micro you could have a look here:
https://github.com/tensorflow/tflite-micro/tree/main/tensorflow/lite/micro/cortex_m_corstone_300
https://github.com/tensorflow/tflite-micro/tree/main/tensorflow/lite/micro/examples/network_tester
https://github.com/tensorflow/tflite-micro/tree/main/tensorflow/lite/micro/kernels/ethos_u
Running the network example will download Vela and convert the person detect int8 model.
In case you run into specific problems with Vela (outside the scope of the network example and benchmarks where Vela is used in Tflite-micro), you could raise an issue in https://community.arm.com/developer/tools-software/oss-platforms/f/machine-learning-forum/.
You can also use support-ml [email protected] for your issues if you are Arm License customer.
from tflite-micro.
@dexsr415 - As @advaitjain suggested, if you want to get started with Ethos-U55 and Vela in Tflite-micro you could have a look here:
https://github.com/tensorflow/tflite-micro/tree/main/tensorflow/lite/micro/cortex_m_corstone_300
https://github.com/tensorflow/tflite-micro/tree/main/tensorflow/lite/micro/examples/network_tester
https://github.com/tensorflow/tflite-micro/tree/main/tensorflow/lite/micro/kernels/ethos_uRunning the network example will download Vela and convert the person detect int8 model.
In case you run into specific problems with Vela (outside the scope of the network example and benchmarks where Vela is used in Tflite-micro), you could raise an issue in https://community.arm.com/developer/tools-software/oss-platforms/f/machine-learning-forum/.
You can also use support-ml [email protected] for your issues if you are Arm License customer.
Thank you for your reply
I will check the information you gave.
Thank you so much
from tflite-micro.
I found that my question is similar to tensorflow/tensorflow#45090 (comment)
This problem seems to be related to dynamic size in keras.
from tflite-micro.
Related Issues (20)
- TFLM compression changes
- build: C++17 is not enabled on all platforms HOT 3
- log32 overflow ? HOT 2
- TFLM compression changes (2nd)
- TFLITE micro ERROR An error occurred during the fetch of repository 'tflm_pip_deps_numpy' HOT 2
- TFLM compression changes (3rd)
- Impossible to compile with recent GCC HOT 1
- TFLM implementation in Contiki-NG HOT 1
- TFLM compression changes (4th) HOT 1
- Cortex-M CI Run Failed HOT 3
- Quantisize LSTM Model HOT 5
- Python dependency issue for aarch64 HOT 1
- While OP Issue in TFLM
- Custom memory allocation/planning that may not be that custom HOT 3
- Does TFLM support MFCC? HOT 2
- Training person detection model. HOT 1
- Add int16 support to MINIMUM and MAXIMUM HOT 2
- Fail to run person_detect.tflite via TFLite benchmark_model HOT 2
- Add int16 support to RELU6
- Rename tflite namespace HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tflite-micro.