Skip to content

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

Description

@xieshenru

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?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions