C3AE
C3AE copied to clipboard
the error of "call() got an unexpected keyword argument 'training'",when convert to tflite
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?
keras not test yet! you should use tf. keras, which tf=2.1