Your Cart

Your Wishlist

EXPLORE

Project Categories

9:30 AM - 6:30 PM | Call Us | WhatsApp

Chat with us Download App Sentiment Analysis of Deepfake Tweets Detecting Emotional Trends and Misinformation Best Final year engineering projects in bangalore

AI-Based Plant Leaf Disease Detection Using CNN and Flask Web Application

Category: Python Projects

Price: ₹ 4500 ₹ 10000 0% OFF

YouTube Video
Product Image

Abstract
Plant diseases are one of the major factors responsible for reduced agricultural productivity and economic losses. Early and accurate identification of diseases is therefore essential for effective crop management and timely treatment. This project presents an AI-based Leaf Disease Detection and Classification System that uses Convolutional Neural Networks (CNN) and a Flask web application to identify plant leaf diseases from uploaded images. The proposed system is designed to classify leaf images into two categories: Healthy Leaf and Powdery Mildew.
The system consists of two major components: model training and web-based disease prediction. During model training, leaf images stored in a structured dataset are automatically loaded using TensorFlow's image_dataset_from_directory() function. The dataset is divided into training and validation sets using an 80:20 split. All images are resized to 224 × 224 pixels and processed in batches. A CNN architecture consisting of convolutional layers, max-pooling layers, a fully connected dense layer, and a sigmoid output layer is developed for binary classification. The model is trained using the Adam optimizer and binary cross-entropy loss for 10 epochs. After training, the model is saved in Keras format as leaf_disease_classifier.keras.
The trained model is integrated into a Flask-based web application that provides a user-friendly interface for image-based disease prediction. Users can register and securely log in using password hashing, upload a leaf image, and receive a predicted disease class along with its confidence score. The uploaded image is resized to the same 224 × 224 input size used during training before being passed to the trained CNN model. The prediction is evaluated using a sigmoid probability threshold of 0.5 to determine whether the leaf is healthy or affected by powdery mildew. SQLite and Flask-SQLAlchemy are used to manage user registration and authentication data.
The proposed system demonstrates how deep learning, image processing, and web technologies can be combined to create an accessible plant disease identification platform. Such a system can assist farmers, agricultural students, researchers, and other users in obtaining rapid preliminary information about plant health from leaf images. The project also provides a foundation for future expansion to multiple crops and diseases, improved CNN architectures, larger datasets, real-time crop monitoring, and mobile or IoT-based agricultural decision-support systems.
INTRODUCTION
Agriculture is one of the most important sectors for supporting human life, food security, employment, and economic development. The productivity and quality of agricultural crops are strongly influenced by plant health. Among the major factors affecting crop production, plant diseases are a significant concern because they can damage leaves, reduce plant growth, decrease crop quality, and ultimately cause substantial yield losses. Early identification of plant diseases is therefore essential for taking appropriate preventive and corrective measures.
Traditionally, plant diseases are identified by visually inspecting leaves and comparing visible symptoms such as spots, discoloration, powder-like substances, wilting, and changes in leaf texture. Although manual inspection can be effective when performed by experienced agricultural experts, it has several limitations. It can be time-consuming, subjective, and difficult to perform on a large number of plants. Furthermore, farmers may not always have immediate access to agricultural specialists, particularly in remote areas. These limitations create a need for automated systems capable of providing rapid and consistent disease identification.
Recent developments in Artificial Intelligence (AI), Machine Learning (ML), Computer Vision, and Deep Learning have created new opportunities for automated agricultural disease detection. Deep learning techniques, particularly Convolutional Neural Networks (CNNs), are highly suitable for image classification tasks because they can automatically learn important visual features from images. Instead of manually defining characteristics of diseased leaves, a CNN can learn patterns such as color variations, textures, edges, spots, and other visual symptoms directly from a collection of training images.
This project focuses on the development of an AI-Based Leaf Disease Detection and Classification System using a CNN model. The system is designed as a binary image-classification application capable of identifying two categories: Healthy Leaf and Powdery Mildew. A dataset containing images belonging to these categories is used to train and validate the deep learning model. The images are resized to 224 × 224 pixels so that they have a consistent input dimension. The dataset is divided into training and validation portions, allowing the performance of the trained model to be evaluated on images that were not used for training.
The CNN architecture implemented in this project consists of multiple convolutional layers followed by max-pooling layers. The convolutional layers extract visual features from the leaf images, while max-pooling reduces the spatial dimensions of the extracted feature maps. The resulting features are passed through a fully connected dense layer before reaching the final sigmoid output layer. Since the project performs binary classification, the sigmoid activation function produces a probability value that can be interpreted to determine whether the uploaded leaf belongs to the healthy or diseased category.
After the model has been trained, it is saved in the Keras .keras model format and integrated into a Flask web application. Flask provides the backend framework required to accept user requests, process uploaded images, execute model predictions, and return the prediction results through web pages. The application also includes user registration and login functionality. Flask-SQLAlchemy and SQLite are used to store user account information, while passwords are protected using password hashing rather than being stored directly.
When a user uploads a leaf image, the Flask application stores the image temporarily in the configured upload directory. The image is then loaded using TensorFlow/Keras image-processing functions and resized to the same 224 × 224 pixel dimensions used during model training. The image is converted into a numerical array and supplied to the trained CNN model. The model generates a prediction probability, and a threshold of 0.5 is used to determine the final classification. The application then displays the predicted class and corresponding confidence percentage to the user.
The proposed system combines deep learning, image processing, database management, user authentication, and web application development into a single platform. It provides a simple approach for obtaining an initial assessment of plant leaf health without requiring the user to manually analyze the image. Although the current implementation is limited to Healthy Leaf and Powdery Mildew classes, the architecture can be extended to support multiple crops and multiple diseases by training the model with a larger and more diverse dataset.
Overall, this project demonstrates the practical application of artificial intelligence in agriculture. By automating the initial stage of leaf disease identification, the system can help improve the speed and accessibility of plant health assessment. With further development, the system can be enhanced using advanced CNN architectures, data augmentation, larger datasets, real-time crop monitoring, mobile applications, and IoT-based agricultural systems, making it a useful component of a broader smart farming and agricultural decision-support system.

Block Diagram

block-diagram