Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

medical-leaf-recognition-1

Download as pdf or txt
Download as pdf or txt
You are on page 1of 40

Medical Leaf Recognition

Abstract
Abstract—It's really important to correctly identify medicinal plants because that helps
us understand what healing properties they have and how we can use them for different
purposes. Identifying medicinal plants is tough due to their changing appearance and the
difficulty of traditional identification methods. This paper suggests a method using deep
learning, specifically a convolutional neural network (CNN) called MobilenetV2, to
tackle the identification of medicinal plants. Using a dataset of 1,455 images, the CNN
can learn intricate features within the images, allowing it to accurately recognize and
classify medicinal plants with great precision. The suggested method holds immense
promise in offering healthcare professionals and herbal medicine researchers a dependable
tool for identifying medicinal plants. This study marks a significant step forward in
utilizing deep learning techniques for recognizing medicinal plants, overcoming the
hurdles presented by their intricate appearances.

Keywords— Deep Learning, Medical Leaf Recognition, Convolutional Neural Network


(CNN), MobilenetV2, Herbal Medicine

Dept. of CSE, RGMCET Page 1


Medical Leaf Recognition

1. INTRODUCTION
For a very long time, herbal therapy was a crucial part of conventional medical systems. But
correctly recognizing herbal plants can be difficult, particularly for those who don't have a
background in botany or plant systematics. Deep learning methods and computer vision
methods have garnered increasing attention in recent years as tools for herbal plant
identification. These methods hold promise as a quick and precise way to identify plants, which
makes them useful resources for herbal medicine researchers and medical experts. For the
creation of novel medications and therapies, it is essential to accurately identify medicinal
plants. The accuracy and efficiency of herbal plant recognition could be greatly increased by
deep learning-based techniques, which have shown promise in a variety of image recognition
tasks. Traditional methods of plant identification, like manual inspection and morphological
analysis, can be laborious and error-prone. The study introduces a deep learning-based method
for recognizing and identifying herbal medicinal plants, comprising two primary elements: a
dataset and a model architecture. The dataset comprises images of various plant species,
gathered using mobile phones in natural environments. The model architecture adopts a
MobileNetV2-based deep learning model.
1.1 Project Background:

In response to the growing importance of medicinal plants in healthcare and conservation, this
project aims to develop a robust leaf recognition system for identifying medicinal plant species
based on leaf characteristics. By leveraging image processing techniques and machine
learning algorithms, the system will enable accurate species classification, facilitating
research, healthcare practices, and biodiversity conservation efforts. The project addresses the
need for reliable tools to aid in the identification of medicinal plants, ensuring their safe and
effective use in various applications.

The project focuses on collecting diverse datasets of labeled medicinal plant leaf images,
implementing image processing techniques for feature extraction, and developing machine
learning models for species classification. The system's significance lies in its potential to
accelerate drug discovery, promote safe herbal medicine practices, and contribute to the
preservation of endangered plant species. By providing researchers, healthcare professionals,
and conservationists with a user-friendly tool for leaf identification, the project aims to
advance scientific knowledge and support sustainable healthcare and environmental
initiatives.

Dept. of CSE, RGMCET Page 2


Medical Leaf Recognition

1.2 Objectives:

• Leaf Classification: To build a deep learning model capable of accurately


classifying different types of leaf’s images.
• Efficiency: To develop a system with a focus on efficiency.
• Accuracy: To achieve a high level of accuracy in leaf species identification.
• User-Friendly Interface: To create a user-friendly interface so that it is easy to
upload images for leaf species identification system.
• Dataset Handling: Ensure that the system can handle and make effective use of
Medicinal leaf datasets.

Dept. of CSE, RGMCET Page 3


Medical Leaf Recognition

2. SYSTEM ANALYSIS
2.1 Existing System:
The existing system presents a new shape description approach called triangle-distance
representation (TDR) for plant leaf recognition. The TDR descriptor is represented by two
matrices: a sign matrix and a triangle center distance matrix. The sign matrix is used to
characterize the convex/concave property of a shape contour, while the triangle center distance
matrix is used to represent the bending degree and spatial information of a shape contour. This
method can effectively capture the detailed and global characteristics of a leaf shape while
keeping the similarity transformations (translation, rotation, and scaling) unchanged.

Disadvantages of Existing System:

1. The accuracy is only 97% in the present existing system.


2. Used only the swedish leaf dataset, not focusing on the medicinal leafs .
3. only used the shape information of plant leaves, and the texture and venation
structure of plants are also very important features for identifying plant species.
4. Need more mathematical calculations.

2.2 Proposed System:


This paper suggests a method using deep learning, specifically a convolutional neural
network (CNN) called MobilenetV2, to tackle the identification of medicinal plants. Using a
dataset of 1,455 images, the CNN can learn intricate features within the images, allowing it to
accurately recognize and classify medicinal plants with great accuracy. The suggested method
holds immense promise in offering healthcare professionals and herbal medicine researchers a
dependable tool for identifying medicinal plants. This study marks a significant step forward
in utilizing deep learning techniques for recognizing medicinal plants.

Advantages of Proposed System:

1. The accuracy and efficiency can be increment above 98%.


2. It provides the relevant medicinal leaf, for what disease it is used for.
3. It provides what are the botanical names of the respective plant.
4. Automatic feature engineering.

Dept. of CSE, RGMCET Page 4


Medical Leaf Recognition

3. FEASIBILITY STUDY

Feasibility analysis acts as a predictive tool to gauge the likelihood of a project's success
or failure. It entails a thorough assessment of technical, economic, legal, operational, and
scheduling factors to determine the project's feasibility and justify its pursuit.

Feasibility studies hold significant importance in both governmental and corporate sectors. By
conducting feasibility studies before initiating work or launching new products, organizations
can mitigate risks, optimize resource allocation, and increase the likelihood of project success.

Feasibility can be performed by using a wide range of standards and guidelines.

Out of them some of the methods are:

• Technical Feasibility.

• Economic Feasibility

• Legal and Regulatory Feasibility.

• Operational Feasibility.

• Schedule Feasibility.

3.1 Technical Feasibility:

Technical feasibility evaluation ensures that the project can be executed effectively
using available technology, expertise, and resources. This involves scrutinizing the feasibility
of implementing necessary systems, processes, and infrastructure.

3.2 Economic Feasibility:

An economic feasibility study examines the financial viability of the project. It involves
analyzing costs, revenue projections, potential returns on investment, and assessing alignment
with budgetary constraints and financial objectives

3.3 Legal and Regulatory Feasibility:

Legal and regulatory feasibility analysis ensures compliance with applicable laws,
regulations and industry standards. It entails identifying legal requirements, securing permits,

licenses, and mitigating risks associated with non-compliance.

Dept. of CSE, RGMCET Page 5


Medical Leaf Recognition

3.4 Operational Feasibility:

Operational feasibility assesses whether the project can be integrated into existing
operations without significant disruption. It involves evaluating organizational readiness,
resource availability, and potential impacts on workflows and processes.

3.5 Schedule Feasibility:

Scheduling feasibility focuses on determining whether the project can be completed


within the allocated time frame. It involves creating realistic timelines, identifying critical
milestones, and addressing any potential delays or bottlenecks.

Dept. of CSE, RGMCET Page 6


Medical Leaf Recognition

4. SYSTEM REQUIREMENT ANALYSIS

4.1 Requirement analysis:

Requirement analysis in software engineering is like the compass that guides developers
through the creation of a software system. It's all about understanding what the software needs
to do and how it should perform. The process starts with listening to the users. Sometimes they
give a clear picture of what they want (formal specification), while other times it's a bit fuzzy
(informal specification).

In either case, software engineers work closely with users to make sure they understand
the goals and outcomes desired. This back-and-forth helps refine the specifications until
everyone is on the same page, ensuring that the final product meets user needs effectively. So,
requirement analysis is like the roadmap that ensures software development stays on track,
heading in the right direction to deliver what users really want.

4.2 Software Requirement Specification(SRS):

A software requirements specification (SRS) is like a detailed map that describes how a
program will behave and what it needs to do. It includes a series of examples, called use cases,
that show how a user will interact with the program. These use cases paint a clear picture of
what the system should do and help set boundaries for what it shouldn't do.

In addition to describing how the program should work, an SRS also lists criteria that aren't
directly related to its functions. These criteria, called non-functional requirements, set limits
on how the program should be built or designed.

To create an SRS, it's essential to have a deep understanding of the project's goals and
objectives. This often involves lots of discussions with the client and the project team to ensure
everyone's on the same page. Having a well-defined SRS can save time and money by reducing
the guesswork for developers and helping them focus on achieving their goals efficiently.

An effective SRS not only describes how the program will work but also details how it will
interact with the hardware, other software applications, and users in various real-world
situations. This comprehensive understanding ensures that the final product meets the needs of
its users effectively.

Dept. of CSE, RGMCET Page 7


Medical Leaf Recognition

4.3 Functional Requirements:


Data Collection:
• Datasets for medical leaf recognition are collections of images representing diverse
plant species, obtained from sources like online repositories. Quality assurance
measures and proper labelling are critical for dataset integrity and effective model
training.
• The system uses the medical leaf dataset which contains nearly 30 species of medical
plants.

Data Preprocessing:

• Resizing images means making them all the same size so the computer can understand
them better. We use a tool called OpenCV to do this. By doing this, we make it easier
for the computer to learn from the pictures and make accurate guesses about the leaves.
We need to choose the size carefully to balance between making things easy for the
computer and keeping the pictures clear.
• Normalization is like putting all the colors of the images on the same scale so the
computer can understand them better. We change the brightness and darkness of the
colors so they all fall within a range, usually from 0 to 1. This helps the computer focus
on important details in the images without getting confused by differences in brightness.

Data Spitting:

• The data splitting strategy partitions the dataset into training, validation, and testing
subsets, with 80% allocated for training and 20% for validation to assess model
performance. The testing dataset, comprising the remaining data, facilitates unbiased
evaluation of the trained model's performance on unseen samples. This organization
enables effective model training, validation, and evaluation, enhancing generalization
and reliability in predictions.

Model Selection:

• Selecting MobileNetV2 as the base model offers key advantages such as computational
efficiency and memory optimization, making it ideal for resource-constrained
environments. Its extensive pre-training on ImageNet provides a rich set of visual
features crucial for diverse image classification tasks. By integrating MobileNetV2 and

Dept. of CSE, RGMCET Page 8


Medical Leaf Recognition

customizing it with additional classification layers tailored to our dataset, we strike a


balance between efficiency and performance, ensuring accurate predictions on new data
while optimizing computational resources. This strategy optimizes both base model
selection and final architecture design, resulting in a robust image classification
pipeline delivering accurate results efficiently.

Model Training:

• Model training is a critical phase where the model learns from the training data to make
accurate predictions by adjusting its parameters to minimize the defined loss function
over several epochs. Monitoring performance metrics like loss and accuracy on both
training and validation datasets provides insights into the model's learning progress,
guiding adjustments to optimize performance. This process is fundamental for
developing robust and accurate machine learning models for various tasks.

Testing and Deployment:

• Model testing verifies how well the trained model performs on new data, ensuring it
can generalize effectively. Once validated, deployment involves making the model
available for use in real-world applications. This typically requires packaging the model
and integrating it into the target environment, with ongoing monitoring to ensure
optimal performance and compliance with security and regulatory standards.

4.4 Non – Functional Requirements:

Performance:

• The system must efficiently handle large datasets, utilizing minimal computational
resources.
• It should offer real-time predictions to facilitate prompt decision-making in business
contexts.

Scalability:

• The system should seamlessly scale to accommodate expanding datasets and user
demands.

Dept. of CSE, RGMCET Page 9


Medical Leaf Recognition

• It should support parallel processing to utilize multi-core processors, enhancing overall


performance.

Reliability:

