Zing Forum

Reading

CNN-Based Plant Leaf Disease Recognition System: From Model Training to Full-Stack Deployment

This article introduces a full-stack AI application that uses Convolutional Neural Networks (CNN) to identify 39 types of plant diseases. The system adopts a React+FastAPI architecture, supports two deployment modes (Streamlit monolithic deployment and front-end/back-end separation), and ensures input quality through HSV color space validation and MobileNetV2 pre-filtering.

植物病害识别CNN卷积神经网络计算机视觉StreamlitFastAPIReactTensorFlow农业AI深度学习
Published 2026-05-26 06:13Recent activity 2026-05-26 06:20Estimated read 6 min
CNN-Based Plant Leaf Disease Recognition System: From Model Training to Full-Stack Deployment
1

Section 01

[Introduction] Overview of the Full-Stack Solution for CNN-Based Plant Leaf Disease Recognition System

This article introduces a full-stack AI application that uses Convolutional Neural Networks (CNN) to identify 39 types of plant diseases. The system supports two deployment modes: Streamlit monolithic deployment and React+FastAPI front-end/back-end separation. It ensures input quality through HSV color space validation and MobileNetV2 pre-filtering, and can serve scenarios such as agricultural production and scientific research. The original project is maintained by rohanth3 and published on GitHub (link: https://github.com/rohanth3/Plant-Disease-Detection-from-Leaf-Images-CNN) on May 25, 2026.

2

Section 02

Project Background and Significance

Crop diseases cause 20%-40% of global food losses annually. Traditional identification relies on expert experience, which has issues like poor timeliness and limited coverage. This project builds a complete system that identifies 39 disease states of 14 crops, including model training and a full web application deployment plan, to support agricultural production and scientific research.

3

Section 03

System Architecture Design

Two deployment architectures are provided:

  1. Streamlit monolithic: Components are packaged in a Python application, suitable for rapid deployment/personal use. Process: Upload → HSV+MobileNetV2 validation → Inference → Result display. Tech stack: Python, Streamlit, TensorFlow/Keras, etc. Demo address: https://plant-disease-detection-from-leaf-images-cnn-rohanth33.streamlit.app/
  2. React+FastAPI separated: Front-end and back-end separated, suitable for high-concurrency scenarios. Process: React upload → FastAPI processing → Inference → Return results. Front-end uses React+Material-UI+Axios; back-end uses Python+FastAPI+Uvicorn.
4

Section 04

Core Machine Learning Engine

Shares an underlying inference engine trained on the PlantVillage dataset (50,000+ labeled images) to classify 39 states (14 crops). Input validation mechanism:

  • HSV color space validation: Filters non-green images
  • MobileNetV2 pre-filtering: Compares against a non-plant blacklist. Only images passing both validation layers enter the main CNN classification.
5

Section 05

Analysis of Technical Highlights

  1. Dual-architecture flexibility: Streamlit is suitable for prototypes/small-scale use; the separated version fits production environments
  2. Input quality control: Double-layer validation reduces false positive rates
  3. Full-stack selection: FastAPI (asynchronous, OpenAPI), React+Material-UI (user experience), TensorFlow SavedModel (cross-platform)
6

Section 06

Application Scenarios and Value

  • Agricultural disease early warning: Farmers can diagnose instantly to prevent early and reduce losses
  • Scientific research assistance: Batch process samples and analyze disease patterns statistically
  • Education and training: Teaching tool and standardized diagnostic reference
  • Smart agriculture integration: Automated monitoring for drone inspections
7

Section 07

Deployment and Usage Recommendations

Local development: Clone the repository → Install dependencies → Download the model → Run Streamlit (streamlit run app.py) or FastAPI (uvicorn main:app --reload) Cloud deployment: Deploy the Streamlit version to Streamlit Cloud; containerize the FastAPI version and deploy to AWS/GCP, etc. Model optimization: Quantization compression (FP32→INT8), edge deployment (TensorFlow Lite), incremental learning (optimization based on user feedback)

8

Section 08

Summary and Outlook

This project demonstrates the complete process from model training to full-stack deployment. It has flexible dual architectures, reliable input validation, and clear code structure, making it an excellent reference for agricultural AI applications. AI-enabled plant disease recognition will play a greater role in the global digitalization process as technology advances.