Cassava Leaf Disease Classification: Blog Post #1
By: Kevin Le
Tags: Neural Networks, Data Science, Machine Learning, Exploratory Data Analysis, Deep Learning

The Team

The Problem + Dataset

This is the first of three blog posts that documents our group’s experience solving an image recognition problem using ML/DL methods.

Our dataset, drawn from the Cassava Leaf Disease Classification Kaggle competition, is comprised of over 20,000 images of cassava leaves taken from relatively inexpensive cameras. In addition, the dataset also provide mappings of each image to a disease/health status. These mappings include:

Cassava Bacterial Blight (CBB)

Cassava Brown Streak Disease (CBSD)

Cassava Green Mottle (CGM)

Cassava Mosaic Disease (CMD)

Healthy

Naturally, the goal of this project is to successfully distinguish multiple diseases visually present in cassava leaves, making this a multi-class classification problem. Cassava is an important staple in Africa, so the ability to ascertain the health status of its leaves can incur significant benefits with regards to its agricultural management.

Healthy Cassava Leaves (Source: Health Benefits Times)

Exploratory Data Analysis (EDA)

Our EDA was largely inspired by Yaroslav Isaienkov’s EDA for this same dataset. Given our data source, the first line of action was to programmatically map the labels contained in a csv file to the images in our training directory. We did this by creating a dictionary mapping an integer value from 0–4 to a disease/health status. We then added the map as a new column of a pandas dataframe, which contained columns for image_id, label, and disease_name.

We then determined a discrepancy between the number of labels in the csv file and number of images in our directory, so we had to identify which images were missing in our labels file and remove those images from our training directory. Around 50 out of 21400 images were removed from our training set. To ensure that our labels and images were properly mapped, we printed a batch of the mapped images and labels, seen below:

Batch of cassava leaf images

Of the mapped images, we examined the distribution of disease types in the training images. The figure below depicts exactly that. Interestingly, most of the cassava leaves in our dataset have Cassava Mosaic Disease (CMD), 61.5% of them to be exact. The remaining labels are more/less evenly distributed in our dataset.

Over 13,000 of 21,400 images of cassava leaves contained cassava mosaic disease, and just over 12% of them contained healthy cassava leaves.

Baseline Model Identification + Performance

Our next line of action was to create a baseline model to serve as a reference point as we develop more complex models. Considering the properties of our data and the fact that we’re working on a classification problem, we believed that logistic regression was an appropriate baseline model for its simplicity. Using the simplest algorithm possible should establish a true minimum standard for our future models’ performances. This allows us to start small and build up from there.

In the interest of RAM, we fitted logistic regression on a subset of 2000 images and conducted a 70/30 train-test split, so our training set contained 1400 images and our validation set, 600. This is in accordance with Siddhant Sadangi’s notebook for a baseline classifier on Kaggle. The baseline accuracy score was 0.50. We’re aware that the model was fit on a very small sample of data, so we’re also curious whether increasing our sample size would improve performance to something closer to 0.61, the proportion of the most populous class.

We provide a confusion matrix outlining the model’s exact choices below. Notably, we observe that most diseased plants are commonly mistaken as having CMD.

Confusion matrix from logistic regression

Overall, this score is less than the proportion of the most populous class in the data, so logistic regression in this case would perform worse than a model that always predicted CMD. Nonetheless, there is much room for improvement for our future models.

Next Steps

After EDA and establishing a baseline model, we will now focus on the development of a convolutional neural network to distinguish the diseases in these images. Our approach will be iterative — we’ll start with a fairly shallow network and build up from there, assessing different models with hyperparameter tuning. Stay tuned for more! Catch you next time.

References + Relevant Links

Kaggle Documentation