Medicinal Plant Identification Using ML Abinesh A
Medicinal Plant Identification Using ML Abinesh A
BACHELOR OF ENGINEERING
IN
Submitted by
ABINESH A (720922244003)
NOVEMBER 2024
BONAFIDE CERTIFICATE
SIGNATURE SIGNATURE
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
Mission
Page | iv
Page | v
ABSTRACT
Page | vi
TABLE OF CONTENTS
ABSTRACT v
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
10 CONCLUSION 44
I) CONCLUSION 44
II) FUTURE ENHANCEMENT 44
Page | viii
TABLE OF CONTENT
Page | ix
TABLE OF CONTENTS
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.
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.
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
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.
Page | 3
Image-Based Plant Identification Systems
Page | 5
DATE: 06/09/2024 DAY:TUESDAY
CHAPTER 3
METHODOLOGY
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.
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.
CHAPTER-4
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
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
Page | 11
DATE:13/09/2024 DAY:WEDNESDAY
CHAPTER 5
TOOLS
HTML
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
Python
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.
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
Page | 15
it is not scalable, as it requires direct human involvement for each identification
process.
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.
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.
CHAPTER 7
Structure of CNNs
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.
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.
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.
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
Unit Testing
Integration Testing
Functional Testing
Performance Testing
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) 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.
Infrastructure Setup
Page | 23
System Integration
Page | 24
DATE: 23/09/2024 DAY:SATURDAY
CHAPTER 9
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">
===========-->
<link rel="stylesheet" href="static/css/styles.css">
.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: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>
</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>
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">© 2024 Netgrove. All rights reserved</p>
</footer>
Page | 31
<script src="static/js/scrollreveal.min.js"></script>
Back End
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."
}
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
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")
@app.route('/contact')
def contact():
return render_template('index.html')
@app.route('/home') def
home():
return render_template('index.html')
# 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'
)
Data Testing
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)
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"]
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.}"]
Page | 41
SCREENSHOT
Page | 42
Fig 9.3 Output 3
Page | 43
DATE:25/09/2024 DAY:MONDAY
CHAPTER 10
CONCLUSION
I) CONCLUSION
Page | 44
knowledge about medicinal plants, ultimately contributing to the advancement of
plant-based healthcare and conservation efforts.
Page | 45