train_model¶
- train_model(model, weights=None, epochs=None, resume_epoch=0, verbose=None, clean=False, quantize=True, create_archive=True, show=False, test=False, post_process=False)[source]¶
Train a model using Keras and Tensorflow
- Parameters:
model (
Union
[MltkModel
,str
]) –mltk.core.MltkModel
instance, name of MLTK model, path to model specification script(.py) __Note:__ If the model is in “test mode” then the model will train for 1 epochweights (
str
) – Optional file path of model weights to load before trainingepochs (
int
) – Optional, number of epochs to train model. This overrides the mltk_model.epochs attributeresume_epoch (
int
) – Optional, resuming training at the given epochverbose (
bool
) – Optional, Verbosely print to logger while trainingclean (
bool
) – Optional, Clean the log directory before trainingquantize (
bool
) – Optional, quantize the model after training successfully completescreate_archive (
bool
) – Optional, create an archive (.mltk.zip) of the training results and generated model filesshow (
bool
) – Optional, show the training results diagramtest (
bool
) – Optional, load the model in “test mode” if true.post_process (
bool
) – This allows for post-processing the training results (e.g. uploading to a cloud) if supported by the given MltkModel
- Return type:
- Returns:
The model TrainingResults
TrainingResults¶
- class TrainingResults[source]¶
Container for the model training results
- mltk_model¶
The MltkModel uses for training
- keras_model: Model¶
The trained KerasModel
- epochs: List[int]¶
List of integers corresponding to each epoch
- params: dict¶
Dictionary of parameters uses for training
- history¶
Dictionary of metrics recorded for each epoch
- property model_archive_path: str¶
File path to model archive which contains the model training output including trained model file
- Return type:
str