0% found this document useful (0 votes)
9 views55 pages

Medicinal Plant Identification Using ML Abinesh A

The document is an internship report for a project titled 'Medicinal Plant Identification Using ML' submitted by Abinesh A for a Bachelor of Engineering degree. The project aims to automate the identification of medicinal plants using machine learning techniques, particularly Convolutional Neural Networks (CNNs), to enhance accuracy and usability. The report outlines the methodology, objectives, and significance of the project in the context of herbal medicine and biodiversity conservation.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views55 pages

Medicinal Plant Identification Using ML Abinesh A

The document is an internship report for a project titled 'Medicinal Plant Identification Using ML' submitted by Abinesh A for a Bachelor of Engineering degree. The project aims to automate the identification of medicinal plants using machine learning techniques, particularly Convolutional Neural Networks (CNNs), to enhance accuracy and usability. The report outlines the methodology, objectives, and significance of the project in the context of herbal medicine and biodiversity conservation.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 55

MEDICINAL PLANT IDENTIFICATION USING ML

Internship report submitted in partial fulfilment for the award of degree


Of

BACHELOR OF ENGINEERING

IN

COMPUTER SCIENCE AND BUSINESS SYSTEM

Submitted by
ABINESH A (720922244003)

JCT COLLEGE OF ENGINEERING & TECHNOLOGY


COIMBATORE-641 105

Affiliated to ANNA UNIVERSITY, CHENNAI-600 025

NOVEMBER 2024
BONAFIDE CERTIFICATE

Certified that this viva report “MEDICINAL PLANT IDENTIFICATION


USING ML” is a bona-fide work of “ABINESH A (720922244003)” who carried out
the project work under my supervision.

SIGNATURE SIGNATURE

Prof. K. MALARVIZHI., M.E., (Ph.D) Mrs. K. MALARVIZHI., M.E., (Ph.D)

HEAD OF THE DEPARTMENT HEAD OF THE DEPARTMENT


ASSOCIATE PROFESSOR ASSOCIATE PROFESSOR
Computer Science and Business Systems Computer Science and Business System
JCT College of Engineering and Technology, Coimbatore JCT College of Engineering and Technology, Coimbatore

Submitted for the Project Viva-voice Examination held on ______________

Internal Examiner External Examiner

Page | ii
ACKNOWLEDGEMENT

At this pleasing moment of having successfully completed our project, we wish to convey
our sincere thanks and gratitude to the management of our college our beloved Secretary
Shri.R. Durga Shankar who provided all the facilities to us.

We would like greatly indebted to our Principal Dr.S. Manoharan, M.E., Ph.D., who has
been the motivating force behind all our deeds

We earnestly express our sincere thanks to our Head of the Department of Computer Science
and Business Systems Prof. K.Malarvizhi, M.E., (Ph.D)., for his immense encouragement
and support throughout the project

. We are very much obliged to express our sincere thanks and gratitude to our beloved
supervisor Prof. K.Malarvizhi, Associate Professor of Computer Science and Business
Systems who gave us valuable suggestions, constructive criticisms and encouragement that
has enables us to complete our project successfully.

We extend our heartfelt gratitude to our parents and friends and those who supported directly
and indirectly to complete the project successfully.

Page | iii
Vision

To emerge as Premier Institute for developing industry ready engineers with


competency, initiative and character to meet the challenges of global environment.

Mission

 To impart state-of-the-art engineering and professional education through strong


theoretical basics and hands on training to students, in their choice of field.
 To serve our students by teaching them leadership, entrepreneurship, teamwork,
values, quality, ethics and respect for others.
 To provide opportunities for long-term interaction with academia and industry.

To create new knowledge through innovation and research

Page | iv
Page | v
ABSTRACT

This project presents an innovative approach for automating the identification


of medicinal plants through image processing techniques. Leveraging a diverse dataset
of plant images, encompassing variations in growth stage and environmental
conditions, the system employs preprocessing methods to enhance image quality and
extract pertinent features such as leaf shape, texture, and color. By integrating machine
learning algorithms, particularly Convolutional Neural Networks (CNNs) with transfer
learning, the system achieves high accuracy in classifying plant species. A user-
friendly interface enables seamless plant image uploads and instant identificatio n
results, empowering researchers, herbalists, and enthusiasts with accessible, on-the-
go identification capabilities. Comparative evaluations demonstrate the system's
superiority in accuracy, speed, and usability compared to existing methods, thus
contributing significantly to the fields of botany, herbal medicine, and biodiversity
conservation by offering a reliable tool for plant species identification and
documentation.

Page | vi
TABLE OF CONTENTS

CHAPTER TITLE PAGE NO NO

ABSTRACT v

LIST OF FIGURES viii

LIST OF SYMBOLS AND ABBREVIATIONS ix

1 INTRODUCTION 1
1.1
OBJECTIVES OF THE PROJECT 1
1.2
SCOPE OF THE PROJECT 2

2 LITERATURE REVIEW 3

3 METHODOLOGY 6
3.1
DATA COLLECTION 6
3.2
PREPROCESSING 6
3.3
FEATURE EXTRACTION AND MODEL TRAINING 7
3.4
TESTING AND VALIDATION OF MODELS 7
4 EXPERIMENTAL SETUP AND PROCEDURE 9
4.1
SOFTWARE TOOLS 9
4.2
STEPS TO UPLOAD 10
4.3
CLASSIFICATION OF IMAGES 10

5 TOOLS 12
5.1
FRONT END 12
5.2
BACK END 13
5.3
MACHINE LEARNING LIBRARIES 14

Page | vii
6 EXISTING SYSTEM AND PROPOSED SYSTEM 15
6.1
EXISTING SYSTEM 15
6.2
PROPOSED SYSTEM 16

7 MACHINE LEARNING ALGORITHMS AND MODELS 18


7.1
CONVOLUTIONAL NEURAL NETWORKS 18
7.2
DECISION TREES 19

8 TESTING AND IMPLEMENTATION 21


8.1
TYPES OF TESTING USED 21
8.2
IMPLEMENTATION PLANNING 23

9 SOURCE CODE AND SCREENSHOT 25

10 CONCLUSION 44
I) CONCLUSION 44
II) FUTURE ENHANCEMENT 44

Page | viii
TABLE OF CONTENT

DATE DAY ACTIVITIES

30/08/2024 TUESDAY INTRODUCTION

03/09/2024 SATURDAY LITERATURE


REVIEW

06/09/2024 TUESDAY METHODOLOGY

09/09/2024 FRIDAY EXPERIMENTAL


SETUP AND
PROCEDURE

13/09/2024 WEDNESDAY TOOLS

16/09/2024 SATURDAY EXISTING SYSTEM


AND PROPOSED
SYSTEM

19/09/2024 TUESDAY MACHINE


LEARNING
ALGORITHMS AND
MODELS

Page | ix
TABLE OF CONTENTS

22/09/2024 FRIDAY TESTING AND


IMPLEMENTATION

23/09/2024 SATURDAY SOURCE CODE AND


SCREENSHOT

25/09/2024 MONDAY CONCLUSION

Page | x
DATE: 30/08/2024 DAY: TUESDAY

CHAPTER 1

INTRODUCTION

The "Medicinal Plant Identification" project aims to address the growing need for
accurate identification of medicinal plants using modern technologies like machine
learning. Medicinal plants have been used for centuries in traditional medicine to
treat various ailments, but accurate identification is often challenging due to the
vast number of species and their visual similarities. Misidentification can lead to
incorrect usage, potentially causing harm instead of providing benefits. The project
is designed to automate the process of identifying medicinal plants through an AI-
driven system that uses image recognition techniques, thus providing a reliable
solution for both professionals and enthusiasts in the field.

This project leverages machine learning models, particularly in the domain of


computer vision, to classify plants based on their features from images. By training
models on a dataset of plant images, the system can accurately distinguish between
different species of medicinal plants. The use of advanced algorithms ensures that
the identification is not only fast but also precise, allowing users to confidently
determine which plant they are dealing with. This approach mitigates the risk of
human error, which is common in manual identification.

1.1 OBJECTIVES OF THE PROJECT

The Medicinal Plant Identification project has several clearly defined


objectives, each aimed at creating a robust, reliable, and user-friendly system for
identifying medicinal plants. The first and foremost objective is to develop a highly
accurate identification system. In the realm of medicinal plants, precision is
essential since misidentification can lead to incorrect usage, which might result in

Page | 1
adverse health outcomes. By using machine learning algorithms trained on specific
plant datasets, the system seeks to offer reliable identification, ensuring users can
trust the results provided. This accuracy is especially critical for researchers and
healthcare professionals who depend on precise information.