• The system must guarantee data integrity and reliability during data collection and
preprocessing phases.
• It must uphold model accuracy and stability over time, adapting to changing market
conditions.

Security:

• The system must prioritize data privacy and security at all stages, from data collection
to preprocessing and model deployment.
• It should incorporate access controls and encryption mechanisms to safeguard sensitive
information.
4.4 Software Requirements :
Operating System: Compatible with Windows, macOS, or Linux distributions.
Python Environment: Python 3.x installed with necessary libraries for machine learning, such
as NumPy, Tensorflow, Keras, Matplotlib, OpenCV,and Jupyter Notebook for code
development.
Development Environment: Visual Studio Code, or Jupyter Notebook for coding and
experimentation.
Version Control: Git for version control management, facilitating collaboration and code
tracking.
4.5 Hardware Requirements:
Processor: Multi-core processor (e.g., Intel Core i5) for efficient computation.
Memory (RAM): At least 8GB RAM for handling large datasets and model training.
Storage: Sufficient disk space for storing datasets, code, and model files. SSD storage is
recommended for faster read/write speeds.

Dept. of CSE, RGMCET Page 10


Medical Leaf Recognition

5. MODULES

The working procedures of the proposed model can be divided into the six modules:

• Data Collection Module


• Exploratory Data Analysis
• Model Selection and Training Module
• Model Evaluation and Deployment Module

5.1 Data Collection:

• The first step in the machine learning process is data collection. The data collection
module in a leaf recognition system is responsible for gathering a diverse set of leaf
images from various sources. It employs methods such as web scraping, manual
uploads, or crowdsourcing to compile an extensive dataset.
• Once collected, the data needs to be prepared for machine learning. This process
involves organizing the data in a suitable format, such as a .png or .jpg or .jpeg file.

5.2 Exploratory Data Analysis

• Data preprocessing is a fundamental step in machine learning, ensuring dataset


quality and model performance.
• It involves resizing and normalization of data. Resizing and normalization are
fundamental preprocessing techniques used to prepare data for machine learning
tasks, particularly in image classification.
• Resizing adjusts image dimensions to ensure consistency, crucial for neural
networks requiring uniform inputs. This process aids in reducing computational
complexity and memory usage during training, essential for efficient model
optimization.
• Normalization scales pixel values to a standardized range, ensuring equal
contribution to the model's learning process and preventing dominance by features
with larger scales. This process enhances optimization algorithm convergence and
neural network stability, improving overall performance.

5.3 Model Selection and Training

Dept. of CSE, RGMCET Page 11


Medical Leaf Recognition

• Model selection involves choosing appropriate machine learning


algorithms(MobileNetV2) , while model training we typically divide our dataset
into two parts: a training set and a test set.
• The training set is used to train the model, while the test set is used to evaluate its
performance. This ensures that we can assess how well the model generalizes to
new, unseen data.

5.4 Model Evaluation and Deployment:

• Model evaluation assesses a trained machine learning model's performance using


metrics like accuracy, precision, and recall on unseen data, ensuring its
effectiveness.
• Deployment involves integrating a trained machine learning model into production
systems or applications, making it available for real-world use. This process
ensures the model's availability, functionality, and scalability, with continuous
monitoring and maintenance to uphold performance standards and compliance
with security and regulatory requirements.

Dept. of CSE, RGMCET Page 12


Medical Leaf Recognition

6. TECHNICAL DESCRIPTION

6.1 Python:

Python is a popular programming language known for its simplicity and readability. Created
in 1991, it emphasizes clear and straightforward code, making it ideal for both beginners and
experienced developers. With its use of significant indentation and dynamic typing, Python
offers flexibility and ease of use. It supports various programming styles, including procedural,
object-oriented, and functional programming, catering to diverse project needs. Its extensive
standard library and vast ecosystem of third-party packages provide a wide range of tools for
web development, data analysis, machine learning, and more. Overall, Python's versatility and
user-friendly nature have made it a go-to choice for programmers worldwide.

6.1.1 History:

The programming language Python was conceived in the late 1980s, and its implementation
was started in December 1989 by Guido van Rossum at CWI in the Netherlands as a successor
to ABC capable of exception handling and interfacing with the Amoeba operating system. Van
Rossum is Python's principal author, and his continuing central role in deciding the direction
of Python is reflected in the title given to him by the Python community.

Python 2.0 was released on October 16, 2000, with many major new features, including a cycle-
detecting garbage collector (in addition to reference counting) for memory management and
support for Unicode. However, the most important change was to the development process
itself, with a shift to a more transparent and community backed process. Python 3.0, a major,
backwards- incompatible release, was released on December 3, 2008, after a long period of
testing. Many of its major features have also been back ported to the backwards-compatible,
though now-unsupported, Python 2.6 and 2.7.

6.1.2 Features of Python:

• Simple and Readable Syntax: Python's syntax is designed to be straightforward and


intuitive. It emphasizes readability and uses a clean structure with minimal clutter. For
example, Python uses indentation to define code blocks, making it easy to see the
structure of the code. Additionally, Python uses simple English words and common-
sense conventions, making it accessible for beginners and enjoyable for experienced

Dept. of CSE, RGMCET Page 13


Medical Leaf Recognition

