Flower Identification Using Machine Learning This Report Conferred To The Department of CSE of Daffodil International
Flower Identification Using Machine Learning This Report Conferred To The Department of CSE of Daffodil International
Flower Identification Using Machine Learning This Report Conferred To The Department of CSE of Daffodil International
net/publication/339599806
CITATIONS READS
0 5,446
1 author:
SEE PROFILE
Some of the authors of this publication are also working on these related projects:
All content following this page was uploaded by Md. Mizanur Rahman Nayeem on 03 March 2021.
ID: 151-15-4910
ID: 151-15-4883
ID: 151-15-5299
Supervised By
We take this opportunity to express our sincere gratitude to Prof. Dr. Syed Akhter
Hossain Sir, Department of CSE Daffodil International University, Dhaka. Deep Knowledge
& keen interest of our supervisor in the field of “Machine Learning” to carry out this project.
His endless patience, scholarly guidance, strong motivation, continual encouragement,
constant and energetic supervision, constructive criticism , valuable advice, reading many
inferior draft and correcting them at all stage have made it possible to complete this project.
We would like to express our heartiest gratitude to the Almighty Allah and also to other faculty
member and the staff of CSE department of Daffodil International University to finish our
project.
We would like to thank our entire course mate in Daffodil International University, who took
part in this discuss while completing the course work.
Finally, we must acknowledge with due respect the constant support and patients of our
parents.
Beauty is incomplete without flower. Bangladesh is the land of flower. In our everyday life,
On the way of walking, beside the rail line or in our garden we used to see a lot of flower. But
in most case we have no knowledge about that flower. Even we don’t know its name. In that
case we choose this idea to research and develop our project. That will introduce people about
that unknown flower which they see but don't know about that. Our developed application
recognizes the flower in real time by using mobile camera. This project is an attempt at using
the concepts of neural networks to create an image classifier by Tensorflow on Android
platform. Convolutional neural networks are a popular realm of machine learning, and are
widely used in image classification. So that we choose this topic to research about image
classification by CNN and Tensorflow. Though we developed an application of our research
project but we have a lot of plan to do more research to upgrade our system.
CONTENTS PAGE
Acknowledgement iv
Abstract v
CHAPTER
CHAPTER 1: INTRODUCTION 1-4
1.1 Introduction 1
1.2 Motivation 2
1.3 Rationale of the Study 2
1.4 Research Questions 3
1.5 Expected Outcome 4
CHAPTER 2: BACKGROUND 5-9
2.1 Introduction 5
2.2 Related Works 5-6
2.3 Research Summary 7
2.4 Scope of the Project 8
2.5 Challenges 9
CHAPTER 3: RESEARCH METHODOLOGY 10-18
AND IMPLEMENTATION
3.1 Introduction to Machine Learning 10
3.2 Convolutional Neural Network 11
3.3 Design of Dataset 12
3.4 Data Collection Procedure 13
3.4 Statistics of Data 14
3.5 Implementation Requirements 14
3.6 Implementation of Network Design 15-17
3.7 Design Development 18
References 30
Appendices: Accuracy Value For Some Training Steps 31-33
FIGURES PAGE
LIST OF TABLE
PAGE
TABLE
Table 3.4 : Statistics of Data 14
1.1 INTRODUCTION
Flower is a very important part of nature. Mostly we identify a plant through its flower.
Experienced botanists do this identification of flower but a naive person will have to consult flower
guidebooks or browse any relevant web pages on the Internet through keywords searching. Our
system can recognizes the flower in real time using mobile camera. Currently this Android app
can identify around 10 flowers. Most important thing is that this app can fully works in offline.
We are continuously working to add more flowers to identify. Everyday we see a huge number of
flower species in our house, parks, roadsides, in farms, on our rooftop but we have no knowledge
of that flower species or their origin. Even we have no idea about its name. There are several
guidebooks for flowers knowledge but it becomes quite difficult to find the name when have the
picture. Even the Internet sometimes is not useful. But it is quite difficult for human brain to
memorize all the species they see. Even some flower is similar to look at. This application
recognizes the flower in real time by using mobile camera.
The purpose of this project is to use Tensorflow, an open-source dataflow and machine learning
library, to build an image classifying Convolutional Neural Network (CNN) for classifying the
flower image. Tensorflow, in addition to providing developers a simple way to build neural
network layers, can also be run on mobile platforms such as Android. The ultimate goal of this
project is to design and optimize a convolutional neural network for use with flower classification,
and eventually build a simple classification app for mobile devices around the trained network.
The mobile app will allow users to try and classify flowers while outdoors or offline [1].
At the primary stage of our journey looked for research paper and tools related with our idea. Even
we deeply searched the Internet to find if there any system that can identify flower automatically.
But unfortunately we found very few resources. There exists a handful papers in there. That time
we take this as a challenge and start our research to make a system which can recognize flower in
real time. After a lot of hard work our project now come to light finally. Now our application can
identify around 10 Bangladeshi common flowers with some foreign flowers also. The most unique
feature of project is it can identify flower in real time. For some kind of flower it provides 100%
accuracy rate. Different flower is same to look at we know. If this occur during identification time
that time our application shows 3 or 2 most similar result. Convolutional Neural Network (CNN)
and Image Classification technique used in our project which can identify flower with the
confidence level from 0 to 1. We use Tensorflow an open source library for training process.
2. Produce a convolutional neural network which is capable correctly classifying images of flowers
with an average confidence level of 95% or more. Sometimes it provides 100% accuracy rate for
some kind of flowers.
3. Collected a dataset of over 5000 images of flowers using their genus-species classification as
the Google Image search term.
The following figure showing the output of the application which identify Rose with highest
confidence value by using mobile camera.
2.1 INTRODUCTION
Since the invention of computer, it has begun to change our daily life. It improves the quality of
our lives. An impressive idea is to let a computer think and learn as like human being. Basically
machine learning developed skills to develop the computer itself with the knowledge given. There
are many applications of CNNs, one of the most popular of which is image classification, and
CNNs have even been used specifically for flower classification. These flower classification neural
networks, however generally use datasets with very specific details. Thus, this project is
explorative and aimed at learning how to design a neural network using Tensorflow, but ultimately
has practical applications for developers, botanists, or nature enthusiasts. The dataset used for
training was collected through Google Images, and the images of the plants themselves are very
general, rather than of specific characteristics of the plants, and typically include most of the
identifying characteristics of a flower [3].
Recent history of modern software technology we can see lots of use of machine learning and
image processing in our day to life. Like Police using face detection technology to identify
criminal. Facebook using AI technology to match your face ID with any photo of you that has been
uploaded. Pinterest use this technology to find similar photos. Traffic police also find out vehicles
by using this technology. There is so many big projects on this topic, those are given below,
Among the popular software This is a Plant identification software developed by “Glority
Software limited” running on both Android and IOS. This Software let you identify plant
by taking a picture with 90% accuracy rate less than a second.
» PLANTSNAP
This is also a popular software like PictureThis, developed by PlantSnap INC. This
software let us to identify plants, flowers, cacti, mushrooms etc. by taking a picture
of that plant. There are 585,000 species of plants and trees in their database. So their
accuracy rate is 90% accurate.
Developers
The project is complete ready for practical use, someone who wishes to learn the basics of CNNs
and Tensorflow, substituting their own classes. The project is essential for anyone that wants to
improve their project. It have scope to improve both the dataset and the CNN architecture,
however, this will require more research and knowledge of CNN design. Additionally, someone
who is interested in Tensorflow and Android development or front end development can be
benefited from this work.
Scientist or Botanist
This research and project will be helpful for botanists or biologists, although any scientist would
likely wish to use their unique dataset. The project would most likely be useful to scientists for
classifying large amounts of data and generating statistics for the dataset. Using our Android
application Botanists or other scientists dealing with flowers to identify easily.
Our developed project will be much helpful while spending time outdoors to identify flowers by a
mobile application. This application works completely in offline which use mobile camera to
identify flowers. It will be really helpful for Traveler, Hiker and Nature Enthusiasts [1].
Duplicate flower identification is the main challenge of our project. Some flowers are same to look
at by size and shape. That time it is so tough to provide the accurate result. We are continue our
research to solve this problem.
Another challenge is to identify same flower of different specific color. Ex- White Rose, Pink
Rose. This is a tough work to identify color using convolutional neural network. But we take it as
a challenge.
Other challenge is achieving accurate data. In the market of false and duplicate data, it is very
hard to get all of the things right. But we are trying are heart and soul to do better.
AND IMPLEMENTATION
Convolutional neural networks are a class of machine learning networks which are commonly
applied to image visualization problems such as classification. CNNs were inspired by the
connections of the neurons and synapses in the brain. The design of these networks is made up of
series of convolutional, pooling, and fully connected layers. The convolutional layer does what its
name describes, it applies a number of convolutional filters to the input images in order to acquire
the learning parameters for the network. Pooling layers are placed in between convolutional layers,
and are used to reduce the number of parameters used for learning, and thus reduce the computation
required. Finally, fully connected layers are full connections to the previous layer, rather than the
small window the convolutional layers are connected to in the input. Convolutional neural
networks are commonly used for image classification, however, there are limitations to this
application. A human can identify the contents of certain images much more quickly than a
computer, but CNNs have proven to have a 97.6% success rate when applied to facial recognition
[11].
The following figure showing the typical design of convolutional neural network.
The diagram of dataset design which shows different step of data collection and dataset handler.
Shapla
Shapla
Google Image
Noyontara Noyontara
Downloader
Aporajita
---
Aporajita
The following figure shows the sample dataset image of Shapla flower.
Software
Hardware
Intel i3 Processor
4 GB RAM
1TB Hard Disk
Convolutional Layer 1
Input:
The image data is reduced to a size of 128x128 pixels in order to not overwhelm the hardware
the program was normally tested on. Batches of 32 images are fed into the convolutional layer
and 16 filters of 8x8 pixels are applied to the images.
conv_layer1 =
lb . build_convolutional_layer ( input = image_placeholder ,
num_channels = NUM_CHANNELS ,
filter_size = FILTER_SIZE ,
num_filters = NUM_FILTERS)
Pooling layer 1
Input:
Each pooling layer uses a pool size of 2x2 and a stride size of 2.
pool_layer1 = tf . layers . max_pooling2d ( inputs = conv_layer1 ,
pool_size =[ 2 , 2 ], strides = 2)
Convolutional Layer 2
The second convolutional layer has the same parameters as the first.
conv_layer2 =
lb . build_convolutional_layer ( input = pool_layer1 ,
num_channels = NUM_FILTERS ,
filter_size = FILTER_SIZE ,
num_filters = NUM_FILTERS)
Pooling layer 2
Each fully connected layer performs an activation on each of its inputs. The first, however,
performs a RELU activation function on the data.
connected_layer2 = \
lb . create_connected_layer ( input = connected_layer1 ,
num_inputs = 32 ,
num_outputs = num_classes ,use_relu = False)
Training Step
The number of training steps can be specified as a command line parameter. Each training step is
validated and tested, and the results of each step are printed to standard out.
is_last_step = (i + 1 == FLAGS.how_many_training_steps)
if (i % FLAGS.eval_step_interval) == 0 or is_last_step:
train_accuracy, cross_entropy_value = sess.run(
[evaluation_step, cross_entropy],
feed_dict={bottleneck_input: train_bottlenecks,
ground_truth_input: train_ground_truth})
tf.logging.info('%s: Step %d: Train accuracy = %.1f%%' %
(datetime.now(), i, train_accuracy * 100))
tf.logging.info('%s: Step %d: Cross entropy = %f' %
(datetime.now(), i, cross_entropy_value))
validation_bottlenecks, validation_ground_truth, _ = (
get_random_cached_bottlenecks(
sess, image_lists, FLAGS.validation_batch_size, 'validation',
FLAGS.bottleneck_dir, FLAGS.image_dir, jpeg_data_tensor,
decoded_image_tensor, resized_image_tensor, bottleneck_tensor,
FLAGS.architecture))
validation_summary, validation_accuracy = sess.run(
The design of CNN which we tested is being submit as a deliverable for this project. This model
also was trained using the dataset at the genus-species level, which uses approximately 700 images
average per class, which is almost enough. But we are working to add more images per class. This
model is currently being trained and tested. The parameters of the network such as number of
training steps, output directory, and image input directory can all be specified, however, their
defaults will place all the output directory in the current working directory. The input image
directory must be specified, and the contents of the directory must be folders of images in tf files
folder. The Tensorflow trainer will generates two text files: one containing the labels for the
classifier, and the other lists which images were selected for training, testing, and validation which
called pb file. The classifier uses these to read result for each image classification and show the
output result.
The following figure shows the pre processing step in Tensorflow which create label file and
bottleneck file.
TENSORBOARD
TensorFlow Computation for training a massive deep neural network - can be complex and
confusing. To make it easier to understand, debug, and optimize TensorFlow programs, there
include a visualization tools called TensorBoard. TensorBoard visualizes the quantitative metrics
of the plot, graph, plots and additional information such as passing the images [12].
There are some figures below which shows the histograms of tensorflow computations in
tensorboard.
The purpose of this project is to use Tensorflow, an open-source dataflow and machine learning
library, to build an image classifying Convolutional Neural Network (CNN) for classifying the
flower image. Tensorflow, in addition to providing developers a simple way to build neural
network layers, can also be run on mobile platforms such as Android. The ultimate goal of our
project is to design and optimize a convolutional neural network for use with flower classification,
and eventually build a simple classification app for mobile devices around the trained network.
The mobile app will allow users to try and classify plants while outdoors or offline [12].
This project has plenty of room for future work, by myself or a future interested student.
5.3 CONCLUSIONS
With the rapid development of technology, AI is being used in various fields. Machine learning is
the most basic method to achieve AI. This research describes the work principle of machine
learning and an application of machine learning. At the beginning of development of Artificial
Intelligence (AI), the AI system does not have a thorough learning ability so the whole system is
not perfect. For instance when the computer faces problems, it can not be self-adjusting. Moreover,
the computer cannot automatically collect and discover new knowledge. Therefore, computer only
can conducted by already existing truths. It does not have the ability to discover a new logical
theory, rules and so on. The ultimate goal of this project is to design and optimize a convolutional
neural network for use with flower classification, and eventually build a simple classification app
for mobile devices around the trained network. The mobile app will allow users to try and classify
plants while outdoors or offline. We will continue our research to make the system more efficient.
[1] Kody G. Dangtongdee and Dr. Franz Kurfess, “Plant Identification Using Tensorflow, ”.
Computer Engineering Department, California Polytechnic State University, San Luis Obispo,
Senior Project Final Report. CPE 462, Winter 2018, pp. 5-15.
[2] Xuanxin Liu, Fu Xu, Yu Sun, Haiyan Zhang, and Zhibo Chen, “Convolutional Recurrent
Neural Networks for Observation-Centered Plant Identification,” Journal of Electrical and
Computer Engineering, vol. 2018, pp. 1–7, 2018.
[3] Yu Yang and Patric Granholm, “A study of pattern recognition of Iris flower based on Machine
Learning, ”. Turku University of Applied Sciences, Turku Finland , Bachelor’s Thesis, 2013.
[4] Wang-Su Jeon and Sang-Yong Rhee, “Plant Leaf Recognition Using a Convolution Neural
Network, ”. International Journal of Fuzzy Logic and Intelligent Systems Vol. 17, No. 1, March
2017, pp. 26-34.
[5] Er. Gurleen Kaur Marwa and Er. Salam Din, “Development of Software for Flower Recognition
Using Image Processing Technique, ”. Dept. of SEEIT, COAET, PAU, Ludhiana, India,
vol. 3, Issue 5, May 2015.
[6] Vijaya Bylaiah, “Leaf Recognition and Matching with MATLAB, ”. A Thesis Presented to the
Faculty of San Diego State University, Spring 2014.
[7] Y. Li, Q. Zhu, Y. Cao, and C. Wang, “A leaf vein extraction method based on snakes technique,”
in Proceedings of the International Conference on Neural Networks and Brain (ICNN&B '05), pp.
885–888, 2005.
[8] Bache, K.& Lichman, M. 2013. UCI Machine Learning Repository [http://archive.ics.uci.edu/ml].
Irvine, CA: University of California, School of Information and Computer Science.
[9] Bishop, C. 2006. Pattern Recognition and Machine Learning. New York:Springer, pp.424-428.