The project also aims to leverage the power of machine learning models to identify
plants based on visual characteristics. Specifically, the use of Convolutional Neural
Networks (CNNs), known for their efficiency in image recognition tasks, allows
the system to process plant images and extract important features. These features
are then used to classify the plants into respective species. The objective is not only
to train these models for accurate classification but also to continuously refine them
through testing and feedback loops to enhance their performance over time.

1.2 SCOPE OF THE PROJECT

The Medicinal Plant Identification project is designed with a clear scope,


focusing on specific aspects of plant identification that address the challenges faced
in the field of herbal medicine and botany. At its core, the project focuses
exclusively on the identification of medicinal plants. This narrow focus allows the
system to specialize in plants that are known for their therapeutic properties,
distinguishing it from general plant identification systems. By concentrating on
medicinal plants, the system serves a distinct need in both the healthcare industry
and botanical research, making it particularly valuable for professionals in these
fields.

The system's identification method is based on image recognition, meaning that the
scope is limited to visual characteristics such as leaf shape, size, color, texture, and
other physical features of the plant. While there are other ways to identify plants

Page | 2
DATE: 03/09/2024 DAY:SATURDAY

CHAPTER 2

LITERATURE REVIEW

IMPORTANCE OF MEDICINAL PLANT IDENTIFICATION

Medicinal plants have been used for centuries in traditional and modern
medicine. The accurate identification of these plants is crucial for their safe and
effective use in herbal remedies and pharmaceutical formulations.
Misidentification can result in incorrect treatment, leading to adverse health effects.
Many studies have emphasized the need for reliable systems to identify medicinal
plants, particularly in areas where traditional knowledge is gradually disappearing.
Early identification systems often relied on manual taxonomic methods, which
were labor-intensive and required expert knowledge. These manual methods, while
effective, are not scalable for modern applications, creating a need for automated
solutions.

Traditional Identification Methods

In traditional botany, plant identification is carried out through the study


of morphological features such as leaves, flowers, stems, and roots. These features
are used to categorize plants into taxonomic classifications. While experts are
highly skilled in this process, non-specialists often struggle with identifying plants
correctly, especially when dealing with species that have similar visual traits. Early
identification systems employed dichotomous keys and field guides, which
provided a step-by-step approach to identification but were limited in terms of
scalability and ease of use.

Page | 3
Image-Based Plant Identification Systems

In recent years, the advancement of digital image processing has led to


the development of image-based plant identification systems. These systems aim
to automate the identification process by using software that can analyze plant
features from images. Image-based systems provide a more accessible solution
compared to manual methods, as they allow users to upload pictures of plants and
receive identification results without requiring expert knowledge. Early systems
used simple image matching algorithms, but the accuracy of these systems was
limited by factors such as lighting conditions, image quality, and background noise.

Machine Learning in Image Recognition

The application of machine learning, especially in image recognition, has


significantly improved the accuracy and efficiency of plant identification systems.
Machine learning models, particularly Convolutional Neural Networks (CNNs),
are now widely used for image classification tasks, including plant identification.
CNNs are well-suited for extracting features from images, such as shapes, textures,
and colors, which are essential for distinguishing between different plant species.
Studies have shown that CNNs outperform traditional image-matching algorithms
in terms of accuracy and robustness, making them a key technology in modern
plant identification systems.

Machine Learning in Plant Identification

Several research projects have successfully applied machine learning


techniques to plant identification. A prominent example is the PlantCLEF
initiative, which hosts an annual competition to advance the state of plant
identification systems. Competitors are provided with large datasets of plant
images and are tasked with developing machine learning models to classify them.
Results from these competitions demonstrate that machine learning, and CNNs in
particular, can achieve high levels of accuracy, even when dealing with large
Page | 4
datasets and diverse plant species. The success of these projects highlights the
potential for machine learning to revolutionize plant identification.

Dataset Challenges in Medicinal Plant Identification

A major challenge in developing accurate plant identification systems is


the availability of high-quality datasets. For medicinal plant identification, datasets
need to include a diverse range of species, high-resolution images, and metadata
such as plant locations, phenology, and traditional uses. Studies emphasize the
importance of creating large and diverse datasets to train machine learning models
effectively. Datasets like PlantVillage, Flavia Leaf Dataset, and Leafsnap have
been instrumental in training machine learning models, but they are often limited
in their coverage of medicinal plants. The lack of comprehensive datasets
specifically for medicinal plants is a gap that your project seeks to address.

Feature Extraction in Plant Identification

Feature extraction is a crucial step in plant identification systems. Early


approaches relied on handcrafted features such as leaf shape descriptors, edge
detection, and texture analysis to classify plants. These features were then fed into
classifiers like Support Vector Machines (SVM) or k-Nearest Neighbors (k-NN) to
predict plant species. However, the manual nature of feature extraction made these
systems difficult to scale. With the advent of deep learning, feature extraction is
now largely automated, with CNNs learning relevant features directly from image
data, thus improving scalability and performance.

Transfer Learning in Plant Identification

One of the key innovations in machine learning for plant identification


is the use of transfer learning. Transfer learning involves pre-training a CNN model
on a large dataset, such as ImageNet, and then fine-tuning it on a smaller, domain-
specific dataset, like medicinal plant images. Studies

Page | 5
DATE: 06/09/2024 DAY:TUESDAY

CHAPTER 3

METHODOLOGY

The methodology of this project outlines the key steps involved in


building a reliable and accurate medicinal plant identification system using
machine learning. This process involves systematic data collection, image
preprocessing, feature extraction, model training, and finally, testing and validation
to ensure the effectiveness of the model. Each stage plays a vital role in the
development of a robust identification system capable of distinguishing between
different medicinal plant species based on their visual characteristics. The
combination of machine learning algorithms, image processing techniques, and
well-structured datasets ensures that the system is capable of delivering accurate
plant identification in real-world scenarios.

3.1 DATA COLLECTION

Data collection is the cornerstone of any machine learning project, and


in this case, it involves gathering a large and diverse set of images representing
different medicinal plant species. The objective is to compile a comprehensive
dataset of high-quality images that showcase various parts of the plants, including
leaves, stems, flowers, and roots, under different environmental conditions. These
images are obtained from multiple sources, such as online botanical databases,
existing plant image repositories, and manual photography, ensuring a wide variety
of data that can account for natural variations in plant appearance.

3.2 PRE PROCESSING

Once the dataset has been collected, the next step is preprocessing,
which transforms the raw images into a format suitable for machine learning.

Page | 6
Preprocessing is essential because the images come from diverse sources and may
vary significantly in terms of size, resolution, orientation, and visual quality.
Without preprocessing, the machine learning model might struggle to learn
consistent patterns from the data, leading to poor performance.

3.3 FEATURE EXTRACTION AND MODEL TRAINING

After preprocessing, the next step is feature extraction and model


training. Feature extraction refers to the process of identifying the key attributes of
medicinal plants that can be used to differentiate one species from another. In
traditional machine learning approaches, this would involve manually identifying
specific features, such as leaf shape or texture, that are important for classifi cation.
However, in this project, Convolutional Neural Networks (CNNs) are used to
automatically extract features from the images. CNNs are highly effective in image
classification tasks because they can learn and identify visual features
hierarchically, starting with basic patterns like edges and textures and progressing
to more complex structures like leaf veins and plant shapes.

MODEL OPTIMIZATION AND FINE-TUNING

Once the initial testing and validation phases are complete, the next step
is model optimization and fine-tuning to further enhance the performance of the
plant identification system. Model optimization involves refining the architecture,
hyperparameters, and learning algorithms used during training. Techniques such as
early stopping are employed to prevent overfitting, where the model stops training
once the performance on the validation set starts to degrade. This ensures that the
model does not memorize the training data but instead generalizes well to unseen
images.

Another important optimization step is hyperparameter tuning. Hyperparameters


such as the learning rate, number of epochs, batch size, and number of
Page | 7
convolutional layers are crucial in determining the model's efficiency and accuracy.
Techniques like grid search or random search are used to experiment with different
combinations of hyperparameters to find the most effective setup for this specific
dataset and classification task.

Moreover, techniques like dropoutlayers and batch normalization are introduced


into the CNN architecture to improve generalization and accelerate the training process.
The final step in the methodology is the deployment of the trained model
and its integration into a user-friendly web application using Flask. Flask, a
lightweight Python web framework, serves as the backend platform, allowing the
model to be hosted and accessed by users through a web interface. The model, now
optimized for deployment, is loaded into the Flask environment, where it can
process image inputs uploaded by users and return predictions in real time.

3.4 TESTING AND VALIDATION OF MODELS

The final stage of the methodology is testing and validation, which


