C3AE icon indicating copy to clipboard operation
C3AE copied to clipboard

the error of "call() got an unexpected keyword argument 'training'",when convert to tflite

Open xieshenru opened this issue 4 years ago • 1 comments

when convert to tflite,the error of "call() got an unexpected keyword argument 'training'" appear,how to resolve it?

import tensorflow as tf import keras from keras.layers import BatchNormalization, ReLU from keras.backend import pool2d from utils import focal_loss

modelpath = r'./model/c3ae_model_v2.h5' model = keras.models.load_model(modelpath, custom_objects={"pool2d": pool2d, "ReLU": ReLU, "BatchNormalization": BatchNormalization, "tf": tf, "focal_loss_fixed": focal_loss([1] * 12)}) converter = tf.lite.TFLiteConverter.from_keras_model(model)

tflite_model = converter.convert() savepath = r'./model.tflite' open(savepath, "wb").write(tflite_model) the above is the code I used,how to resolve this error?

xieshenru avatar Nov 26 '20 07:11 xieshenru

keras not test yet! you should use tf. keras, which tf=2.1

StevenBanama avatar Nov 26 '20 14:11 StevenBanama