update_model_parameters

update_model_parameters(model, params=None, description=None, output=None, accelerator=None)[source]

Update the parameters of a previously trained model

This updates the metadata of a previously trained .tflite model. The parameters are taken from either the given mltk.core.MltkModel’s python script or the given “params” dictionary and added to the .tflite model file.

Note

The .tflite metadata is only modified. The weights and model structure of the .tflite file are NOT modified.

Parameters:
  • model (Union[MltkModel, TfliteModel, str]) – Either the name of a model a mltk.core.MltkModel or mltk.core.TfliteModel instance or the path to a .tflite model file or .mltk.zip model archive

  • params (dict) – Optional dictionary of parameters to add .tflite. If omitted then model argument must be a mltk.core.MltkModel instance or model name

  • description (str) – Optional description to add to .tflite

  • output (str) – Optional, directory path or file path to generated .tflite file. If none then generate in model log directory. If output=’tflite_model’, then return the mltk.core.TfliteModel object instead of .tflite file path

  • accelerator (str) – Optional hardware accelerator to use when determining the runtime_memory_size parameter. If None then default to the CMSIS kernels for calculating the required tensor arena size.

Return type:

Union[str, TfliteModel]

Returns:

The file path to the generated .tflite OR TfliteModel object if output=`tflite_model`