ensures that the trained model is accurate and reliable for real-world applications.
Once the model has been trained, it must be evaluated on a separate dataset that
was not used during training. This testing dataset helps to assess how well the
model generalizes to new, unseen data. Various performance metrics are used to
evaluate the model’s effectiveness, including accuracy, precision, recall, and the
F1-score. These metrics provide a comprehensive understanding of the model's
classification ability, revealing its strengths and areas for improvement.

In addition to testing, cross-validation techniques are used to further validate the


model. K-fold cross-validation is commonly employed, where the dataset is
divided into 'K' subsets, and the model is trained and tested 'K' times, each time
using a different subset as the test set and the others as the training set. This method
helps to reduce the risk of overfitting and ensures that the model performs well
across the entire dataset, rather than just a specific portion.
Page | 8
DATE:09/09/2024 DAY:FRIDAY

CHAPTER-4

EXPERIMENTAL SETUP AND PROCEDURE

This chapter outlines the experimental setup and the systematic


procedures followed in developing and testing the Medicinal Plant Identification
system. The setup involves the selection and use of appropriate software tools, the
process of uploading and handling image data, and the classification of images
using machine learning models. Each of these components plays a critical role in
ensuring that the project is efficiently executed and that the results are both accurate
and reproducible.

4.1 SOFTWARE TOOLS

The success of the Medicinal Plant Identification project relies heavily


on the use of various software tools that enable the efficient execution of the
machine learning pipeline. The primary tool used for developing the backend of
this system is Flask, a lightweight web framework in Python. Flask is chosen for
its simplicity and flexibility, allowing the easy integration of the machine learning
models into a web-based application. Flask facilitates seamless communication
between the front-end interface and the back-end logic, enabling users to interact
with the model by uploading plant images through a web browser.

For the machine learning aspect, the core programming language is Python, which
is widely used for data science and machine learning due to its extensive libraries
and frameworks. Specifically, libraries such as TensorFlow, Keras, and Scikit-
learn are used to implement and train the models. These libraries provide pre-built
functions and tools for neural network architectures, feature extraction, and data
preprocessing, allowing for a smooth workflow in building and fine-tuning the

Page | 9
4.2 STEPS TO UPLOAD

The steps to upload an image for plant identification are designed to be


simple and user-friendly, ensuring that users with minimal technical expertise can
easily interact with the application.

Accessing the Interface: The process begins when the user opens the application in
a web browser. The home page provides a straightforward interface where the
user is prompted to upload an image.

Selecting the Image: Once the user clicks on the upload button, they can browse
their local directories and select the desired plant image. After choosing the file,
the file name is displayed on the interface, confirming the selection.

Submitting the Image: After selecting the image, the user clicks the "Submit"
button, which sends the image to the Flask backend for processing. The system
uses POST requests to securely transfer the image from the client-side to the server-
side

4.3 CLASSIFICATION OF IMAGES

Image classification is at the heart of the Medicinal Plant Identification


system, where machine learning models are used to classify uploaded images into
distinct plant species. This process involves multiple stages, starting from feature
extraction to final predictions. The system is designed to handle the inherent
variability in plant images, ensuring that it can classify plants correctly even under
different environmental conditions.
Feature Extraction: The first step in image classification is feature extraction. Once
the image is uploaded and preprocessed (resized and normalized), it is fed into a
Convolutional Neural Network (CNN) model. CNNs are ideal for image
classification tasks as they automatically learn and extract important features from
images. For medicinal plants, the CNN model identifies specific features such as
Page | 10
the shape, texture, and vein patterns of the leaves, which are crucial in
distinguishing between different plant species. Layers of the CNN capture these
patterns hierarchically, starting with basic features (edges and contours) and
progressing to more complex plant-specific features.
Classification Model: After feature extraction, the image is passed through the fully
connected layers of the CNN model, where the features are used to classify the
plant species. The model has been trained on a large dataset of medicinal plant
images, allowing it to associate specific feature patterns with their corresponding
plant labels. For this project, multiple CNN architectures, such as VG G16, ResNet,
and Inception, are considered. These architectures are optimized to handle large-
scale image classification tasks, ensuring high accuracy in identifying medicinal
plants.
Model Decision: The model processes the extracted features and makes a
prediction based on its learned weights. The final output is a probability distribution
over the possible plant species, where the species with the highest probability is
selected as the predicted label.
USE CASE DIAGRAM

Page | 11
DATE:13/09/2024 DAY:WEDNESDAY

CHAPTER 5

TOOLS

The Medicinal Plant Identification system is built upon a carefully


selected set of tools that ensure the seamless execution of both the web interface
and the machine learning model. These tools span across various aspects of the
system, including the front-end, which handles user interactions; the back-end,
responsible for processing requests and managing data flow; and the machine
learning libraries, which form the core of the system's intelligence. Each tool plays
a crucial role in ensuring the system operates efficiently, is user-friendly, and
accurately identifies medicinal plants. In this section, we will delve into the tools
used, starting from the front-end technologies to the back-end infrastructure and
finally, the machine learning libraries that power the plant identification process.

5.1 FRONT END

The front-end of the Medicinal Plant Identification system is built with a


combination of HTML, CSS, and JavaScript, which work together to create an
intuitive and interactive user interface. These technologies ensure that users can
seamlessly interact with the system, upload images, and view results.

HTML

HTML is the foundational language used to structure the web pages of


the Medicinal Plant Identification system. It defines the layout of the elements on
the page, such as text, images, forms, buttons, and links. HTML is essential for
creating the user interface where users can upload plant images for identification.
In this project, HTML is used to build the skeleton of the upload page, which

Page | 12
includes fields where users can select an image file, buttons to submit the image,
and placeholders for displaying the classification result.

CSS

CSS is used to style the HTML elements and define how they are
presented on the screen. It enhances the visual appeal of the user interface by
controlling the layout, colors, fonts, and overall design. In the Medicinal Plant
Identification system, CSS is employed to ensure that the web pages are
aesthetically pleasing and user-friendly, providing a seamless experience across
different devices.

JavaScript

JavaScript plays a crucial role in adding interactivity and dynamic


functionality to the front-end. It allows the web page to respond to user inputs
without needing to reload the entire page. In the Medicinal Plant Identification
system, JavaScript is used to handle various client-side interactions, such as
validating the uploaded image file and displaying real-time previews.

5.2 BACK END

The back-end of the Medicinal Plant Identification system is where the


image processing, model training, and classification occur. It is developed using
Python and Flask, which provide the necessary infrastructure for handling requests
from the front-end and processing them with the machine learning models.

Python

Python is the primary programming language used in the back-end of the


Medicinal Plant Identification system. Python's flexibility and vast ecosystem of
libraries make it ideal for both web development and machine learning tasks. In
this project, Python is used for several crucial functions, including image

Page | 13
processing, model training, and handling data flow between the front-end and back-
end.

Flask
Flask is a lightweight and flexible web framework for Python, used to
build the server-side of the Medicinal Plant Identification system. Flask handles
requests from the front-end, processes the uploaded image, and returns the
classification result. It is chosen for this project due to its simplicity and ease of
integration with Python-based machine learning libraries.

5.3 MACHINE LEARNING LIBRARIES

At the heart of the Medicinal Plant Identification system lies the machinelearning
models that are responsible for classifying the plants based on their images. These
models are built and trained using a variety of powerful machine learning libraries,
each offering specific functionalities that contribute to the system’s overall
accuracy and performance. The primary libraries used for this project are
TensorFlow, Keras, Scikit-learn, and OpenCV. TensorFlow is the primary
framework used for building the deep learning models that power the plant
identification process. In this project, TensorFlow is used to build Convolutional
Neural Networks (CNNs), which are particularly effective in analyzing image data
and extracting meaningful features such as leaf shape, texture, and color.

Keras, a high-level API built on top of TensorFlow, simplifies the process of model
building and training. Keras allows developers to quickly prototype neural network
architectures, experiment with different layers, and optimize the model’s
performance through intuitive functions. For this project, Keras is used to define
the CNN structure and fine-tune the hyperparameters of the model. Its support for
transfer learning also allows the project to leverage pre-trained models like VGG16
and ResNet, significantly reducing the training time while maintaining high
accuracy in classifying medicinal plants.

Page | 14
DATE:16/09/2024 DAY:SATURDAY

CHAPTER 6

EXISTING SYSTEM AND PROPOSED SYSTEM

The Medicinal Plant Identification project addresses a significant gap in


current systems that aim to classify plants based on images. Many traditional
methods for identifying plants require manual expertise, field research, or time-
consuming laboratory work, making it difficult for people to accurately identify
medicinal plants without professional assistance. This section provides an
overview of the Existing System and contrasts it with the innovations introduced
by the Proposed System, which leverages machine learning to automate and
enhance plant identification processes.

