Converts the input Keras model to TFLite format.
mediapipe_model_maker.model_util.convert_to_tflite(
model: tf.keras.Model,
quantization_config: Optional[mediapipe_model_maker.quantization.QuantizationConfig
] = None,
supported_ops: Tuple[tf.lite.OpsSet, ...] = (tf.lite.OpsSet.TFLITE_BUILTINS,),
preprocess: Optional[Callable[..., Any]] = None,
allow_custom_ops: bool = False
) -> bytearray
Args |
model
|
Keras model to be converted to TFLite.
|
quantization_config
|
Configuration for post-training quantization.
|
supported_ops
|
A list of supported ops in the converted TFLite file.
|
preprocess
|
A callable to preprocess the representative dataset for
quantization. The callable takes three arguments in order: feature, label,
and is_training.
|
allow_custom_ops
|
A boolean flag to enable custom ops in model conversion.
Default to False.
|
Returns |
bytearray of TFLite model
|