Model Utilities

load_mltk_model

mltk.core.load_mltk_model(model, test=False, print_not_found_err=False, logger=None, reload=True)[source]

Find a MLTK model with the given name and instantiate its corresponding mltk.core.MltkModel object

Parameters
  • model (str) – Name of MLTK model or path to MLTK model’s python specification script or archive. Append -test to the MLTK model name to load into “testing” mode (this is the same as setting the argument: test=True)

  • test (bool) – If the MLTK model should be loaded in “testing” mode

  • print_not_found_err – If true and the MLTK model is not found, then print an error

  • reload (bool) – If the given model is a python script then reload the module if necessary

Return type

MltkModel

Returns

Load model object

list_mltk_models

mltk.core.list_mltk_models(test=False, for_utests=False, logger=None)[source]

Return a list of all found MLTK model names

Return type

List[str]

load_tflite_or_keras_model

mltk.core.load_tflite_or_keras_model(model, model_type=None, weights=None, logger=None)[source]

Instantiate a Keras or TfliteModel object

IF model is an mltk.core.MltkModel instance OR a model archive .mltk.zip, AND model_type is:

ELSE model should be the file path to a .tflite or .h5 model file.

Return type

Union[TfliteModel, Model]