6.1 EXISTING SYSTEM

The existing systems for plant identification, particularly medicinal


plants, primarily rely on manual methods, expert intervention, and traditional
botanical approaches. These methods often require individuals with specialized
knowledge, such as botanists or herbalists, who are familiar with plant species,
their physical characteristics, and their medicinal properties. Below are the key
aspects of how the existing system operates:

Manual Identification by Experts

In the current system, the identification of plants, especially medicinal


ones, depends heavily on experts who can visually recognize plant species. They
rely on key features like leaf shape, stem structure, flower patterns, and overall
plant morphology. While accurate, this method is labor-intensive and can be
subjective, depending on the expert’s experience and knowledge. Furthermore,

Page | 15
it is not scalable, as it requires direct human involvement for each identification
process.

Laboratory-Based Identification Methods

For more precise identification, laboratory-based techniques like DNA


barcoding or chemical analysis of plant compounds can be used. These methods
are highly accurate but are time-consuming and expensive, requiring specialized
equipment and trained personnel. Such techniques are typically used in research
settings and are not accessible to the general public for everyday identification
needs.

Limited Accessibility and Scalability

The existing systems have limited accessibility for non-experts,


particularly those in rural or remote areas where medicinal plants are commonly
found and used. In addition, these systems are not scalable. The need for expert
intervention or specialized equipment makes it difficult to apply these methods on
a large scale or in real-time, limiting their usefulness in dynamic environments like
agriculture, forestry, or everyday medicinal plant use.

6.2 PROPOSED SYSTEM

The Proposed System aims to resolve the challenges posed by existing


methods through the implementation of a machine learning-based solution that
automates the plant identification process. By leveraging image recognition
algorithms, the proposed system can quickly and accurately classify medicinal
plants based on uploaded images, providing users with real-time results and
detailed information about the identified plant. Below are the core components and
advantages of the proposed system:

Machine Learning for Automated Identification

Page | 16
The proposed system uses advanced machine learning algorithms,
specifically Convolutional Neural Networks (CNNs), to identify medicinal plants
from images. CNNs are particularly effective in image classification tasks as they
can detect complex patterns and features in images, such as the shape of leaves,
color variations, and texture. This automation removes the need for expert
involvement, making plant identification faster, more scalable, and accessible to
a wider audience.

Real-Time Image Classification

One of the key advantages of the proposed system is its ability to deliver
real-time plant identification. Users simply upload an image of the plant, and within
seconds, the system provides the classification result. This is made possible by the
pre-trained machine learning models that can process images quickly and
accurately. The real-time capability is particularly useful for individuals who need
to identify plants on the go, such as hikers, botanists in the field, or individuals
using plants for medicinal purposes.

User-Friendly Interface

The system offers a user-friendly interface built using HTML, CSS, and
JavaScript, making it easy for users to upload images and view results without any
technical knowledge. This web-based interface is accessible from any device with
an internet connection, further increasing the system’s accessibility. The simple
design allows users to focus on the task of identifying plants without being
overwhelmed by technical details.

High Accuracy and Consistency

Unlike the manual methods used in existing systems, the proposed


machine learning approach ensures high accuracy and consistency in plant
identification. Once the model is trained, it applies the same standards to every
image it processes, reducing the risk of human error.
Page | 17
DATE:19/09/2024 DAY:TUESDAY

CHAPTER 7

MACHINE LEARNING ALGORITHMS AND MODELS

Machine learning algorithms are at the heart of the Medicinal Plant


Identification system. They enable the system to analyze images, extract relevant
features, and classify plants accurately based on patterns and characteristics that
the models have learned during the training process. Two key algorithms used in
this system are Convolutional Neural Networks (CNNs) and Decision Trees, each
contributing to the identification process in distinct ways. This section provides an
in-depth explanation of these algorithms and their roles in the project.

7.1 CONVOLUTIONAL NEURAL NETWORKS (CNNs)

Convolutional Neural Networks (CNNs) are a class of deep learning


algorithms specifically designed for processing and analyzing visual data, making
them ideal for image classification tasks like the one used in the Medicinal Plant
Identification system. CNNs are particularly effective at detecting patterns in
images, such as edges, textures, and shapes, which are crucial for distinguishing
between different plant species.

Structure of CNNs

CNNs are composed of multiple layers, each serving a specific purpose in


the learning process. The core layers include convolutional layers, pooling layers,
and fully connected layers. The convolutional layers apply filters to the input
image, generating feature maps that highlight important characteristics, such as leaf
shapes, vein patterns, and textures. Pooling layers then reduce the dimensionality
of these feature maps, making the computation more efficient while preserving the
most important features. Finally, fully connected layers combine the extracted
Page | 18
features to make predictions about the class of the image, such as identifying the
plant species.

Feature Extraction and Learning

One of the main strengths of CNNs is their ability to automatically learn and
extract features from images without requiring manual intervention. During
training, CNNs adjust their internal weights and biases based on the input data,
allowing them to learn from the differences and similarities between various plant
species. For example, CNNs can learn to recognize the unique shapes of leaves or
the color patterns of flowers, which are essential for distinguishing medicinal plants
from non-medicinal ones.

Training and Optimization

Training a CNN involves feeding the model with thousands of labeled


images of medicinal plants. The model adjusts its internal parameters based on the
error between its predictions and the actual labels. This process, known as
backpropagation, helps the model improve its classification accuracy over time. In
the Medicinal Plant Identification system, techniques such as dropout and batch
normalization are employed to prevent overfitting and ensure that the model
generalizes well to unseen data.

7.2 DECISION TREES

Decision Trees are another type of machine learning algorithm used in the
Medicinal Plant Identification system, particularly for making decisions based on
non-image data, such as plant attributes or characteristics that cannot be easily
captured through visual patterns. While CNNs handle the visual classification,
Decision Trees can assist in decision-making processes where additional
information about the plant, such as its medicinal properties, habitat, or traditional
uses, is needed.

Structure of Decision Trees

Page | 19
A Decision Tree is a flowchart-like structure where each internal node
represents a decision based on a specific attribute, each branch represents an
outcome of the decision, and each leaf node represents a final classification or
decision. In the context of medicinal plants, a Decision Tree can be used to classify
plants based on their physical characteristics or medicinal properties.

Simple and Intuitive Decision-Making

Decision Trees are popular because of their simplicity and ease of


interpretation. Unlike more complex models, Decision Trees provide a clear and
understandable rationale for each decision they make. This transparency is useful
in the Medicinal Plant Identification system, where users may want to understand
why a particular plant was classified as a specific species or why it has certain
medicinal properties.

Handling Complex Decision Processes

Decision Trees can handle complex decision-making processes by


considering multiple variables simultaneously. In the case of medicinal plants, the
Decision Tree can weigh various factors, such as the plant’s size, leaf structure, and
habitat, to make an informed classification or decision about its medicinal
properties. This multi-factor decision-making process ensures that the system
provides accurate and context-specific recommendations to users.

Integration with CNNs

While CNNs are used for visual classification, Decision Trees can be
integrated into the system to provide a complementary decision-making process
based on other plant characteristics. By combining CNNs and Decision Trees, the
Medicinal Plant Identification system can deliver more comprehensive results, not
only identifying the plant species but also offering detailed insights into its
medicinal properties and potential uses

Page | 20
DATE: 22/09/2024 DAY:FRIDAY

CHAPTER 8

TESTING AND IMPLEMENTATION

The Testing and Implementation phase is a critical part of the


development process for the Medicinal Plant Identification system. In this phase,
various testing methodologies are applied to ensure that the system functions
correctly, performs as expected, and meets the required standards. Testing helps
identify any bugs or errors in the system, while the implementation phase focuses
on deploying the system in a real-world environment. This section details the types
of testing used and the strategies employed during the implementation of the
system.

8.1 TYPES OF TESTING USED

Testing is an essential part of any software development cycle. For the


Medicinal Plant Identification system, different types of testing have been
employed to ensure that the system is reliable, efficient, and user-friendly. These
include Unit Testing, Integration Testing, Functional Testing, Performance
Testing, and User Acceptance Testing (UAT).

Unit Testing

Unit Testing involves testing individual components of the system, such


as functions, classes, or modules, in isolation to ensure that each part functions as
intended. In the Medicinal Plant Identification system, Unit Testing is conducted
to verify the correct operation of the machine learning models, image processing
functions, and data handling procedures. For example, testing is done to ensure that
each plant species' classification model produces accurate predictions for the given
Page | 21
input images. By isolating specific components, developers can quickly identify
and fix any errors in the code before they propagate to other parts of the system.