developers. This simplicity and readability reduce the chances of syntax errors and
make code maintenance easier over time.
• Interpreted and Interactive: Python is an interpreted language, meaning that code is
executed line by line by an interpreter, rather than being compiled into machine code
beforehand. This allows for quick testing and debugging, as you can see results
immediately after writing each line of code. Python also supports an interactive mode,
where you can type code directly into the interpreter and see the results instantly. This
interactive nature makes Python ideal for prototyping, experimenting, and exploring
ideas.
• Dynamic Typing: Python is dynamically typed, meaning that you don't need to declare
the data type of variables explicitly. Instead, the interpreter determines the data type of
variables at runtime based on the values assigned to them. This flexibility allows for
more concise and expressive code, as you can focus on solving problems rather than
worrying about variable types. However, it also requires careful attention to variable
types to avoid unexpected behaviour, especially in larger projects.
• Multi-paradigm Programming: Python supports multiple programming paradigms,
including procedural, object-oriented, and functional programming. This versatility
allows developers to choose the most suitable approach for their projects and combine
different paradigms as needed. For example, you can use procedural programming to
write step-by-step instructions, object-oriented programming to organize code around
objects and classes, and functional programming to treat computation as mathematical
functions. This flexibility makes Python suitable for a wide range of applications and
encourages code reuse and modularization.
• Extensive Standard Library: Python comes with a comprehensive standard library,
which includes a vast collection of modules and tools for various tasks. These modules
cover a wide range of functionalities, such as file handling, networking, data
manipulation, and web development. By leveraging the standard library, you can
perform common tasks without writing extra code or relying on external dependencies.
This saves time and effort and ensures consistency and reliability across different
Python projects.
• Third-party Libraries and Ecosystem: In addition to the standard library, Python
has a vibrant ecosystem of third-party libraries and frameworks created by the
community. These libraries extend Python's capabilities for specialized tasks, such as

Dept. of CSE, RGMCET Page 14


Medical Leaf Recognition

web development, data analysis, machine learning, and scientific computing. For
example, libraries like NumPy and pandas are widely used for data manipulation and
analysis, while frameworks like Django and Flask are popular choices for web
development. By tapping into this rich ecosystem, you can leverage existing solutions,
accelerate development, and collaborate with other developers on shared projects.

6.1.3 Python Modules:

a) Numpy:
NumPy, standing as a cornerstone of Python's scientific computing landscape, empowers users
with its robust capabilities and versatile functionalities. At its core lies the ndarray, a powerful
data structure capable of handling arrays and matrices of multiple dimensions efficiently. This
structure not only offers uniformity in data types but also ensures a contiguous memory layout,
facilitating swift and optimized numerical operations. Thanks to its vectorized operations,
NumPy significantly enhances computational performance compared to traditional Python
lists, making it indispensable for handling large datasets and complex mathematical
computations.

The library boasts an extensive array of mathematical functions tailored precisely for array
manipulation. Whether it's basic arithmetic operations or advanced mathematical
transformations, NumPy provides a comprehensive suite of tools to address diverse numerical
challenges. From trigonometric functions to logarithms and statistical operations, its rich
functionality caters to the needs of scientists, engineers, and data analysts alike.

NumPy's intuitive interface simplifies array manipulation and operations, empowering users
with robust indexing and slicing mechanisms. These features enable efficient access to
elements and subarrays within arrays, streamlining data processing tasks. Moreover, NumPy's
broadcasting feature enables seamless execution of element-wise operations across arrays with
varying shapes, further enhancing its usability and flexibility.

When it comes to tasks involving linear algebra, NumPy emerges as a powerhouse. It offers an
extensive repertoire of linear algebra functions, including matrix multiplication, inversion, and
decomposition. These functions form the backbone of numerous scientific and engineering
applications, facilitating complex computations with ease and efficiency.

Dept. of CSE, RGMCET Page 15


Medical Leaf Recognition

In addition to its prowess in array manipulation and linear algebra, NumPy simplifies the
generation of random numbers—a crucial requirement for simulations and statistical analyses.
Its random number generation functions provide users with the flexibility to generate numbers
and arrays with various probability distributions, further expanding the library's utility and
applicability.

Furthermore, NumPy seamlessly integrates with other Python libraries, such as SciPy,
Matplotlib, and pandas, creating a robust ecosystem for scientific computing, data analysis,
and visualization. This integration not only amplifies NumPy's utility but also fosters
collaborative workflows, enabling users to leverage the strengths of multiple libraries
seamlessly. In essence, NumPy's versatility, efficiency, and extensive functionality position it
as an indispensable tool for tackling a myriad of numerical computing tasks in Python.
b) TensorFlow:
TensorFlow is an open-source machine learning framework developed by Google. It provides
a comprehensive ecosystem of tools, libraries, and resources for building and deploying
machine learning models, particularly deep learning models. TensorFlow is designed to be
flexible, scalable, and efficient, making it suitable for a wide range of applications, from
research prototyping to large-scale production deployment.

One of the key components of TensorFlow is its computational graph paradigm. In


TensorFlow, computations are represented as directed graphs, where nodes represent
operations (such as mathematical operations, neural network layers, etc.), and edges represent
the flow of data (tensors) between these operations. This graph-based approach enables
TensorFlow to optimize computations, distribute them across multiple devices (such as CPUs
and GPUs), and perform automatic differentiation for training deep neural networks via
techniques like backpropagation.

TensorFlow provides high-level APIs like Keras, which offers a user-friendly interface for
building and training neural network models with minimal boilerplate code. It also includes
lower-level APIs for more advanced users who require fine-grained control over model
architecture and training process.

Dept. of CSE, RGMCET Page 16


Medical Leaf Recognition

Moreover, TensorFlow supports a wide range of platforms, including desktop computers,


mobile devices, and cloud environments, allowing developers to deploy models seamlessly
across different devices and environments. It also integrates with other popular libraries and
frameworks in the Python ecosystem, such as NumPy, pandas, and scikit-learn, enabling
interoperability and facilitating end-to-end machine learning workflows.

Overall, TensorFlow has emerged as one of the leading frameworks for machine learning and
deep learning, powering applications in various domains, including computer vision, natural
language processing, speech recognition, and more. Its rich features, scalability, and
community support make it a preferred choice for researchers, developers, and engineers
working on machine learning projects.
c)Flask:
Flask is a simple, lightweight web framework for Python, perfect for creating web applications
and APIs. It keeps things straightforward, allowing developers to focus on building their
projects without getting bogged down in unnecessary complexity. With Flask, you can define
routes to handle different URL patterns, making it easy to navigate through your web app. Its
templating engine lets you create dynamic web pages by combining static HTML templates
with Python code to generate content.

