research

All research

Cauliflower

Classifying cauliflower diseases with transfer learning

Type
Training notebook
Task
Image classification, 5 classes
Model
EfficientNetB3
Built with
TensorFlow and Keras, on Google Colab

Read it

Prefer the files? Download the EfficientNetB3 notebook (991 KB).

A confusion matrix for EfficientNetB3 on the 776 test images, five classes by five. Almost every image is on the diagonal: 149 Alternaria Leaf Spot, 140 Bacterial Soft Rot, 79 Black Rot, 89 Downy Mildew and 316 Healthy. Three images are off it.
From the EfficientNetB3 notebook: what the model predicted for each of the 776 test images, against the true class.

What the notebook does

This notebook trains an image classifier that sorts photos of cauliflower into five classes: four diseases (Alternaria leaf spot, bacterial soft rot, black rot and downy mildew) and healthy plants.

The images are resized to 300 × 300 pixels and split into 6,203 for training, 775 for validation and 776 for testing. The training set is then balanced to 600 images per class: larger classes are sampled down, and smaller ones are filled up with augmented copies. The model, EfficientNetB3, starts from ImageNet weights, gets a small classification head, and trains for up to 150 epochs, keeping the best checkpoint by validation loss. The run ends with a test on the 776 held-out images: a classification report and a confusion matrix.

Where the images come from

The images were gathered from five published cauliflower datasets, all on Mendeley Data under a CC BY 4.0 licence, and mixed together for training. Where a dataset is also posted on Kaggle, only the Mendeley original is listed here.

Changes made: the images were mixed, resized to 300 × 300 pixels and split into training, validation and test sets, and the smaller classes of the training set were filled up with augmented copies. The notebooks read one combined folder, so they do not show which image came from which source. The images are not included here.

In the EfficientNetB3 notebook

Files and links

Good to know

  • The notebook was run on Google Colab with an A100 GPU, as the file records.
  • The images are not included here: the notebook reads them from a folder on Google Drive.
  • The notebook is shown as it was saved: cells in file order, with the output stored in the file. Nothing is re-run here, so the numbers you see are the ones it saved.