Integration Testing

Integration Testing focuses on ensuring that different modules and


components of the system work together seamlessly. In this system, Integration
Testing is crucial for confirming that the front-end interface, machine learning
models, and backend server interact correctly. For instance, when a user uploads
an image, the front-end must successfully communicate with the backend to
process the image, run the machine learning model, and return the plant
identification result. By performing integration tests, developers ensure that the
flow of data between these components works without any issues.

Functional Testing

Functional Testing examines whether the system meets the specified


functional requirements. This involves testing the features that the system is
designed to provide, such as image uploads, plant classification, and providing
users with information about identified plants. In the Medicinal Plant Identification
system, Functional Testing verifies that the core functionality—such as accurate
identification of plant species, the ability to handle multiple image formats, and
providing plant details—works as expected. This type of testing ensures that the
system fulfills its intended purpose.

Performance Testing

Performance Testing evaluates the system’s responsiveness, speed, and


stability under varying levels of user load. For this system, Performance Testing is
essential to ensure that it can handle multiple simultaneous image uploads and plant
identifications without slowing down or crashing. The performance of machine
learning models, especially in real-time classification, is also tested to ensure that

Page | 22
users receive quick responses. The systemis subjected to stress tests to see how it
performs under high traffic conditions or when handling large image files.

User Acceptance Testing (UAT)

User Acceptance Testing (UAT) involves testing the system with real
users to ensure that it meets their expectations and is ready for deployment. In this
case, UAT would involve having botanists, herbalists, or general users test the
system to see if it accurately identifies medicinal plants and provides useful
information about them. Any feedback from users is used to make final adjustments
to the system before its official launch. UAT ensures that the system is intuitive,
user-friendly, and effective in real-world scenarios.

8.2 IMPLEMENTATION PLANNING

The Implementation Planning phase involves outlining the steps required


to deploy the Medicinal Plant Identification system into a real-world environment.
This process includes planning for system integration, ensuring that the
infrastructure is in place to support the system, and training users to effectively
utilize the system. The implementation plan is critical to ensure that the system
operates smoothly and delivers the intended results.

Infrastructure Setup

The first step in the implementation planning process is to set up the


necessary infrastructure to support the system. This includes selecting and
configuring servers to host the web-based platform, ensuring that databases for
storing plant images and classification data are in place, and setting up the backend
using Flask for server-side processing. The infrastructure must be scalable to
handle an increasing number of users as the system gains popularity. Cloud-based
solutions, such as AWS or Google Cloud, are often used to ensure that the system
can scale easily based on demand.

Page | 23
System Integration

System integration is the process of connecting all the different


components of the Medicinal Plant Identification system, including the front-end
interface, machine learning models, and backend server. This step ensures that the
image processing and classification workflows are fully integrated into the system
and that data flows seamlessly between components. During this phase, developers
focus on ensuring that all dependencies and external libraries, such as TensorFlow
or Scikit-learn, are correctly set up and optimized for smooth operation.

User Training and Documentation

Training users to effectively use the system is another important aspect


of the implementation plan. User manuals and documentation are created to guide
users through the steps involved in uploading images, navigating the interface, and
interpreting the classification results. Training sessions may be conducted for users
who require more detailed knowledge of the system, such as researchers or field
workers. This ensures that users can fully leverage the system’s capabilities without
facing technical difficulties.

Full Deployment and Maintenance

The final step of implementation planning is the full deployment of the


system, making it available to all users. After deployment, a plan for ongoing
system maintenance is also created to ensure that the system remains functional
and up-to-date. Maintenance tasks include monitoring system performance,
addressing bugs or issues that arise, and updating the system with new features or
plant data as needed. Continuous monitoring ensures that the system remains
reliable and effective over time.

Page | 24
DATE: 23/09/2024 DAY:SATURDAY

CHAPTER 9

SOURCE CODE AND SCREENSHOT

SOURCE CODE

Front End

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">

<!--=============== FAVICON ===============-->


<link rel="shortcut icon" href="static/favicon.png" type="image/x-icon">

<!--=============== REMIX ICONS ===============-->


<link href="https://cdn.jsdelivr.net/npm/remixicon@2.5.0/fonts/remixicon.css"
rel="stylesheet">

<!--=============== CSS ====

===========-->
<link rel="stylesheet" href="static/css/styles.css">

<title>Medicinal Plant Identifier</title>


<style>
/* Specific styles for the upload section */
.upload-section {
padding: 50px 20px;
text-align: center;
background-color: #e8f5e9;
}

.upload-section h2 {
color: #1b5e20; font-
size: 36px; margin-
bottom: 20px;
}

.upload-section p { color:
#4e4e4e; font-size:
18px; margin-bottom:
40px;
}

Page | 25
.upload-section form {
display: inline-block;
background-color:
#c8e6c9; padding: 20px;
border-radius: 8px;
box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.1);

form input[type="file"] {
padding: 10px; margin-
right: 10px; border-radius:
4px; border: 1px solid
#2e7d32; background-
color: #f1f8e9;
}

form button { background-color:


#388e3c;
color: #fff; border:
none; padding:
10px 20px; font-
size: 16px; border-
radius: 4px; cursor:
pointer;
transition: background-color 0.3s;
}

form button:hover {
background-color: #1b5e20;
}
</style>
</head>
<body>
<!--==================== HEADER ====================-->
<header class="header" id="header">
<nav class="nav container">
<a href="#" class="nav logo">
<i class="ri-leaf-line nav logo-icon"></i> Medicant
</a>
<div class="nav menu" id="nav-menu">
<ul class="nav list">
<li class="nav item">
<a href="#home" class="nav link active-link">Home</a>
</li>
<li class="nav item">
<a href="#about" class="nav link">About</a>
</li>
<li class="nav item">
<a href="#upload" class="nav link">Identify Plant</a>

Page | 26
</li>
<li class="nav item">
<a href="#faqs" class="nav link">FAQs</a>
</li>
<li class="nav item">
<a href="#contact" class="nav link">Contact Us</a> </li>
</ul>
<div class="nav close" id="nav-close"> <i
class="ri-close-line"></i>
</div> </div>
<div class="nav btns">
<!-- Theme change button -->
<i class="ri-moon-line change-theme" id="theme-button"></i>
<div class="nav toggle" id="nav-toggle">
<i class="ri-menu-line"></i>
</div>
</div>
</nav>
</header>

<main class="main">
<!--==================== HOME SECTION ====================-->
<section class="home" id="home">
<div class="home container container grid">
<img src="static/home.png" alt="" class="home img">
<div class="home data">
<h1 class="home title">
Discover Nature's Remedies <br> with Medicinal Plants
</h1>
<p class="home description">
Upload an image of any plant, and we'll help you identify whether it’s a
medicinal plant. Get detailed information on its healing properties, uses, and where it thrives
best—all for free.
</p>
<a href="#about" class="button button--flex">
Learn More <i class="ri-arrow-right-down-line button icon"></i>
</a> </div>

</div>
</section>

<!--==================== ABOUT SECTION ====================-->


<section class="about section container" id="about">
<div class="about container grid">
<img src="static/about.jpeg" alt="" class="about img">
<div class="about data">
<h2 class="section title about title">
What We Do & <br> Why Choose Us
</h2>
Page | 27
<p class="about description">
At Medicant, we specialize in identifying medicinal plants from user-uploaded
images. Our tool helps you determine whether the plant in your image is medicinal, and provides
you with detailed information, including the plant's name, its medicinal uses, and the regions
where it thrives best. We aim to empower users with knowledge about the natural remedies
available in their surroundings.
</p>
<div class="about details">
<p class="about details-description">
<i class="ri-checkbox-fill about details-icon"></i>
We identify medicinal plants and provide detailed information at no cost.
</p>
<p class="about details-description">
<i class="ri-checkbox-fill about details-icon"></i> Learn
how to use these plants to cure various diseases.
</p>
<p class="about details-description">
<i class="ri-checkbox-fill about details-icon"></i>
Discover where these plants grow best and how you can find them. </p>
<p class="about details-description">
<i class="ri-checkbox-fill about details-icon"></i>
100% free service with accurate and reliable plant information. </p>
</div>
<a href="#upload" class="button--link button--flex">
Identify Plant <i class="ri-arrow-right-down-line button
icon"></i> </a>
</div>
</div>
</section>

<!--==================== UPLOAD SECTION ====================-->