One of Flask's strengths is its flexibility—it integrates smoothly with other Python libraries
and tools, so you can easily add features like database access or user authentication. It's like
building with Lego blocks; you can pick and choose the components you need for your project.
Flask also has a vibrant ecosystem of extensions that provide additional functionality, from
handling forms to managing sessions.

Despite its simplicity, Flask is powerful enough to handle a wide range of web development
tasks. Whether you're building a small personal website or a large-scale web application, Flask
scales with your needs. Plus, it has a supportive community of developers who share
resources, tutorials, and advice to help you along the way. So if you're looking for a user-
friendly way to dive into web development with Python, Flask is a fantastic choice.

d)Matplotlib:

Dept. of CSE, RGMCET Page 17


Medical Leaf Recognition

Matplotlib is a powerful and versatile Python library for creating static, animated, and
interactive visualizations. It serves as a go-to tool for data visualization tasks, providing a
MATLAB-like interface for generating a wide range of plots and charts with ease. With
Matplotlib, users can create line plots, scatter plots, bar charts, histograms, pie charts, 3D plots,
and much more, making it suitable for various data exploration, analysis, and presentation
needs.

At its core, Matplotlib operates on the concept of figures and axes. A figure is the top-level
container for all elements of a plot, while axes represent the individual plots within a figure.
This hierarchical structure allows for the creation of complex plots with multiple subplots
arranged in grids or other configurations. Matplotlib offers fine-grained control over every
aspect of the plot, including axis limits, labels, ticks, colors, markers, and annotations, enabling
users to customize their visualizations to meet specific requirements.

One of Matplotlib's strengths lies in its flexibility and extensibility. It provides multiple APIs
for creating plots, including a procedural interface (Pyplot) and an object-oriented interface.
This versatility allows users to choose the level of abstraction that best suits their needs.
Additionally, Matplotlib supports integration with other Python libraries and tools, such as
NumPy for numerical computations, Pandas for data manipulation, and Jupyter Notebooks for
interactive data analysis, enhancing its capabilities further.

Matplotlib's rich ecosystem includes a vast collection of built-in plotting functions, as well as
numerous external packages and extensions that extend its functionality. These include tools
for specialized plots, interactive visualization, and aesthetic enhancements, ensuring that users
have access to a wide range of resources to create visually appealing and informative plots.

e) Keras:

Keras is a high-level neural networks API in Python that facilitates the development of deep
learning models with remarkable simplicity and efficiency. Its user-friendly interface abstracts
away the intricate details of neural network architecture and optimization, enabling users to
focus on conceptualizing and experimenting with models. With Keras, building a neural
network is akin to assembling building blocks, where layers are stacked to form a cohesive
architecture. This modular approach allows for quick prototyping and iteration, making Keras
particularly appealing to beginners and experienced practitioners alike.

Dept. of CSE, RGMCET Page 18


Medical Leaf Recognition

A standout feature of Keras is its versatility, offering support for various types of neural
networks, including convolutional neural networks (CNNs), recurrent neural networks
(RNNs), and more. Whether it's image classification, natural language processing, or time
series prediction, Keras provides the necessary tools and abstractions to tackle a diverse range
of tasks. Moreover, Keras seamlessly integrates with popular deep learning frameworks such
as TensorFlow, enabling users to harness the power of efficient computation engines while
leveraging Keras' intuitive API.

Keras' flexibility extends to its support for distributed computing and GPU acceleration,
enabling users to scale their deep learning workflows across multiple devices and
computational clusters. This scalability is crucial for handling large datasets and complex
models, ensuring that Keras remains a robust solution for both research and production
environments. With its rich ecosystem of pre-trained models, tutorials, and community support,
Keras empowers developers to unlock the potential of deep learning and build innovative
solutions to real-world challenges.

Jupyter Notebook:

Jupyter is an open-source web application renowned for its versatility in creating and sharing
documents containing live code, equations, visualizations, and narrative text. Widely employed
for tasks like data cleaning, transformation, statistical modeling, machine learning, and more,
it offers a browser-based interface for crafting and executing Jupyter notebooks. These
notebooks serve as interactive documents housing code cells, capable of immediate execution,
alongside markdown cells for text and image integration.

Supporting multiple programming languages such as Python, R, Julia, and others, Jupyter's
hallmark feature lies in its interactive code execution. This enables users to run code cells and
observe results instantly, streamlining experimentation and data exploration without toggling
between editor and console interfaces.

Moreover, Jupyter facilitates the creation of interactive visualizations, enhancing data


comprehension and analysis. It boasts compatibility with a diverse array of visualization
libraries like Matplotlib, Seaborn, Bokeh, and Plotly, empowering users to intuitively explore
and interpret data.

6.2 Algorithm:

Dept. of CSE, RGMCET Page 19


Medical Leaf Recognition

MobileNetV2:

MobileNetV2 is a convolutional neural network architecture optimized for mobile and


embedded devices. It improves computational efficiency while maintaining competitive
accuracy by leveraging depthwise separable convolutions, inverted residuals with linear
bottlenecks, and efficient scaling techniques. MobileNetV2 finds applications in various
computer vision tasks, from image classification to object detection, due to its lightweight
design and compatibility with major deep learning frameworks. Its adaptability and pre-trained
models enable rapid deployment in resource-constrained environments such as mobile
applications and IoT devices.

Algorithm:

1.Base Model Initialization

2. Adding Custom Classification Layers

3. Creating the Final Model:

Algorithm description:

Dept. of CSE, RGMCET Page 20


Medical Leaf Recognition

Base Model Initialization:

The MobileNetV2 model with the following characteristics

1.Input Shape:

The input shape is specified as (IMAGE_RES, IMAGE_RES, 3), where IMAGE_RES


represents the desired image resolution, and 3 denotes the number of color channels (RGB).

2.Include Top:

Setting include_top to False indicates that only the convolutional base of the MobileNetV2
model will be instantiated, excluding the classifier layers.

3.Weights Initialization:

By setting weights='imagenet', the model is initialized with weights pre-trained on the


ImageNet dataset. These pre-trained weights provide a good starting point for transfer learning.

