Skip to content
This repository has been archived by the owner on Mar 19, 2024. It is now read-only.

training.py

Andrew Player edited this page Aug 17, 2022 · 1 revision

module src.training

Created By: Andrew Player
File Name: training.py
Date Created: 01-25-2021
Description: Contains the code for training models


function train

train(
    model_name: str,
    dataset_path: str,
    input_shape: int = 1024,
    num_epochs: int = 10,
    num_filters: int = 16,
    batch_size: int = 64,
    learning_rate: float = 0.001,
    dropout: float = 0.2
) → Any

Trains a model.

Parameters:

  • model_name : str
    The name for the saved model.
  • train_path : str
    The path to the training dataset.
  • test_path : str
    The path to the validation dataset.
  • input_shape : int, Optional
    The input shape of the model: (1, input_shape, input_shape, 1).
  • num_epochs : int, Optional
    The number of epochs. This is the number of times the model trains over the training dataset.
  • num_filters : int, Optional
    The base number of filters for the convolutional layers.
  • batch_size : int, Optional
    The number of samples to train on before updating the model weights. For the best accuracy, this should be 0; however, higher values will lead to much quicker training.
  • learning_rate : float, Optional
    The rate at which the model will update weights in response to estimated error.
  • dropout : float, Optional
    The percentage of network nodes that will be randomly dropped out during the training process. This helps to mitigate overfitting.

Returns:

  • history : any
    A history object containing the loss at each epoch of training.

class DataGenerator

Dataset Generator for sequencially passing files from storange into the model.

method __init__

__init__(file_list, path, tile_size, crop_size)

method on_epoch_end

on_epoch_end()

This file was automatically generated via andrewplayer3's fork of lazydocs.

Clone this wiki locally