Updated KV Report
Updated KV Report
Updated KV Report
DEEP LEARNING
A PROJECT REPORT
Submitted by
MADHUMITHA.B - 510821205014
VISHNUPRIYA.R - 510821205030
MONIKASRI.M - 510821205015
NITHISH.R - 510821205018
of
BACHELOR OF TECHNOLOGY
IN
INFORMATION TECHNOLOGY
KANIYAMBADI, VELLORE.
ANNA UNIVERSITY :: CHENNAI 600 025
NOVEMBER 2024
BONAFIDE CERTIFICATE
SIGNATURE SIGNATURE
D.DURAI KUMAR D. DURAI KUMAR
SUPERVISOR HEAD OF THE DEPARTMENT
Associate Professor Associate Professor
Ganadipathy Tulsi’s Jain Engineering College Ganadipathy Tulsi’s Jain Engineering College
We express our special thanks to the almighty for giving us the courage
and strength in all aspects to complete our study successfully.
Finally, we express our hearty and sincere thanks to our family and
friends for their constant and valuable support and encouragement.
III
ABSTRACT
IV
TABLE OF CONTENTS
ABSTRACT IV
LIST OF ABBREVIATIONS IX
1 INTRODUCTION 1
1.1. OBJECTIVE 1
1.2. OVERVIEW 1
2 LITERATURE SURVEY 2
3 SYSTEM SPECIFICATION 9
3.3.1 Python 9
3.3.2 Flask 14
V
4 SYSTEM DESIGN 20
5 PROJECT DESCRIPTION 26
5.1. MODULES 26
Assessment Module 38
6 SYSTEM IMPLEMENTATION 40
VI
6.3. MODEL TRAINING 42
6.6. DEPLOYMENT 43
7 SYSTEM TESTING 44
7.1. TESTING 44
8 CONCLUSION 47
ANNEXURES
BIBLIOGRAPHY
VII
LIST OF FIGURES
3.2 YOLOv4 18
VIII
LIST OF ABBREVIATIONS
UI - User Interface
IX
CHAPTER 1
INTRODUCTION
1.1. OBJECTIVE
The main objective of this project is to develop a system for the assessment
of oxygen sufficiency in an environment using deep learning.
1.2. OVERVIEW
The technical core of the system involves using CNNs, a type of deep
learning model adept at processing structured array data such as images, to
accurately identify and classify different plant species from visual inputs. By
linking specific species to known oxygen production rates, the system can
estimate the total oxygen output in a given area. This estimation process is
crucial for urban planners and environmental scientists seeking to enhance or
maintain air quality through strategic vegetation management. The system's
effectiveness in classifying plant species directly influences the accuracy of the
oxygen production estimates, thereby impacting the overall reliability of the
oxygen sufficiency assessment.
1
CHAPTER 2
LITERATURE SURVEY
Advantages:
Increased Accuracy
Scalability
Disadvantages:
Huge Data Requirements
2
applications of using sensor networks to evaluate the oxygen sufficiency of tree
in urban environments.
Advantages:
Accurate Results
Improved Public health
Disadvantages:
Not cost efficient
Not scalable
Limited to Urban areas
[3] Gargi Chandrababu, Ojus Thomas Lee and Rekha K S," Identification of
Plant Species using Deep Learning” 2021.
3
Advantages:
• Improved accuracy
• Scalability
Disadvantages:
• Large Data Sets Needed
4
The results of this study are promising, demonstrating the potential of
wearable technology to offer valuable insights into an individual's
cardiovascular health and fitness levels in real-life settings. This capability
extends beyond traditional uses of wearables for step counting and basic activity
tracking, moving towards more meaningful health assessments and
interventions.
Advantages:
• Real world monitoring
• Early detection of health issues
• Remote monitoring
Disadvantages:
• Limited battery life
5
2.1. EXISTING SYSTEM
Advantages:
Accurate Results
Improved Public health
Disadvantages:
Technical Complexity.
Maintenance.
Not scalable
Limited to Urban areas
6
2.2. PROBLEM IDENTIFICATION
Expensive sensors:
The current system uses oxygen sensors which is very expensive.
Absence of Recommendation:
No automated recommendation of plants when oxygen is
insufficient.
7
2.4. PROPOSED SYSTEM
Our proposed system uses yolov5, A Deep Learning based algorithm for
the classification of tree species in an environment. Then our system sums up
the total oxygen production of the tree species that has been classified. By
finding the population density through demographic data in a given
environment, Our system assess the oxygen sufficiency by comparing the
oxygen required for the people and oxygen produced by the trees in an
environment. When oxygen levels are found to be sufficient, Our system will
indicate that the oxygen levels are sufficient for the people in a given
environment to the user through the user interface. If the oxygen levels are
found to be insufficient then our system would recommend some plants to the
user through the user interface. These recommendations are tailored to
efficiently address and mitigate the issue of oxygen insufficiency, ensuring that
the environment supports the well-being of its inhabitants. This intelligent
approach not only enhances environmental sustainability but also promotes
healthier living conditions through a precise, data-driven methodology.
Advantages:
• Cost efficient
• Recommendation of plants
• Scalable
8
CHAPTER 3
SYSTEM SPECIFICATION
Backend : Flask
3.3.1. python
9
and whitespace. Python is an interpreted language, meaning that it does not
require compilation before execution. Instead, the Python interpreter directly
executes the code, allowing for rapid development and testing. Python is a
general-purpose programming language that can be used for various
applications, such as web development, data analysis, scientific computing.
Why Python?
10
Python Features
Python is Interpreted
Many languages are compiled, meaning the source code you create needs
to be translated into machine code, the language of your computer’s
processor, before it can be run. Programs written in an interpreted
language are passed straight to an interpreter that runs them directly.
This makes for a quicker development cycle because you just type in your
code and run it, without the intermediate compilation step.
One potential downside to interpreted languages is execution speed.
Programs that are compiled into the native language of the computer
processor tend to run more quickly than interpreted programs. For some
applications that are particularly computationally intensive, like graphics
processing or intense number crunching, this can be limiting.
In practice, however, for most programs, the difference in execution
speed is measured in milliseconds, or seconds at most, and not
11
appreciably noticeable to a human user. The expediency of coding in an
interpreted language is typically worth it for most applications.
Python Libraries
Python libraries are pre-written code modules that provide a wide range
of functionalities, making development tasks easier and more efficient. These
libraries encompass various domains such as data analysis, machine learning,
web development, scientific computing, and more. They are developed and
maintained by the open-source community, making them readily available for
developers to incorporate into their projects. Python libraries that are used for
Deep learning are:
NumPy
Pandas
TensorFlow
PyTorch
Keras
NumPy
12
Pandas
Pandas is a popular Python library for data analysis. As we know that the
dataset must be prepared before training. In this case, Pandas come handy as it
was developed specifically for data extraction and preparation. It provides high-
level data structures and wide variety of tools for data analysis. It provides
many inbuilt methods for groping, combining, and filtering data.
TensorFlow
TensorFlow is a very popular open-source library for high-performance
numerical computation developed by the Google Brain team in Google. As the
name suggests, TensorFlow is a framework that involves defining and running
computations involving tensors. It can train and run deep neural networks that
can be used to develop several AI applications. TensorFlow is widely used in
the field of deep learning research and application.
PyTorch
PyTorch is an open-source machine learning library developed by
Facebook's AI Research lab (FAIR) that provides a flexible and intuitive
framework for building deep learning models. It is particularly favored for its
dynamic computation graph (also known as autograd system), which allows for
modifications to the graph on-the-fly during execution. This makes it highly
adaptable for research and complex model development, enabling
straightforward implementation of changes and optimizations without needing
to rebuild the model from scratch.
Keras
13
highlevel neural networks API capable of running on top of TensorFlow,
CNTK, or Theano. It can run seamlessly on both CPU and GPU. Keras makes it
really for DL beginners to build and design a Neural Network. One of the best
things about Keras is that it allows for easy and fast prototyping.
3.3.2 Flask
Flask is a lightweight and flexible micro web framework for Python, used
for building web applications. It is designed to be simple and easy to use,
enabling developers to start with a minimal setup, but also powerful enough to
scale up to complex applications. Flask provides tools, libraries, and
technologies that allow developers to build a web application quickly and
efficiently. It supports extensions that add features such as form validation,
upload handling, session management, and more, which are not included in the
core framework to keep it lightweight. Flask is particularly favored for its
simplicity, flexibility, and fine-grained control over the components used in the
application, making it a popular choice for both beginners and experienced
developers building web services, APIs, and web sites.
14
Accessibility: Colab is accessible via a web browser, with no installation
required, making it widely accessible to users worldwide.
Free Access to Hardware: It provides free access to computing
resources including GPUs (Graphics Processing Units) and TPUs (Tensor
Processing Units), which are crucial for processing large datasets and
complex computations.
Collaboration: Similar to Google Docs, Colab allows multiple users to
collaborate on the same document in real-time, facilitating team projects
and educational environments.
Integration with Google Drive: Colab is seamlessly integrated with
Google Drive, allowing users to store their notebooks and access them
from anywhere. This integration also facilitates the sharing of notebooks
and resources.
Compatibility: The platform supports most libraries and frameworks
used in machine learning and data science, making it a versatile tool for
developers and researchers.
Use Cases
15
Prototype Development: Developers use Colab to prototype new ideas
and algorithms quickly, leveraging its integration with various APIs and
data sources.
Advantages
YOLO Architecture
16
YOLO architecture is similar to GoogleNet. As illustrated below, it has
overall 24 convolutional layers, four max-pooling layers, and two fully
connected layers.
Residual blocks
Bounding box regression
Intersection Over Unions or IOU for short
Non-Maximum Suppression.
17
Figure No 3.2: YOLOv4
18
YOLOv6 provides outstanding results compared to the previous
YOLO versions in terms of accuracy and speed on the COCO
dataset as illustrated below.
Advantages:
19
CHAPTER 4
SYSTEM DESIGN
20
4.2. SYSTEM ARCHITECTURE
21
4.3. UML DIAGRAMS
UML stands for Unified Modeling Language which is used in object
oriented software engineering. Although typically used in software engineering
it is a rich language that can be used to model an application structures,
behavior and even business processes. There are 14 UML diagram types that
help you to model these behavior. They can be divided into two main categories,
structural and behavioral diagrams.
Structural Diagrams
Class diagram
Component diagram
Deployment diagram
Object diagram
Package diagram
Profile diagram
Composite structure diagram
Behavioral Diagrams
Use case diagram
Activity diagram
State machine diagram
Communication diagram
Sequence diagram
Interaction overview diagram
Timing diagrams
22
4.3.1. Use case Diagram
A Use case diagram at its simplest is a representation of a user’s
interaction with the system that shows the relationship between the user and the
different use cases in which the user is involved. A use case diagram can
identify the different types of users of a system and the different use cases and
will often be accompanied by other types of diagrams as well.
23
4.3.2. Activity Diagram
Activity diagram are graphical representations of workflows of stepwise
activities and actions with support for choice, iteration and concurrency. In the
unified Modelling Language, activity diagrams are intended to model both
computational and organizational processes. Activity diagrams show the overall
flow of control.
24
4.3.3. Sequence Diagram
A Sequence diagram is an interaction diagram that shows how processes
operate with one another and in what order. A sequence diagram shows, as
parallel vertical lines (lifelines), different processes or objects that live
simultaneously, and, as horizontal arrows, the messages exchanged between
them, in the order in which they occur. This allows the specification of simple
runtime scenarios in a graphical manner.
25
CHAPTER 5
PROJECT DESCRIPTION
5.1. MODULES
The Proposed system consists of four modules. They are as follows:
26
capture the distinctive characteristics of different tree species. Once extracted,
these features serve as the input for the classification model, where they are
used to accurately identify and differentiate between species. The effectiveness
of the feature extraction module directly influences the accuracy and reliability
of the classification system, making it a cornerstone of the image processing
workflow.
27
CHAPTER 6
SYSTEM IMPLEMENTATION
28
a combination of hardware and software to ensure that the images collected are
clear and detailed enough for accurate feature extraction. The hardware
component often includes cameras with high resolution and capabilities for
various lighting and weather conditions, ensuring versatility across different
environmental settings. The implementation of the Image Acquisition Module
is designed to be straightforward and user-friendly. Users, Once captured, the
images are automatically given to the feature extraction module processes them.
This process is typically seamless from the user’s point of view, requiring
minimal interaction beyond the initial setup and actual image capture. The
system can also provide real-time feedback on the quality of captured images
and suggest retakes if necessary, ensuring that the data input into the system is
of the highest quality. This facilitates ease of use and enhances the reliability of
the data collected, crucial for the accuracy of the tree species classification and
the overall system performance.
29
Techniques such as data augmentation can be employed to artificially expand
the training dataset, enhancing the model's ability to generalize from limited
data by simulating a range of possible real-world conditions. Once the model is
trained, it can be integrated into a user-friendly application or system interface.
Users can upload images of trees directly into the system, which are then
processed by the feature extraction module. The module analyzes the images,
applies the trained YOLOv5 model to detect and classify tree species, and
outputs the identified species names along with any additional botanical
information relevant to the user. This process is typically fast, with results being
available in near real-time, which is essential for applications requiring
immediate data for environmental analysis or decision-making. Additionally, the
system can be continuously updated with new data to refine and enhance its
classification accuracy, ensuring it remains effective as new tree species are
discovered or as environmental conditions evolve. This dynamic capability
makes the system highly adaptable and valuable for ongoing ecological
monitoring and management efforts.
30
names. This training enables the model to learn the unique characteristics of
each tree species, enhancing its ability to accurately classify new images. Once
the Image Acquisition Module uploads the images to the system, the Tree
Classification Module automatically processes these images. Users can monitor
this process via a user-friendly web or mobile application interface, where they
can upload images and receive species identification results in real-time. The
interface also provides additional information about each identified species,
such as its common name, botanical characteristics, and its ecological and
oxygen-producing benefits. For users requiring more detailed data, the module
can generate reports or integrate its findings into broader environmental impact
studies or urban planning initiatives. This automation and ease of use make it
suitable for a wide range of applications, from scientific research to municipal
management, enabling users to contribute to and access biodiversity information
without needing deep technical expertise.
31
population in the specified area. This is done through a backend calculation
layer where algorithms process the input data to estimate if the oxygen levels
are sufficient, deficient. If a deficiency is detected, the system then triggers the
recommendation module to suggest planting additional specific species known
for higher oxygen production. Users interact with this module through a
dashboard where they can input data, view the assessment results, and receive
recommendations. The module also allows for the input of updated
demographic data and tree inventories, ensuring that the assessments remain
accurate over time as environmental and population dynamics change.
32
CHAPTER 7
SYSTEM TESTING
7.1. TESTING
Testing is a process of executing a program with the intent of finding an
error. A good test case is one that has a high probability of finding an as-yet-
undiscovered error. System testing is the stage of implementation, which is
aimed at ensuring that the system works accurately and efficiently as expected
before live operation commences. It verifies that the whole set of programs
hang together. System testing requires a test consists of several key activities
and steps for run program, string, system and is important in adopting a
successful new system. This is the last chance to detect and correct errors before
the system is installed for user acceptance testing.
The software testing process commences once the program is created and
the documentation and related data structures are designed. Software testing is
essential for correcting errors. Otherwise the program or the project is not said
to be complete. Software testing is the critical element of software quality
assurance and represents the ultimate the review of specification design and
coding. Testing is the process of executing the program with the intent of
finding the error. A good test case design is one that as a probability of finding
an yet undiscovered error. A successful test is one that uncovers a yet
undiscovered error.
Testing is an essential part of developing a trust user recommendation
system to ensure its accuracy and reliability. There are several types of testing
that can be used to evaluate the performance of a trust user recommendation
system.
33
7.2. DIFFERENT LEVEL OF TESTING
Unit Testing
Integration Testing
System Testing
Upon completing unit testing for each module of our proposed tree
species classification and environmental assessment project, the results have
demonstrated a high degree of reliability and accuracy across all components.
The Image Acquisition Module consistently captured high-quality images under
a variety of environmental conditions, while the Tree Classification Module
accurately identified tree species with a precision rate significantly above
industry standards. The Oxygen Sufficiency Assessment Module effectively
calculated the oxygen production and requirements, producing dependable
outputs that matched expected theoretical values closely. Lastly, the
Recommendation Module provided appropriate plant species suggestions based
on environmental and demographic data inputs, aligning with expert ecological
advice. These testing outcomes affirm the robustness and efficacy of the system,
ensuring that it is well-prepared for real-world deployment and capable of
contributing positively to environmental management and urban planning
initiatives.
34
Assessment Module, and Recommendation Module worked flawlessly, with
data accurately passing through the system pipeline without loss or corruption.
The combined operation of these modules demonstrated a cohesive system
performance, where the output from one module effectively fed into the next,
producing consistent and reliable results across various test scenarios.
Additionally, the system's response time and ability to handle simultaneous
requests met our performance criteria, confirming the system’s readiness for
practical deployment and its potential to efficiently manage large-scale
environmental data in a real-world setting.
35
CHAPTER 8
CONCLUSION
The project also identified areas for improvement, including the need for a
more diverse dataset and enhanced handling of environmental variability.
Moving forward, enhancing dataset diversity, integrating real-time
environmental data, and focusing on sustainable computing practices will be
crucial in evolving the system's capabilities and reducing its environmental
36
impact. This project not only pushes the boundaries of ecological monitoring
using AI but also sets a foundation for future innovations aimed at
environmental sustainability and informed urban planning.
APPENDICES
ANNEXURES 1:SOURCE CODE
!pip install PyYAML
from google.colab import drive
drive.mount('/content/drive')
import cv2
import numpy as np
import os
import yaml
from yaml.loader import SafeLoader
# load YAML
with open('/content/drive/MyDrive/Yolo/yolov5/data.yaml',mode='r') as f:
data_yaml = yaml.load(f,Loader=SafeLoader)
labels = data_yaml['names']
print(labels)
# load YOLO model
37
yolo =
cv2.dnn.readNetFromONNX('/content/drive/MyDrive/Yolo/yolov5/runs/t
rain/Model2/weights/best.onnx')
yolo.setPreferableBackend(cv2.dnn.DNN_BACKEND_OPENCV)
yolo.setPreferableTarget(cv2.dnn.DNN_TARGET_CPU)
# load the image
img = cv2.imread('/content/drive/MyDrive/data
images/train/DJI_0146_JPG.rf.cba17a0304a36336222f15c9ae92e2a7.jpg'
)
image = img.copy()
row, col, d = image.shape
# get the YOLO prediction from the the image
# step-1 convert image into square image (array)
max_rc = max(row,col)
input_image = np.zeros((max_rc,max_rc,3),dtype=np.uint8)
input_image[0:row,0:col] = image
# step-2: get prediction from square array
INPUT_WH_YOLO = 640
blob = cv2.dnn.blobFromImage(input_image,1/255,
(INPUT_WH_YOLO,INPUT_WH_YOLO),swapRB=True,crop=False)
yolo.setInput(blob)
preds = yolo.forward() # detection or prediction from YOLO
print(preds.shape)
# Non Maximum Supression
# step-1: filter detection based on confidence (0.4) and probability score
(0.25)
detections = preds[0]
boxes = []
confidences = []
38
classes = []
# width and height of the image (input_image)
image_w, image_h = input_image.shape[:2]
x_factor = image_w/INPUT_WH_YOLO
y_factor = image_h/INPUT_WH_YOLO
for i in range(len(detections)):
row = detections[i]
confidence = row[4] # confidence of detection an object
if confidence > 0.25:
class_score = row[5:].max() # maximum probability from 20 objects
class_id = row[5:].argmax() # get the index position at which max
probabilty occur
39
# NMS
index =
cv2.dnn.NMSBoxes(boxes_np,confidences_np,0.45,0.75).flatten()
index
text = f'{class_name}'
cv2.rectangle(image,(x,y),(x+w,y+h),(0,255,0),2)
cv2.rectangle(image,(x,y-30),(x+w,y),(255,255,255),-1)
cv2.putText(image,text,(x,y-
10),cv2.FONT_HERSHEY_PLAIN,0.7,(0,0,0),1)
40
# Wait for a key press and close the windows
cv2.waitKey(0)
cv2.destroyAllWindows()
import cv2
from collections import Counter
41
# Draw bounding box and label on the image
cv2.rectangle(image, (x, y), (x + w, y + h), (0, 255, 0), 2)
cv2.rectangle(image, (x, y - 30), (x + w, y), (255, 255, 255), -1)
cv2.putText(image, f'{class_name} {int(confidence * 100)}%', (x, y -
10), cv2.FONT_HERSHEY_PLAIN, 0.7, (0, 0, 0), 1)
tree_count={}
oxy_rates={'Neem':6000, 'Devkanchan':8000,'Mango':9000}
for class_name, count in class_counter.items():
tree_count[class_name]=count
tot_oxy_prod=0
for tree in tree_count:
tot_oxy_prod=tot_oxy_prod+oxy_rates[tree]*tree_count[tree]
n=int(input("Enter the total population"))
tot_oxy_peop=n*8640
if tot_oxy_peop<tot_oxy_prod:
print('Oxygen is Sufficient')
else:
print('Oxygen is not sufficient')
snake=0.12
difference=tot_oxy_peop-tot_oxy_prod
cnt=0
while True:
snake+=snake
cnt+=1
if snake >difference:
print(cnt, 'snake plants can be planted')
break
42
BIBLIOGRAPHY
[4] J. W. Tan, S.-W. Chang, S. Binti Abdul Kareem, H. J. Yap, and K.-T. Yong,
“Deep Learning for Plant Species Classification using Leaf Vein
Morphometric,” IEEE/ACM Trans. Comput. Biol. Bioinforma., pp. 1–1, 2018,
doi: 10.1109/TCBB.2018.2848653.
43
[5] A. Ambarwari, Q. J. Adrian, Y. Herdiyeni, and I. Hermadi, “Plant species
identification based on leaf venation features using SVM,” TELKOMNIKA
(Telecommunication Comput. Electron. Control., vol. 18, no. 2, p. 726, Apr.
2020, doi: 10.12928/telkomnika.v18i2.14062.
[6] H. F. Eid and A. Abraham, “Plant species identification using leaf biometrics
and swarm optimization: A hybrid PSO, GWO, SVM model,” Int. J. Hybrid
Intell. Syst., vol. 14, no. 3, pp. 155–165, Mar. 2018, doi: 10.3233/HIS-180248.
Sakarya University Journal of Computer and Information Sciences M. Fatih
Adak 237
44
[11] Y. Ren, N. Wang, M. Li, and Z. Xu, “Deep density-based image
clustering,” Knowledge-Based Syst., vol. 197, p. 105841, Jun. 2020, doi:
10.1016/j.knosys.2020.105841.
[12] W. Qian et al., “UAV and a deep convolutional neural network for
monitoring invasive alien tree in the wild,” Comput. Electron. Agric., vol. 174,
p. 105519, Jul. 2020, doi: 10.1016/j.compag.2020.105519.
[13] K. P. Ferentinos, “Deep learning models for plant disease detection and
diagnosis,” Comput. Electron. Agric., vol. 145, pp. 311–318, Feb. 2018, doi:
10.1016/j.compag.2018.01.009.
[14] Y. Osako, H. Yamane, S.-Y. Lin, P.-A. Chen, and R. Tao, “Cultivar
discrimination of litchi fruit images using deep learning,” Sci. Hortic.
(Amsterdam)., vol. 269, p. 109360, Jul. 2020, doi:
10.1016/j.scienta.2020.109360.
[16] S. Fan et al., “On line detection of defective apples using computer vision
system combined with deep learning methods,” J. Food Eng., vol. 286, p.
110102, Dec. 2020, doi: 10.1016/j.jfoodeng.2020.110102.
46