CS 663 Computer Vision • Project 1

Plant Disease Detection Using Mobile Images and Video

Module 4: Semantic Segmentation & Quantitative Severity Estimation

By Mahitha Rangineni • M.S. Computer Science • California State University, East Bay

Pixel-Level Semantic Segmentation

Bounding boxes give rectangular regions, but plant disease spots have irregular, curved shapes. Semantic segmentation classifies every pixel in the image individually: is this pixel healthy leaf tissue, a diseased lesion, or background [3], [4]?

Common Segmentation Models

Disease Severity Estimation

In farming, knowing that a leaf has a disease is only part of the story. A leaf with 2% damage might only need monitoring, whereas 40% damage might require immediate treatment. With segmentation, we can calculate the exact severity percentage:

Severity Formula

$$\text{Disease Severity (\%)} = \left(\frac{\text{Diseased Leaf Pixels}}{\text{Total Leaf Pixels}}\right) \times 100$$

Plant disease segmentation and severity estimation showing pixel-level masks and percentage calculation
Figure 3: Semantic Segmentation and Disease Severity Segmenting healthy leaf area and diseased spots to calculate quantitative leaf damage percentage.
Image created by the author with AI-assisted visualization.

Algorithm 1: Disease Severity Calculation

Once the segmentation model outputs the pixel counts for the diseased area and the total leaf, the severity percentage is calculated:

Python 3 disease_severity_calculator.py
# Disease Severity Estimation Algorithm
# Inputs: Segmented pixel counts from DeepLabV3+ or U-Net

def calculate_disease_severity(diseased_pixels: int, total_leaf_pixels: int) -> float:
    """Calculates the percentage of leaf area affected by disease."""
    if total_leaf_pixels <= 0:
        raise ValueError("Total leaf area must be greater than zero.")
    
    severity_percentage = (diseased_pixels / total_leaf_pixels) * 100.0
    return severity_percentage

# Example with segmented pixel counts:
diseased_pixels = 2340
total_leaf_pixels = 10000

severity = calculate_disease_severity(diseased_pixels, total_leaf_pixels)
print(f"Disease Severity: {severity:.2f}%")

Inputs & Outputs

Inputs: 2,340 diseased pixels, 10,000 total leaf pixels.

Output: Disease Severity: 23.40%

Practical Use

Allows automated sprayers or farmers to apply treatments based on measured damage rather than spraying whole fields equally.

Algorithm Steps

  1. Segment the complete leaf from the background.
  2. Segment the diseased spots (chlorosis or necrosis).
  3. Count total leaf pixels and diseased pixels.
  4. Divide diseased pixels by total leaf pixels and multiply by 100.
Audio Guide

Module Narration

A 1–2 minute audio walkthrough of U-Net/DeepLabV3+ segmentation and disease severity index calculation.

🎧
Audio Narration (audio/segmentation-audio.mp3) Audio recording scheduled. The media player will activate automatically once the audio file is uploaded to the repository.