load_and_train module
- class load_and_train.ModelGenerator(labels, path)
Bases:
object
- BuildModel()
Add layers to the model
- CheckGPU()
Check that there is a GPU device for Tensorflow to use
- EvaluateModel()
Get loss value & metrics values for the model in test mode.
- Returns
_description_
- Return type
_type_
- ImageToArray(file)
Converts an image from RGB to numpy array so that it can be processed.
- Parameters
file (str) – Path to the file to be converted to an array
- Returns
Numpy array of the image
- Return type
numpy arr
- ProcessArrays()
Process the training arrays to be compatible with the model
- ProcessImages()
Generate the array of all the images in the dataset and t array with the corresponding labels
- SaveModel()
Save the model so that it can be accessed later without having to retrain each time
- SplitDataset()
Splits the dataset into training and testing sets.
- TrainModel()
Trains the model using the dataset provided: epochs=20, batch size=32, validation split=0.2 :returns: Model history :rtype: _type_