DEV Community

Cover image for AI-Based Medicinal Plant Leaf Analysis System
surya saketh
surya saketh

Posted on

AI-Based Medicinal Plant Leaf Analysis System

Introduction

Medicinal plants play a critical role in traditional healthcare systems such as Ayurveda. However, identifying plant species and detecting diseases from leaf images typically requires expert knowledge.

To address this, I built a full-stack AI application that can:

  • Identify medicinal plants from leaf images
  • Detect whether the leaf is healthy or diseased
  • Provide structured outputs such as scientific name, medicinal properties, and care recommendations

This project combines computer vision, backend APIs, and a modern frontend into a single deployable system.

Problem Statement

The main challenges this project addresses:

  • Lack of accessible tools for plant identification
  • Difficulty in early disease detection
  • Dependence on domain experts
  • Limited awareness of medicinal uses and remedies

The goal was to build a system that makes this process automated and accessible.

Problem Statement

The main challenges this project addresses:

  • Lack of accessible tools for plant identification
  • Difficulty in early disease detection
  • Dependence on domain experts
  • Limited awareness of medicinal uses and remedies

The goal was to build a system that makes this process automated and accessible.

Tech Stack

System Architecture

The system is divided into three layers:

Frontend

  • Image upload interface
  • Displays prediction results

Backend (FastAPI)

  • Handles file uploads
  • Runs model inference
  • Returns structured JSON response

ML Model

  • Trained on labeled medicinal plant datasets
  • Classifies plant type and health status

Model Training Pipeline

The model training involved:

  • Organizing dataset into class folders

  • Preprocessing:

  1. Resizing to 224×224
  2. Normalization
Enter fullscreen mode Exit fullscreen mode
  • Data augmentation:
 1. Rotationz
 2. Flipping
 3. Color jitter
Enter fullscreen mode Exit fullscreen mode
  • Train/validation/test split

Transfer learning was used with a pretrained model to improve performance.

Prediction Workflow

  1. User uploads a leaf image
  2. Backend saves the image temporarily
  3. Image is passed to the trained model
  4. Model outputs: class_name, confidence, class_index
  5. Backend maps the class to structured data using a knowledge file
  6. Response is returned to frontend

Key Features

  1. Medicinal plant identification
  2. Disease detection (healthy vs diseased)
  3. Confidence-based predictions
  4. Knowledge integration (scientific name, properties, remedies)
  5. Unknown class handling for non-medicinal inputs
  6. Real-time API-based inference

Conclusion

This project demonstrates how AI can be used to make traditional knowledge systems more accessible. By combining computer vision with a structured knowledge base, the system provides meaningful insights beyond basic classification.

Links
GitHub Repo: https://github.com/saketh10-10/Medicinal-plant-leaf-disease-detection
LinkedIn: https://www.linkedin.com/feed/update/urn:li:activity:7428844593728688129/?originTrackingId=1XU4D7RC3aOmWI7Q%2F7P%2BGg%3D%3D

Top comments (0)