The mathematical equations corresponding to the layers of the MobileNetV2 model:

1.Depthwise Separable Convolution:

a.Depthwise convolution: Involves convolving each input channel separately with its own
kernel. Mathematically, this can be represented as:

Yi = DepthwiseConv(Xi,Wi)

where Yi is the output feature map for channel i ,Xi is the input feature map for channel i, and
Wi represents the depthwise filter for channel i.

b.Pointwise convolution: Applies a 1x1 convolution to combine the output of depthwise


convolution. Mathematically:

Y = DepthwiseConv(X,W)

where Y is the output feature map, X is the output of the depthwise convolution, and W is the
pointwise filter.

2.Inverted Residuals and Linear Bottlenecks:

Inverted residual block: Mathematically, an inverted residual block can be represented as

Dept. of CSE, RGMCET Page 21


Medical Leaf Recognition

follows:

Yout = ReLU(X+F(Conv(1x1,ReLU(Conv(3x3,X)))))

Where X is the input feature map, Conv(3x3) represents a depthwise separable convolution, F
represents a linear bottleneck, and Conv(1x1) denotes a 1x1 convolution.

Linear bottleneck: Involves applying a lightweight 1x1 convolution followed by a nonlinear


activation function. Mathematically:

Y=ReLU(Conv(1x1,X))

where X is the input feature map and Conv(1x1) denotes a 1x1 convolution.

2. Adding custom classification layers:

a. Global Average Pooling Layer:

- `global_average_layer = tf.keras.layers.GlobalAveragePooling2D()`: This layer calculates


the average of each feature map across the spatial dimensions, resulting in a fixed-length vector
for each channel.

- Mathematical Equation:

Yi = 1/H * W ∑hj=1∑wk=1 Xi,j,k

where Yi is the ith output feature, H and W are the height and width of the feature map, and
Xi,j,k represents the element at position (i, j, k) in the input feature map.

b. Dense Prediction Layer:

- `prediction_layer = tf.keras.layers.Dense(num_classes, activation='softmax')`: This layer


consists of a fully connected (dense) layer with num classes neurons and a softmax activation
function. It produces the final classification probabilities for each class.

- Mathematical Equation:

Y = softmax(W . X + b)

where W represents the weight matrix, X is the input vector, and b is the bias vector.

3. Creating the Final Model:

Dept. of CSE, RGMCET Page 22


Medical Leaf Recognition

- `model = tf.keras.Sequential([base_model, global_average_layer, prediction_layer])`: This


code creates the final model by stacking the base MobileNetV2 model, the global average
pooling layer, and the prediction layer in a Sequential model.

- The output of the base model is passed through the global average pooling layer to obtain a
fixed-length vector, which is then fed into the dense prediction layer to produce the final
classification probabilities for each class.

Dept. of CSE, RGMCET Page 23


Medical Leaf Recognition

7. SYSTEM DESIGN

The Figure shows the System Design step by step as follows:

Fig 7.1 : System design

System Design:

• Data Collection: Raw data is the starting point for data collection. i.e. The. It may
come from databases or an API, or in the case of hand-coding.
• Pre-processing: Preparing data for training. involves this step, which includes
resizing and normalization of data.
• Model Selection: Carefully select the appropriate machine learning algorithm or
model. Absolutely. It is the type of problem and not related to the data set (e.g,
classification or regression)
• Training and Validation: The model chosen is trained and validated using the pre-
calculation data. The training set is then integrated into it and validated to verify its
effectiveness using a different validation set.
• Evaluation: The model is evaluated based on whether data from test or unobserved
sources are present. Model generalization can be assessed using the following criteria:
accuracy, precision, recall, or F1-score.

7.1 UML(Unified Modelling Language):

The Unified Modelling Language (UML) is a powerful tool utilized in object-oriented software
engineering, renowned for its capacity to model application structures, behaviours, and even

Dept. of CSE, RGMCET Page 24


Medical Leaf Recognition

business processes. It serves as a standardized language designed to visually represent system


designs.

Developed by Grady Booch, Ivar Jacobson, and James Rumbaugh at Rational Software during
1994–95, UML underwent further refinement under their guidance through 1996. In 1997, the
Object Management Group (OMG) officially adopted UML as a standard, entrusting its
ongoing management to the organization. Additionally, in 2000, the International Organization
for Standardization (ISO) recognized UML as an approved ISO standard, solidifying its
position as a universally accepted modeling language in software engineering.

7.1.1 Class Diagram

Class diagrams are arguably the most used UML diagram type. It is the main building block
of any object-oriented solution. It shows the classes in a system, attributes and operations of
each class and the relationship between each class. In most modeling tools a class has three
parts, name at the top, attributes in the middle and operations or methods at the bottom.

7.1.2 Component Diagram:

A component diagram displays the structural relationship of components of a software system.


These are mostly used when working with complex systems that has many components.
Components communicate with each other using interfaces. The interfaces are linked using
connectors.

7.1.3 Deployment Diagram:

A deployment diagrams shows the hardware of your system and the software in those hardware.
Deployment diagrams are useful when your software solution is deployed across multiple
machines with each having a unique configuration.

7.1.4 Object Diagram:

Object Diagrams, sometimes referred as Instance diagrams are very similar to class diagrams

As class diagrams they also show the relationship between objects but they use real world
examples. They are used to show how a system will look like at a given time.

7.1.5 Use Case Diagram:

Dept. of CSE, RGMCET Page 25


Medical Leaf Recognition

Most known diagram type of the behavioral UML diagrams, Use Case diagrams gives a
graphic overview of the actors involved in a system, different functions needed by those actors
and how these different functions are interacted. It’s a great starting point for any project
discussion because you can easily identify the main actors involved and the main processes
of the system.

7.1.6 Activity Diagram:

Activity diagrams represent workflows in an graphical way. They can be used to describe
business workflow or the operational workflow of any component in a system. Sometimes
activity diagrams are used as an alternative to State machine diagrams.

7.1.7 State Machine Diagram:

