We trained a machine learning algorithm on various classes such as Cassava Mosaic Disease(CMD), Cassava Bacterial Blight(CBB), Cassava Brown Streak Disease(CBSD), Cassava Green Mite(CGM) and Healthy images. The steps performed during this process include the following;
Step one: We defined the structure of our files. These image files were stored in the cropped and uncropped folders. Within these folders, we had a folder for each disease and healthy images. Within the different disease folders, we had the severities for each disease.
Step two: We made different partitions of files which were included in the label dictionary(key,value). The label_dictionary is an object where the keys are the different disease labels and the values are the list of directories.
Step three: Compilation.This was done before training the model. We had to configure the learning process which was done via the compile method.It receives three arguments such as the optimizer, the loss function and the list of metrics.
Step four:Start training.For training, we used the fit function.The arguments within this function included;
-
epochs:An epoch is one complete iteration over all of the training dataset.
-
batch_size:Number of samples that are going to be propagated through A network.
-
steps_per_epoch: This is defined by (Number of Samples//batch_size)
-
validation_steps:(Samples of the Validation dataset//batch_size)
-
class_weight:The class_weight parameter of the fit() function is a dictionary mapping classes to a weight value.
-
validation_data: This is data that is used for testing.
-
callbacks:used to get internal view on internal states and statistics of model during training.These are mainly because of an early stop or a checkpoint. The early stop is done when a monitored quantity has stopped improving.The checkpoint is done to moitor progress.
During the training process, we made a comparison between both the cropped images and uncropped images to find out which produced a better validation accuracy.
The images were passed through the ENet algorithm which performed semantic segmentation on the cassava images as illustrated below so as to remove the background noise and improve on the accuracy.
Good segmentation
Poor segmenatation