Create_Model

src.Create_Model.create_model(model_array, num_classes=5, input_shape=(256, 256, 3))[source]

Parameters

model_arraynp.ndarray

List containing the parameters for each layer in the network.

num_classesint, default=5

The number of output classes in the classification problem.

input_shapetuple, default=(256, 256, 3)

The shape of the input data (image size and channels).

Returns

modelkeras.Model

The constructed Keras model.

src.Create_Model.model_summary(model)[source]

Prints the model summary and the number of trainable weights.

src.Create_Model.train_model(train_ds, val_ds, model, epochs=30, checkpoint_filepath='checkpoints/checkpoint', early_stopping_patience=10)[source]

Trains the given model with the specified training and validation datasets.

Parameters

train_dstf.data.Dataset

The training dataset.

val_dstf.data.Dataset

The validation dataset.

modelkeras.Model

The model to train.

epochsint, default=30

The number of training epochs.

checkpoint_filepathstr, default=”checkpoints/checkpoint”

The file path to save the model weights with the best validation accuracy.

early_stopping_patienceint, default=10

The number of epochs with no improvement after which training will be stopped.

Returns

modelkeras.Model

The trained model.

historyHistory

A record of training loss values and metrics values at successive epochs.