State machine diagrams are similar to activity diagrams although notations and usage changes
a bit. They are sometime known as state diagrams or start chart diagrams as well. These are
very useful to describe the behavior of objects that act different according to the state they are
at the moment.

7.1.8 Sequence Diagram:

Sequence diagrams in UML shows how object interact with each other and the order those
interactions occur. It’s important to note that show the interactions for a particular scenario.
The processes are represented vertically and interactions are show as arrows.

7.1.9 Collaboration Diagram:

It is similar to sequence diagrams but the focus is on messages passed between objects. The
same information can be represented using a sequence diagram and different objects.

Dept. of CSE, RGMCET Page 26


Medical Leaf Recognition

7.2 List of UML diagrams:

Symbol Name Symbol Description


Class Classes represent a
collection of similar
entities grouped together

Association
Association represents a
static relationship between
classes.
Aggregation Aggregation is a form of
association. It aggregates
several classes into a
single
class.
Actor Actors are the users of the
system and other external
entities that react with the
system.

Use Case A use case is an interaction


between the system and the
external environment.

Relation It is used for additional


process communication.

Communication It is the communication


between various use cases

State It represents the state of a


process. Each state goes
through various flows

Dept. of CSE, RGMCET Page 27


Medical Leaf Recognition

Initial State It represents the initial state


of the object.

Final State It represents the final state of


the object.

Control Flow It represents the various


control flow between the
states.
Decision Box It represents the decision
making process from a
constraint.
Component Components represent the
physical components used in
the system

Node Deployment diagrams use


Node

the nodes for representing


physical modules, which is a
collection of components
Data Process/State A circle in DFD represents a
state or process which has
been triggered due to some
event or action.
External Entity It represents any external
entity such as keyboard,
sensors etc.

Transition
It represents any
communication that occurs
between the processes.

Dept. of CSE, RGMCET Page 28


Medical Leaf Recognition

Object lifelines represents


the vertical dimension that
Object Lifeline
objects communicates.

It represents the messages


Message
exchanged.

Table 7.1 : UML Notations

7.3 UML Diagrams

7.3.1 Use Case Diagram:

System

Fig 7.2 : Use Case diagram for system

The leaf recognition system begins with the user gathering a dataset of leaf images for training
the machine learning model. Once trained, the system can recognize leaves from input images,
generate results, and create graphs for visualization. This streamlined process enables efficient
and accurate leaf identification, from dataset preparation to result interpretation.

7.3.2 Sequence Diagram:

Dept. of CSE, RGMCET Page 29


Medical Leaf Recognition

Fig 7.3: Sequence Diagram

The sequence diagram illustrates the step-by-step process of the leaf recognition system. It
begins with the user providing an input image of a leaf, which the system preprocesses before
passing it to the trained model. The model then analyzes the image and generates recognition
results, which are presented to the user. Additionally, the system may create graphs based on
these results for visualization purposes, offering insights into the recognition process and
classification accuracy.

7.3.3 Dataflow Diagram:

In the data flow diagram for leaf recognition, the input data comprises leaf images provided by
the user. These images then undergo preprocessing, which involves operations like resizing,
normalization, and feature extraction to prepare them for training. After preprocessing, the
dataset is split into training and validation sets. The training set is used to train the machine
learning model, while the validation set is used to evaluate its performance during training.
This process ensures that the model is trained effectively and can accurately recognize leaf
images.

Dept. of CSE, RGMCET Page 30


Medical Leaf Recognition

Fig 7.4: Dataflow Diagram

Dept. of CSE, RGMCET Page 31


Medical Leaf Recognition

8. EXPERIMENTAL RESULTS

8.1 Dataset:

The dataset were collected from the Kaggle. The dataset is Medical Leaf Dataset ,which
contains nearly 30 species with 1455 images.

The below table describes the local names and botanical names of 30 species:

S. No Botanical Name Local Name


1 Alpinia Galanga Rasna
2 Amaranthus Viridis Arive-Dantu
3 Artocarpus Heterophyllus Jackfruit
4 Azadirachta Indica Neem
5 Basella Alba Basale
6 Brassica Juncea Indian Mustard
7 Carissa Carandas Karanda
8 Citrus Limon Lemon
9 Ficus Auriculata Roxburgh fig
10 Ficus Religiosa Peepal Tree
11 Hibiscus Rosa-sinensis
12 Jasminum Jasmine
13 Mangifera Indica Mango
14 Mentha Mint
15 Moringa Oleifera Drumstick
16 Muntingia Calabura Jamaica Cherry-Gase
17 Murraya Koenigii Curry
18 Nerium Oleander Oleander
19 Nyctanthes arbor-tristis Parijata
20 Ocimum Tenuiflorum Tulsi
21 Piper Betle Betel
22 PlectranthusAmboinicus Mexican Mint
23 Pongamia Pinnata Indian Beech
24 Psidium Guajava Guava
25 Punica Granatum Pomegranate
26 Santalum Album Sandalwood
27 Syzygium Cumini Jamun

Dept. of CSE, RGMCET Page 32


Medical Leaf Recognition

28 Syzygium Jambos Rose Apple


29 TabernaemontanaDivaricata Crape Jasmine
30 Trigonella Foenum-graecum fenugreek

Table 8.1: Botanical names

8.2 Screen shots of Output

Fig 8.1: Before choosing a file

Fig 8.2: After choosing a file

Dept. of CSE, RGMCET Page 33


Medical Leaf Recognition

Fig 8.3 : Prediction result

8.3 Graphs:

Fig 8.4: Model Accuracy

Dept. of CSE, RGMCET Page 34


Medical Leaf Recognition

Model Accuracy: Achieving a 1% accuracy on the training set after just 5 epochs demonstrates
strong learning capability within the model. This accuracy indicates that the model effectively
captures underlying data patterns within the training dataset.

Fig 8.5: Model Loss

Model Loss: Achieving a loss of 0.1 signifies significant progress in training the model. This
low loss value indicates that the model's predictions closely match the actual values in the
training dataset, showcasing its ability to learn complex patterns effectively.