<section class="upload-section" id="upload">
<h2>Identify Your Medicinal Plant</h2>
<p>Upload an image of the medicinal plant, and we'll provide you with detailed
information.</p> {% if error %}
<p class="bold-text">{{ error }}</p>
{% endif %}
<form method="POST" enctype="multipart/form-data">
<input type="file" name="file" required>
<button type="submit">Upload Image</button>
</form>
{% if prediction %}
<div class="image-box">
<h2 class="bold-text prediction">Predicted: {{ prediction }}</h2>
<h2 class=" bold-text prediction">preparation of medicine:{{ preparation }}</h2>
<h2 class=" bold-text prediction">uses of medicine:{{ uses }}</h2>

</div>
{% endif %}
</section>
Page | 28
<!--==================== FAQ SECTION ====================-->
<section class="questions section" id="faqs">
<h2 class="section title-center questions title container"> Some
common questions <br> we're often asked
</h2>
<div class="questions container container grid"> <div
class="questions group">
<div class="questions item">
<header class="questions header">
<i class="ri-add-line questions icon"></i>
<h3 class="questions item-title">
My plants are not growing well. What could be the reason? </h3>
</header>
<div class="questions content">
<p class="questions description">
Plants require the right balance of light, water, and nutrients. We can help
you diagnose the issue based on the plant's appearance.
</p>
</div>
</div>
<div class="questions item">
<header class="questions header">
<i class="ri-add-line questions icon"></i>
<h3 class="questions item-title">
How do I identify the right medicinal plant for my needs? </h3>
</header>
<div class="questions content">
<p class="questions description">
Different medicinal plants have different properties. Our plant identifier
tool can help you select the right one based on your requirements.
</p>
</div>
</div>
<div class="questions item">
<header class="questions header">
<i class="ri-add-line questions icon"></i>
<h3 class="questions item-title">
How can I take care of my medicinal plants? </h3>
</header>
<div class="questions content">
<p class="questions description">
Proper care is crucial for medicinal plants. We offer tips and guides to help
you nurture them effectively.
</p>
</div>
</div>
</div>
</div>
</section>

Page | 29
<!--==================== CONTACT SECTION ====================-->
<section class="contact section container" id="contact">
<div class="contact container grid">
<div class="contact box">
<h2 class="section title">
Reach out to us today <br> via any of the given <br> information </h2>
<div class="contact data">
<div class="contact information">
<h3 class="contact subtitle">Call us for instant support</h3>
<span class="contact description">
<i class="ri-phone-line contact icon"></i>
+999 888 777
</span>
</div>
<div class="contact information">
<h3 class="contact subtitle">Write us by mail</h3>
<span class="contact description"> <i
class="ri-mail-line contact icon"></i>
netgrove.info@gmail.com
</span>
</div>
</div>
</div>
<form action="" class="contact form">
<div class="contact inputs">
<div class="contact content">
<input type="email" placeholder=" " class="contact input">
<label for="" class="contact label">Email</label>
</div>
<div class="contact content">
<input type="text" placeholder=" " class="contact input">
<label for="" class="contact label">Subject</label>

</div>
<div class="contact content contact area"> <textarea
name="message" placeholder=" "
class="contact input"></textarea>
<label for="" class="contact label">Message</label> </div>
</div>
<button class="button button--flex">
Send Message
<i class="ri-arrow-right-up-line button icon"></i> </button>
</form>
</div>
</section>
</main>

<!--==================== FOOTER ====================-->


<footer class="footer section">
<div class="footer container container grid">

Page | 30
<div class="footer content">
<a href="#" class="footer logo">
<i class="ri-leaf-line footer logo-icon"></i> Medicant
</a>
<h3 class="footer title">
Subscribe to our newsletter <br> to stay updated
</h3>
<div class="footer subscribe">
<input type="email" placeholder="Enter your email" class="footer input">
<button class="button button--flex footer button">
Subscribe
<i class="ri-arrow-right-up-line button icon"></i> </button>
</div>
</div>
<div class="footer content">
<h3 class="footer title">Our Address</h3>
<ul class="footer data">
<li class="footer information">1234 - Netgrove</li>
<li class="footer information">La Netgrove - 43210</li>
<li class="footer information">123-456-789</li> </ul>
</div>
<div class="footer content">
<h3 class="footer title">Contact Us</h3>
<ul class="footer data">
<li class="footer information">+999 888 777</li>
<div class="footer social">
<a href="https://www.facebook.com/" class="footer social-link">
<i class="ri-facebook-fill"></i>
</a>
<a href="https://www.instagram.com/" class="footer social-link">
<i class="ri-instagram-line"></i>
</a>
<a href="https://twitter.com/" class="footer social-link">
<i class="ri-twitter-fill"></i>
</a>
</div>
</ul>
</div>
<div class="footer content">

</div>
</div>
<p class="footer copy">&#169; 2024 Netgrove. All rights reserved</p>
</footer>

<!--=============== SCROLL UP ===============-->


<a href="#" class="scrollup" id="scroll-up">
<i class="ri-arrow-up-fill scrollup icon"></i> </a>

<!--=============== SCROLL REVEAL ===============-->

Page | 31
<script src="static/js/scrollreveal.min.js"></script>

<!--=============== MAIN JS ===============-->


<script src="static/js/main.js"></script>
</body>
</html>

Back End

from flask import Flask, render_template, request


import os import numpy as np from
tensorflow.keras.preprocessing import image from
tensorflow.keras.models import load_model from
PIL import Image
app = Flask( name )

# Load the trained model


model = load_model(r"D:\pythonProject\Medicinal_Plant.h5")

# Class labels class_labels = ["Aloevera", "Amla", "Amruta_Balli", "Arali", "Ashoka",


"Ashwagandha", "Avocado", "Bamboo", "Basale",
"Betel",
"Betel_Nut", "Brahmi", "Castor", "Curry_Leaf", "Doddapatre", "Ekka", "Ganike",
"Guava", "Geranium",
"Henna",
"Hibiscus", "Honge", "Insulin", "Jasmine", "Lemon", "Lemon_grass", "Mango",
"Mint", "Nagadali", "Neem",
"Nithyapushpa", "Nooni", "Pappaya", "Pepper", "Pomegranate", "Raktachandini",
"Rose", "Sapota",
"Tulasi", "Wood_sorel"]

# Define the path to the uploads directory


uploads_dir = os.path.join(app.root_path, 'static/uploads')

# Ensure the uploads directory exists os.makedirs(uploads_dir,


exist_ok=True) methods_of_preparation = {

Page | 32
"Aloevera": "Slit the leaf of an aloe plant lengthwise and remove the gel from the inside, or
use a commercial preparation.",
"Amla": "Eating raw amla and candies or taking amla powder with lukewarm water",
"Amruta_Balli": "Make a decoction or powder from the stems of Giloy. It is known for its
immunomodulatory properties.",
"Arali": "Various parts like the root bark, leaves, and fruit are used for medicinal purposes.
It can be consumed in different forms, including as a decoction. Different parts like the bark are
used. It's often prepared as a decoction for menstrual and uterine health. The root is commonly
used, and it can be consumed as a powder, capsule, or as a decoction. It is an adaptogen known
for its stress-relieving properties. The fruit is consumed for its nutritional benefits, including
healthy fats and vitamins.",
"Ashoka": "Different parts like the bark are used. It's often prepared as a decoction for
menstrual and uterine health.",
"Ashwagandha": "The root is commonly used, and it can be consumed as a powder, capsule,
or as a decoction. It is an adaptogen known for its stress-relieving properties.",
"Avocado": "The fruit is consumed for its nutritional benefits, including healthy fats and
vitamins.",
"Bamboo": "Bamboo shoots are consumed, and some varieties are used in traditional
medicine.",
"Basale": "The leaves are consumed as a leafy vegetable. It's rich in vitamins and minerals.",
"Betel": "Chewing betel leaves with areca nut is a common practice in some cultures. It's believed
to have digestive and stimulant properties.",
"Betel_Nut": "The nut is often chewed with betel leaves. However, excessive consumption is
associated with health risks.",
"Brahmi": "The leaves are used for enhancing cognitive function. It can be consumed as a
powder, in capsules, or as a fresh juice.",
"Castor": "Castor oil is extracted from the seeds and used for various medicinal and cosmetic
purposes.",
"Curry_Leaf": "Curry leaves are used in cooking for flavor, and they are also consumed for
their potential health benefits.",
"Doddapatre": "The leaves are used in traditional medicine, often as a poultice for skin
conditions.",
"Ekka": "Various parts may be used in traditional medicine. It's important to note that some
species of Ekka may have toxic components, and proper identification is crucial.",
"Ganike": "The leaves are used in traditional medicine, often as a remedy for respiratory
issues.",
"Guava": "Guava fruit is consumed for its high vitamin C content and other health benefits.",
"Geranium": "Geranium oil is extracted from the leaves and stems and is used in
aromatherapy and skincare.",

"Henna": "Henna leaves are dried and powdered to make a paste used for hair coloring and
as a natural dye.",
Page | 33
"Hibiscus": "Hibiscus flowers are commonly used to make teas, infusions, or extracts. They
are rich in antioxidants and can be beneficial for skin and hair health.",
"Honge": "Various parts of the tree are used traditionally, including the bark and seeds. It's
often used for its anti-inflammatory properties.",
"Insulin": "The leaves are used for their potential blood sugar-lowering properties. They can be
consumed fresh or as a tea.",
"Jasmine": "Jasmine flowers are often used to make aromatic teas or essential oils, known for
their calming effects.",
"Lemon": "Lemon juice is a common remedy for digestive issues, and the fruit is rich in
vitamin C. The peel can be used for its essential oil.",
"Lemon_grass": "Lemon grass is used to make teas and infusions, known for its soothing and
digestive properties.",
"Mango": "Mango fruit is consumed fresh and is rich in vitamins and minerals. Some parts,
like the leaves, are also used in traditional medicine.",
"Mint": "Mint leaves are commonly used to make teas, infusions, or added to dishes for
flavor. It's known for its digestive properties.",
"Nagadali": "Different parts of the plant are used traditionally. It's often prepared as a
decoction.",
"Neem": "Various parts of the neem tree are used, including leaves, bark, and oil. It's known
for its antibacterial and antifungal properties.",
"Nithyapushpa": "The flowers are used in traditional medicine, often for their calming
effects.",
"Nooni": "Different parts of the tree are used traditionally. The oil extracted from the seeds
is used for various purposes.",
"Pappaya": " Consume fruit; leaves traditionally used for certain health benefits.",
"Pepper": "Spice for flavor; potential digestive and antimicrobial properties.",
"Pomegranate": "Eat seeds or drink juice for antioxidant benefits.",
"Raktachandini": "Traditional uses; some parts may be toxic, use caution.",
"Rose": " Make tea or use petals for calming and aromatic effects.",
"Sapota": "Consume fruit for its sweet taste and nutritional content.",
"Tulasi": "Make tea or use leaves for immune support.",
"Wood_sorel": "Make tea or use leaves for immune support. Use leaves in salads; some
varieties contain oxalic acid."
}

