# Conversion from Keras Model to tflite

**URL:** <https://discuss.ai.google.dev/t/conversion-from-keras-model-to-tflite/31092>\
**Category:** General Discussion\
**Tags:** keras, tflite, help\_request\
**Created:** [December 15, 2021, 7:38am UTC](https://discuss.ai.google.dev/t/conversion-from-keras-model-to-tflite/31092 "2021-12-15T07:38:24Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Prachi\_Mittal](https://d1dlmcr85iqnpo.cloudfront.net/user_avatar/discuss.ai.google.dev/prachi_mittal/32/8045_2.png) [@Prachi\_Mittal](https://discuss.ai.google.dev/u/Prachi_Mittal)\
**Post date:** [December 15, 2021, 7:38am UTC](https://discuss.ai.google.dev/t/conversion-from-keras-model-to-tflite/31092/1 "2021-12-15T07:38:24Z")

</div>

Hello all  
I have a simple keyword recognition model, which I have trained on colab using keras. My goal is to finally convert this model into a tflite model and deploy it on a target board.  
The limitation of the board is that it doesn’t support ExpandDims layer. While conversion from keras to tflite, the process adds ExpandDims layer explicitly.

The code used for conversion is as follows:

converter = tf.lite.TFLiteConverter.from\_keras\_model(model)  
tflite\_model = converter.convert()  
with open(‘mfcc\_cnn model.tflite’, ‘wb’) as f:  
f.write(tflite\_model)

The model flow from netron for both keras and tflite model is attached here. Can anyone help me out in how to avoid the expand\_dims layer during conversion. Quantized models are also not supported by the target board.

---

<div class="post-metadata">

**Author:** ![Kiran\_Sai\_Ramineni](https://d1dlmcr85iqnpo.cloudfront.net/user_avatar/discuss.ai.google.dev/kiran_sai_ramineni/32/8859_2.png) [@Kiran\_Sai\_Ramineni](https://discuss.ai.google.dev/u/Kiran_Sai_Ramineni)\
**Post date:** [April 26, 2023, 4:07pm UTC](https://discuss.ai.google.dev/t/conversion-from-keras-model-to-tflite/31092/3 "2023-04-26T16:07:56Z")

</div>

Hi @Prachi_Mittal, Instead of expand dimensions layer, you can use reshape layer which is used change the shape of tensor to a desired shape. Thank You.
