What it shows
Farmers lose crops to diseases that are spotted too late. A neural network trained on leaf photographs can suggest the likely disease. The project fine-tunes a pretrained image model on a subset of an open plant leaf data set, measures accuracy and tests it honestly on photographs taken in the field.
The science
A network pretrained on millions of everyday images has already learnt edges, textures and shapes. Transfer learning freezes most of its layers and trains only a new final layer on the leaf classes, so a small data set is enough. Images taken on a plain background in a lab are easier than field photographs with soil, shadows and mixed leaves, so a gap between test accuracy and field accuracy is expected.
Materials
Cost: free. Many items come from home or from waste; spare parts such as LEDs, motors and wire are in the store.
- A laptop with Python 3 and TensorFlow or PyTorch (or Google Colab free GPU)
- An open plant leaf image data set (a subset of 3 to 5 classes of one crop, about 300 images per class)
- A phone to take 50 test photographs of real leaves from a garden
- A notebook and printer
Safety
For this project: Go with an adult to a field or garden and ask permission before taking leaves or pictures. Use gloves around diseased plants.
Never use mains electricity: power models with cells, batteries or a low-voltage adapter. Sharp and hot tools, flames and lab chemicals need an adult or your teacher beside you. Keep magnets, button cells and small parts away from young children, and wash your hands after making.
Step by step
12 steps. Do them in order, and test each part before you go on to the next. Write what you notice in a notebook as you go.
Choose a crop such as tomato or potato and select 3 to 5 classes including healthy leaves from the open data set.
Check the images by eye, remove obviously wrong ones and count images per class.
Split into training, validation and test sets by image, making sure no duplicates cross the splits.
Load a pretrained MobileNetV2 or ResNet18 without the top layer and add a new classification layer.
Apply data augmentation: flips, small rotations and brightness changes.
Train the new layer for several epochs and plot the loss and accuracy.
Unfreeze the last few layers and fine-tune at a very low learning rate.
Evaluate on the test set with a confusion matrix and the per-class recall.
Take 50 phone photos in the field with natural backgrounds and test the model on them.
Use Grad-CAM or a similar method to see which parts of the leaf the model looked at.
Document the failures, such as shadows or wrong crop, and write the limits clearly.
Write the report, including a note that the tool is not a replacement for an agriculture expert.
What you should see
Test accuracy on the lab images is often above 90 to 95 percent, while accuracy on field photographs is lower, perhaps 60 to 80 percent, demonstrating the gap between a data set and real use.
Viva questions
A teacher or a judge will ask how it works. Try to answer each question before you open it, then compare.
01What is transfer learning?
Reusing a model trained on a large data set and adapting it to a new, smaller task.
02Why does the field accuracy drop?
The training images had plain backgrounds and controlled light that differ from field conditions.
03Why is data augmentation used?
It creates varied versions of the images and reduces overfitting.
04Why check that the same leaf is not in both train and test sets?
Otherwise accuracy is falsely high because the model has seen near-identical images.
Take it further
Convert the model to TensorFlow Lite and run it in an Android app that classifies from the phone camera.
Change one thing, measure what happens, and add a table or chart of your readings: that is what turns a model into your own investigation.
Free ebooks for this project
Science projects
Writing a Science Project File
How to write the report, from the cover page to the bibliography
Find out more about computing and coding
Free, well-known places to explore the subject further. Ask a grown-up before you sign up for anything or type your name anywhere.