use_of_medicine={"Aloevera":"{improve skin and prevent wrinkles,wound healing}",


"Amla":"{controlling diabetes,hair amazing,losing weight,skin healthy}",
"Amruta_Balli":"{Immunomodulatory, fever.}",
"Arali":"{ parts for traditional healing.}",

Page | 34
"Ashoka":"{Uterine health, menstrual issue.}",
"Ashwagandha": "{Adaptogen, stress relief.}",
"Avocado":"{ Nutrient-rich, heart health.}",
"Bamboo":"{Shoots, traditional cuisine.}",
"Basale":"{Shoots, traditional cuisine.}",
"Betel":"{Digestive, chewed with areca nut.}",
"Betel_Nut":"{Chewing, traditional practices, caution.}",
"Brahmi":"{Cognitive enhancer, adaptogen}",
"Castor": "{ Oil for medicinal, cosmetic use}",
"Curry_Leaf":"{ Flavoring, potential traditional uses.}",
"Doddapatre":"{ Poultice, skin conditions.}",
"Ekka":"{Traditional uses, caution for toxicity.}",
"Ganike":"{Respiratory health, traditional medicine.}",
"Guava": "{ Vitamin C, digestive benefits}",
"Geranium":"{ Oil for aromatherapy, skincare.}",
"Henna": "{ Hair coloring, natural dye.}",
"Hibiscus":"{Tea for antioxidants, skin health.}",
"Honge":"{Anti-inflammatory, traditional use.}",
"Insulin":"{Potential blood sugar regulation, traditional use.}",
"Jasmine":"{Tea, relaxation, stress relief.}",
"Lemon":"{Digestive aid, rich in vitamin C.}",
"Lemon_grass":"{Tea, digestive, calming effects.}",
"Mango":"{Fruit, traditional uses for health.}",
"Mint": "{Tea, aids digestion, refreshing flavor.}",
"Nagadali":"{Traditional uses, potential medicinal purposes.}",
"Neem":"{ Antibacterial, antifungal, supports skin health.}",
"Nithyapushpa": "{Calming effects, traditional use.}",
"Nooni":"{ Oil from seeds, various traditional uses.}",
"Pappaya": "{ Fruit, leaves, traditional uses.}",
"Pepper":"{ Spice, potential digestive benefits.}",
"Pomegranate": "{Antioxidant-rich, heart health.}",
"Raktachandini":"{Traditional uses, caution for potential toxicity.}", "Rose":"{Tea,
calming, aromatic effects.}",
"Sapota":"{Sweet taste, nutritional content.}",
Page | 35
"Tulasi":"{Tea, immune support, respiratory health.}",
"Wood_sorel": "{Leaves in salads, some varieties may have medicinal uses.}"}

def predict_class(image_path):
img = image.load_img(image_path, target_size=(256,
256)) img_array = image.img_to_array(img) img_array =
np.expand_dims(img_array, axis=0) img_array /= 255.0
predictions = model.predict(img_array)
predicted_class_index = np.argmax(predictions)
predicted_class_label =
class_labels[predicted_class_index] return
predicted_class_label

@app.route('/', methods=['GET', 'POST']) def


index():
file_path = None filename =
None if request.method ==
'POST': if 'file' not in
request.files:
return render_template('index.html', error='No file part')

file = request.files['file']

if file.filename == '':
return render_template('index.html', error='No selected file') if
file:
file_path = os.path.join(uploads_dir, file.filename) file.save(file_path)
predicted_class = predict_class(file_path)
preparation= methods_of_preparation.get(predicted_class,"no information")
uses=use_of_medicine.get(predicted_class,"no information")

return render_template('index.html', prediction=predicted_class,


preparation=preparation,uses=uses, file_path=file_path,filename=filename)

return render_template('index.html', file_path=file_path,filename=filename)


Page | 36
@app.route('/about')
def about():
return render_template('index.html')

@app.route('/contact')
def contact():
return render_template('index.html')
@app.route('/home') def
home():
return render_template('index.html')

if name == ' main ':


app.run(host='0.0.0.0', port=5000, debug=True)

Data Training import os


import numpy as np
import tensorflow as tf
from tensorflow.keras import layers, models
from tensorflow.keras.preprocessing.image import ImageDataGenerator from
PIL import Image

# Define constants
IMAGE_SIZE = (256, 256)
BATCH_SIZE = 32

EPOCHS = 8

# Directory structure
train_dir = r'D:\Indian Medicinal Leaves Image Datasets\Medicinal plant dataset' val_dir
= r'D:\Indian Medicinal Leaves Image Datasets\Medicinal plant dataset'

# Data preprocessing
train_datagen = ImageDataGenerator(rescale=1./255)
val_datagen = ImageDataGenerator(rescale=1./255)

train_generator = train_datagen.flow_from_directory(

train_dir,
target_size=IMAGE_SIZE,
batch_size=BATCH_SIZE,
class_mode='categorical'
)

Page | 37
val_generator = val_datagen.flow_from_directory( val_dir,
target_size=IMAGE_SIZE,
batch_size=BATCH_SIZE,
class_mode='categorical'
)

# Build a simple CNN model model


= models.Sequential()
model.add(layers.Conv2D(32, (3, 3), activation='relu', input_shape=(256,256, 3)))
model.add(layers.MaxPooling2D((2, 2))) model.add(layers.Conv2D(64, (3, 3),
activation='relu')) model.add(layers.MaxPooling2D((2, 2)))
model.add(layers.Conv2D(128, (3, 3), activation='relu'))
model.add(layers.MaxPooling2D((2, 2)))
model.add(layers.Flatten())
model.add(layers.Dense(128, activation='relu'))
model.add(layers.Dense(40, activation='softmax')) # Adjust num_classes based on your
dataset

# Compile the model


model.compile(optimizer='adam',
loss='categorical_crossentropy', metrics=['accuracy'])

# Train the model


history =
model.fit(
train_generator,
steps_per_epoch=train_generator.samples // BATCH_SIZE,
epochs=EPOCHS,
validation_data=val_generator,
validation_steps=val_generator.samples // BATCH_SIZE
)
# Save the trained model model.save("Medicinal_Plant.h5")

Data Testing

import numpy as np from


tensorflow.keras.preprocessing import image from
tensorflow.keras.models import load_model

# Load the trained model


model = load_model("Medicinal_plant.h5")

# Define the path to the image you want to test