Dept. of CSE, RGMCET Page 35


Medical Leaf Recognition

9. SYSTEM TESTING

9.1 Testcase Description

Testing is the essential process of identifying errors within software. It plays a critical role in
quality assurance and ensuring the reliability of software systems. The insights gained from
testing are invaluable not only during development but also for subsequent maintenance
phases.

Psychology of testing:

The objective of testing is frequently to showcase that a program functions by illustrating its
error-free operation. However, the fundamental goal of the testing phase is to uncover any
errors present within the program. Therefore, the approach to testing should not be to validate
that a program works, but rather to reveal any instances where it does not. Testing entails
executing a program with the explicit aim of identifying errors.

Testing Objectives

The primary objective of testing is to methodically uncover a range of errors with efficiency
and within a minimal timeframe. Formally stated:

➢ Testing is the systematic process of executing a program with the aim of identifying
errors.
➢ A successful test is defined by its ability to reveal previously undiscovered errors.
➢ A high-quality test case is one that possesses a high likelihood of uncovering errors, if
they exist.
➢ Tests may be inadequate in detecting potentially existing errors.
➢ The software generally adheres to quality and reliability standards.

Levels of Testing:

In order to identify errors across different phases, testing employs various levels.

System Testing:

The core principle guiding testing is error detection. Test cases are crafted with this objective
in mind. One strategy utilized in system testing is code testing.

Dept. of CSE, RGMCET Page 36


Medical Leaf Recognition

Code Testing:

This approach focuses on scrutinizing the program's logic. It involves developing test data to
execute every instruction and module within the program, ensuring that every possible path is
tested. Systems are not constructed or tested in isolation. To ensure flawless coding, two types
of testing are typically employed across all systems.

9.2 Types of Testing:

Unit Testing:

Unit testing zooms in on the tiniest building blocks of software, like modules. It uses detailed
design and process specifications to hunt down errors within each module's limits. Every
module needs to pass its unit test before we move on to integration testing. Unit testing starts
by testing each module separately to find any mistakes.

Link Testing:

Link testing doesn't test the software itself, but rather focuses on integrating each module into
the system. The main goal is to ensure that all modules work well together. During this phase,
the programmer tests modules that are designed with different parameters, lengths, types, and
so on.

Integration Testing:

After completing unit testing, the next step is integration testing. The objective is to ensure that
modules can be seamlessly integrated, with a focus on testing interfaces between them. This
testing phase is crucial for evaluating the system's design, particularly the interactions between
modules.

In this project, integrating all the modules forms the core system. During integration, I've
meticulously checked whether combining different modules affects the functionality of any
services. This involves testing various combinations of inputs to ensure that each service
operates smoothly before integration.

System Testing:

In this phase, the entire software system undergoes testing. The requirements document serves
as the primary reference for this process , guiding the evaluation to determine if the

Dept. of CSE, RGMCET Page 37


Medical Leaf Recognition

software aligns with its specified requirements.

Acceptance Testing:

The Acceptance Test involves using realistic client data to showcase that the software functions
satisfactorily. Testing in this phase primarily concentrates on the system's external behaviour
rather than its internal logic.

Test cases are chosen to cover the widest range of attributes within an equivalence class
simultaneously. This phase of testing is pivotal in software development, as it entails
uncovering errors, identifying missing operations, and conducting comprehensive verification
to ensure that the objectives are fulfilled and user requirements are met.

White Box Testing:

This method is a form of unit testing where each unit is meticulously tested at the statement
level to uncover as many errors as possible. I systematically examined every piece of code,
ensuring that each statement was executed at least once. This approach, often referred to as
White Box Testing, is also known as Glass Box Testing.

Black Box Testing:

This testing method treats a module as a single unit and focuses on testing its interface and
communication with other modules, rather than delving into the details at the statement level.
In this approach, the module is regarded as a black box, receiving inputs and producing outputs.
The outputs generated for various input combinations are then forwarded to other modules.

Fig 9.1: Testing cycle

Dept. of CSE, RGMCET Page 38


Medical Leaf Recognition

10. CONCLUSION AND FUTURE SCOPE

10.1 Conclusion

The approach, employing the MobileNetV2 model, achieved a 98% recognition rate,
surpassing traditional methods. This study underscores the effectiveness of deep learning,
particularly CNNs, in accurately classifying medicinal plants despite appearance variations.
By learning complex image features, the proposed CNN-based approach ensures high accuracy
in plant classification, offering a reliable tool for healthcare professionals and herbal medicine
researchers in identifying medicinal plants.

10.2 Future Scope:

Future work aims to integrate identified plants with a large language model, offering scientific
names, additional images, and usage instructions in English and local languages, enhancing
accessibility and understanding for informed herbal medicine usage.

Dept. of CSE, RGMCET Page 39


Medical Leaf Recognition

11.REFERENCES

[1]
1
Chengzhuan Yang, 2Hui Wei – ‘Plant Species Recognition Using Triangle-Distance
Representation’- 1School of Information, Zhejiang University of Finance and Economics
,Hangzhou 310018,China, 2Laboratory of Cognitive Algorithm and Model, Shanghai Key
Laboratory of Data Science, School of Computer Science, Fudan University, Shanghai
201203, China

[2]
1
XUAN WANG , 2WEIKANG DU , 3FANGXIA GUO ,AND 4SIMIN HU –‘ Leaf
Recognition Based on Elliptical Half Gabor and Maximum Gap Local Line Direction
Pattern’-School of Physics and Information Technology, Shaanxi Normal University,
Xi’an 710062, China

[3]
1
Ayan Chaudhury and 2John L. Barron-‘ Plant Species Identification from Occluded Leaf
Images’.

[4]
1
Jibi Thanikkal, 2Ashwani Kumar Dubey , 3Thomas M T,-‘A Novel Edge detection method
for medical plants leaf features extraction ’-1Amity University, 2
Amity University Uttar
Pradesh,3St Thomas College ,Thrissur

Dept. of CSE, RGMCET Page 40

You might also like