Final-year projects / Agriculture

Plant leaf disease detection with a camera and AI

Farmers often spot leaf disease too late or spray the wrong pesticide. A camera that photographs a leaf and names the likely disease and remedy, working offline in the field, helps them act early.

Raspberry Pi 4Major projectCSE, ECE
Pi 4CAMERA11.9 mAFeatured
Parts
₹9,380
Build
14 weeks
Board
Raspberry Pi 4
Objectives
4

Block diagram

Inputs
  • CAMERA
    CameraPhotographs the leaf
Controller
  • Pi 4
    Raspberry Pi 4Runs the trained model
Outputs
  • Ring lightEven lighting for every photo
  • RESULT
    Result pageShows disease, confidence and remedy

Objectives

  1. To train an image classifier (transfer learning on MobileNet) for at least five diseases of one crop plus healthy leaves.
  2. To run it on the Raspberry Pi in under 1 s per leaf, offline.
  3. To show the disease, confidence and a remedy from an agriculture department source.
  4. To report accuracy on 100 field photos not used in training.

Parts and specifications

Total about ₹9,380 at typical online prices. Tap a part for its pinout and datasheet notes.

Design calculations

Dataset split

About 300 photos per class: 70% train, 15% validation, 15% test. Add your own field photos so the model is not only trained on clean lab images.

Model size

MobileNetV2 at 224 × 224 has about 3.4 M parameters; int8 quantised it is about 3.5 MB and runs in about 100 to 300 ms on a Pi 4.

Accuracy measures

Report per-class precision = TP / (TP + FP) and recall = TP / (TP + FN), not just overall accuracy, since classes differ in size.

Pin map

SignalPin or connection
CameraCSI connector
WS2812 ring DINGPIO 18 (PWM) via 330 Ω, 5 V supply
Capture buttonGPIO 17 (pull-up)
ResultWeb page served by the Pi over Wi-Fi

Firmware outline

  1. Train on a laptop or Colab: MobileNetV2 with ImageNet weights, new 6-class head, augmentation (flip, rotate, brightness).
  2. Fine-tune the top layers; export to TensorFlow Lite with int8 quantisation.
  3. On the Pi: on button press, light the ring, capture 224 × 224 centre crop, run the interpreter.
  4. Show top-3 classes with confidence; below 60% confidence say 'Not sure: retake'.
  5. Show the remedy text for the top class and save the photo with the result.

Test plan

TestExpected result
Test split from the datasetAccuracy and confusion matrix
100 field photosAccuracy drop compared with the dataset
Leaf of another cropLow confidence, not a wrong disease
Speed on the PiUnder 1 s per photo

These rows start your results table when you plan the project.

Viva practice

Say your answer out loud first, then check. The first 2 answers are free; Maker opens all 5.

1. What is transfer learning?
2. Why does accuracy drop in the field?
3. What does quantisation do?
4. Why show confidence?
5. How would you reach more farmers?

Make it yours

One or two upgrades for a mini project, two to four for a major one.

Build these first

Datasheets and sources to cite

  • Hughes and Salathé, PlantVillage dataset (2015)
  • Howard et al., MobileNets (2017)
  • ICAR crop protection advisories

About this project

How much does the plant leaf disease detection with a camera and ai project cost?

About ₹9,380 for the parts in the base list: Raspberry Pi 4 Model B (4 GB), Raspberry Pi Camera Module 3, WS2812B ring (16 LEDs), 32 GB microSD card, Raspberry Pi 4 USB-C 15 W supply, Case, button and leaf holder.

How long does it take?

About 14 weeks for the base project, built on a Raspberry Pi 4. Each upgrade adds time.

Which branches is it suitable for?

Computer Science / IT (IoT, AI), Electronics and Communication, as a major project.

Which pins and design calculations does it use?

Camera on CSI connector; WS2812 ring DIN on GPIO 18 (PWM) via 330 Ω, 5 V supply; Capture button on GPIO 17 (pull-up). Worked calculations on this page: dataset split, model size, accuracy measures.

How do I test it?

Test split from the dataset: Accuracy and confusion matrix. 100 field photos: Accuracy drop compared with the dataset. Leaf of another crop: Low confidence, not a wrong disease. Speed on the Pi: Under 1 s per photo.

What are the objectives?

To train an image classifier (transfer learning on MobileNet) for at least five diseases of one crop plus healthy leaves. To run it on the Raspberry Pi in under 1 s per leaf, offline. To show the disease, confidence and a remedy from an agriculture department source. To report accuracy on 100 field photos not used in training.