Page | 38
image_path =r"D:\Indian Medicinal Leaves Image Datasets\Medicinal plant
dataset\Ekka\158.jpg"
# Load and preprocess the image
img = image.load_img(image_path, target_size=(256, 256))
img_array = image.img_to_array(img) img_array =
np.expand_dims(img_array, axis=0) img_array /= 255.0 #
Normalize the image data

# Make predictions
predictions = model.predict(img_array)

# Assuming you have a list of class labels class_labels =


["Aloevera","Amla","Amruta_Balli","Arali","Ashoka","Ashwagandha","Avacado","Bamboo",
"Basale","Betel","Betel_Nut","Brahmi","Castor","Curry_Leaf","Doddapatre","Ekka","Ganike
","Gauva","Geranium","Henna","Hibiscus","Honge","Insulin","Jasmine","Lemon","Lemon_gr
ass","Mango","Mint","Nagadali","Neem","Nithyapushpa","Nooni","Pappaya","Pepper","Pome
granate","Raktachandini","Rose","Sapota","Tulasi","Wood_sorel"]

methods_of_preparation=["slit the leaf of an aloe plant lengthwise and remove the gel from the inside,
or use a commercial preparation.\n"
,"Eating raw amla and candies or taking amla powder with lukewarm water\n"
,"Make a decoction or powder from the stems of Giloy. It is known for its immunomodulatory
properties.\n"
," Various parts like the root bark, leaves, and fruit are used for medicinal purposes. It can be
consumed in different forms, including as a decoction.","Different parts like the bark are used.
It's often prepared as a decoction for menstrual and uterine health.","The root is commonly used,
and it can be consumed as a powder, capsule, or as a decoction. It is an adaptogen known for its
stress-relieving properties.","The fruit is consumed for its nutritional benefits, including healthy
fats and vitamins.\n"
,"Bamboo shoots are consumed, and some varieties are used in traditional medicine.","The leaves
are consumed as a leafy vegetable. It's rich in vitamins and minerals."," Chewing betel leaves with
areca nut is a common practice in some cultures. It's believed to have digestive and stimulant
properties.","The nut is often chewed with betel leaves. However, excessive consumption is
associated with health risks.\n"
,"The leaves are used for enhancing cognitive function. It can be consumed as a powder, in
capsules, or as a fresh juice.","Castor oil is extracted from the seeds and used for various
medicinal and cosmetic purposes.","Curry leaves are used in cooking for flavor, and they are also
consumed for their potential health benefits.","The leaves are used in traditional medicine, often
as a poultice for skin conditions.\n"

Page | 39
,"Various parts may be used in traditional medicine. It's important to note that some species of
Ekka may have toxic components, and proper identification is crucial.","The leaves are used in
traditional medicine, often as a remedy for respiratory issues.","Guava fruit is consumed for its
high vitamin C content and other health benefits.","Geranium oil is extracted from the leaves and
stems and is used in aromatherapy and skincare.\n"
," Henna leaves are dried and powdered to make a paste used for hair coloring and as a natural
dye.","Hibiscus flowers are commonly used to make teas, infusions, or extracts. They are rich
in antioxidants and can be beneficial for skin and hair health.","Various parts of the
tree are used traditionally, including the bark and seeds. It's often used for its anti-
inflammatory properties.","The leaves are used for their potential blood sugar-lowering
properties. They can be consumed fresh or as a tea.","Jasmine flowers are often used to make
aromatic teas or essential oils, known for their calming effects.\n"
,"Lemon juice is a common remedy for digestive issues, and the fruit is rich in vitamin C. The
peel can be used for its essential oil.","Lemon grass is used to make teas and infusions, known
for its soothing and digestive properties.","Mango fruit is consumed fresh and is rich in vitamins
and minerals. Some parts, like the leaves, are also used in traditional medicine.","Mint leaves
are commonly used to make teas, infusions, or added to dishes for flavor. It's known for its
digestive properties.","Different parts of the plant are used traditionally. It's often prepared as a
decoction.\n"
,"Various parts of the neem tree are used, including leaves, bark, and oil. It's known for its
antibacterial and antifungal properties.","The flowers are used in traditional medicine, often for
their calming effects."," Different parts of the tree are used traditionally. The oil extracted from
the seeds is used for various purposes.\n"
," Different parts of the tree are used traditionally. The oil extracted from the seeds is used for
various purposes.","Spice for flavor; potential digestive and antimicrobial properties."," Eat seeds
or drink juice for antioxidant benefits.","Traditional uses; some parts may be toxic, use caution.","
Make tea or use petals for calming and aromatic effects.\n"
,"Consume fruit for its sweet taste and nutritional content."," Make tea or use leaves for
immune support.","Use leaves in salads; some varieties contain oxalic acid"]

use_of_medicine=[" {improve skin and prevent wrinkles,wound healing}","{ controlling


diabetes,hair amazing,losing weight,skin healthy}","{Immunomodulatory, fever.}","{ parts for
traditional healing.}\n"
,"{Uterine health, menstrual issue.}","{Adaptogen, stress relief.}","{ Nutrient-rich, heart
health.}","{Shoots, traditional cuisine.}","{Shoots, traditional cuisine.}","{Digestive, chewed
with areca nut.}","{Chewing, traditional practices, caution.}","{Cognitive enhancer,
adaptogen}","{ Oil for medicinal, cosmetic use}\n"
,"{ Flavoring, potential traditional uses.}","{ Poultice, skin conditions.}","{Traditional uses,
caution for toxicity.}","{Respiratory health, traditional medicine.}","{ Vitamin C, digestive
benefits}","{ Oil for aromatherapy, skincare.}","{ Hair coloring, natural dye.}\n"
,"{Tea for antioxidants, skin health.}","{Anti-inflammatory, traditional use.}","{Potential
blood sugar regulation, traditional use.}","{Tea, relaxation, stress relief.}","{Digestive aid,
rich in vitamin C.}\n"
,"{Tea, digestive, calming effects.}","{Fruit, traditional uses for health.}","{Tea, aids
digestion, refreshing flavor.}","{Traditional uses, potential medicinal purposes.}","{
Antibacterial, antifungal, supports skin health.}\n"

Page | 40
,"{Calming effects, traditional use.}","{ Oil from seeds, various traditional uses.}","{ Fruit,
leaves, traditional uses.}","{ Spice, potential digestive benefits.}","{Antioxidant-rich, heart
health.}\n"
,"{Traditional uses, caution for potential toxicity.}","{Tea, calming, aromatic
effects.}","{Sweet taste, nutritional content.}","{Tea, immune support, respiratory
health.}","{Leaves in salads, some varieties may have medicinal uses.}"]

# Get the predicted class index


predicted_class_index = np.argmax(predictions)#index value

# Get the predicted class label


predicted_class_label = class_labels[predicted_class_index]
predicted_labels_methods=methods_of_preparation[predicted_class_index]
medicine_use=use_of_medicine[predicted_class_index]

# Display the results


print("Predicted class :", predicted_class_label) print("method of preparation of
",predicted_class_label," : ",predicted_labels_methods)
#print("Predictions:", predictions) print("use
of the medicine :",medicine_use)

Page | 41
SCREENSHOT

Fig 9.1 Output 1

Fig 9.2 Output 2

Page | 42
Fig 9.3 Output 3

Fig 9.4 Output 4

Page | 43
DATE:25/09/2024 DAY:MONDAY

CHAPTER 10

CONCLUSION

I) CONCLUSION

The Medicinal Plant Identification system serves as a comprehensive


tool for accurately identifying various medicinal plants using advanced machine
learning techniques. Through the integration of Convolutional Neural Networks
(CNNs) for image classification and Decision Trees for handling non-visual data,
the system is able to analyze plant images and provide users with reliable
information about the species and their medicinal properties. The use of
technologies like HTML, CSS, JavaScript for the front end, and Python and Flask
for the backend ensures that the system is both robust and user-friendly, offering
an efficient platform for plant identification. The testing and implementation
phases ensured the system’s accuracy, stability, and scalability, making it a
valuable resource for herbalists, researchers, and users interested in plant-based
medicine.

II) FUTURE ENHANCEMENTS

Looking ahead, the system offers exciting potential for future


enhancements. Integrating more plant species and expanding the machine learning
models to recognize a broader range of medicinal plants will further improve the
system’s value. Additionally, integrating features such as Augmented Reality (AR)
for plant identification in real-time and expanding the database to include more
detailed chemical compositions and medicinal uses can further enrich the user
experience. By continuously updating and improving the system, it can remain a
powerful tool for both professionals in the field and casual users seeking

Page | 44
knowledge about medicinal plants, ultimately contributing to the advancement of
plant-based healthcare and conservation efforts.

Page | 45

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy