Model

class neer_match_utilities.model.EpochEndSaver(base_dir, model_name)[source]

Custom Keras callback to save weights and biases at the end of every epoch using the Model.save(…) static method.

__init__(base_dir, model_name)[source]
Parameters:
  • base_dir (Path) – The root directory under which the model subdirectories will be created. For instance: Path(__file__).resolve().parent / MODEL_NAME

  • model_name (str) – A short identifier for the model. Each epoch’s directory will be base_dir / model_name / “epoch_<NN>”

on_epoch_end(epoch, logs=None)[source]

At the end of each epoch, call Model.save(…) so that weights and optimizer state are pickled as per your spec.

class neer_match_utilities.model.Model[source]

A class for saving and loading matching models.

save(model, target_directory, name):

Save the specified model to a target directory.

load(model_directory):

Load a model from a given directory.

static load(model_directory)[source]

Load a model from a specified directory.

Parameters:

model_directory (Path) – The directory containing the saved model.

Returns:

The loaded model.

Return type:

DLMatchingModel or NSMatchingModel

static save(model, target_directory, name)[source]

Save the model to a specified directory.

Parameters:
  • model (DLMatchingModel or NSMatchingModel) – The model to be saved.

  • target_directory (Path) – The directory where the model should be saved.

  • name (str) – Name of the model directory.

Return type:

None