Professional Documents
Culture Documents
Android Based Object Detection Application For Food Items
Android Based Object Detection Application For Food Items
Android Based Object Detection Application For Food Items
Hira Amjad, Maleeha Khan, Emaan Khan, Dr. Sadaf Abdul Rauf
Department of Software Engineering
Fatima Jinnah Women University
The Mall, Rawalpindi
Abstract: Many health-related problems emerge due to features and gradient histogram [CITATION
improper diet and high quantity of calorie intake. Calorie
count cannot be recorded manually by people as it is not Abadi2016 \l 1033 ] which can help identify food
convenient to record them before meal every time. To cope items.
up with this problem, we present a distinctive android
based food detection application which identifies the food Food is a vital feature for health and if not taken
item from the given image and displays nutritional properly, in terms of nutrients a high intake of
information to the user. BMI calculator is also calories may cause serious health concerns.
implemented to provide ease in controlling weight along
with nutrients information. The proposed application uses [ CITATION Tammachat2014 \l 1033 ].
Convolutional Neural Network (CNN) which classifies the Automatic food recognition based on food images
image by learning image features. Two food datasets assists people to grasp the knowledge of nutritional
named UEC-100 and ImageNet are analyzed by training
both of them to deeply examine the results of CNN in the values of their food [ CITATION Chen2016 \l
field of food image recognition and detection. 1033 ]. Food recognition is difficult, as food objects
are deformable unlike other objects like car, book,
Keywords: Convolutional Neural Networks (CNN), pen etc and exhibit significant variations in
Machine Kernel Learning (MKL), Calorie Count, UEC-
100, ImageNet. appearance [ CITATION yang2010food \l
1033 ]. For food recognition, techniques like
Convolution Neural Network, deep learning-based
I. INTRODUCTION
food image recognition algorithms have particularly
proved useful.
There are many food categories in our daily routine
and differentiating among these categories based on Convolutional neural network is a method used for
image is a challenging task due to the diversity of visual recognition by computers[ CITATION
food categories [ CITATION hoashi2010image Yanai2015 \l 1033 ]. It is a kind of artificial
\l 1033 ]. Image recognition is a process in which neural network that comprises of different neurons
objects are detected or recognized in video or image where each neuron represents weights. CNNs have
[CITATION Abadi2016 \l 1033 ]. It is a played a very important role in image recognition and
simple process for humans but not an easy one for classification [ CITATION Chen2016 \l
computers. Humans can easily recognize a cup, an 1033 ]. Image is given as an input and computer
apple, strawberry etc, but computer takes time to reads it in binary form. Then it is stored in form of
learn images and face problems in recognizing array and passed through convolutional and fully
objects in images. A lot of work in machine connected layers and then features of image are
learning’s domain has been done in order to solve learned using squares of input image. These provide
these problems [CITATION Abadi2016 \l support to develop models by training them on
1033 ]. datasets and perform classification from these models
[ CITATION ciocca2016food \l 1033 ].
Obesity and overweightness depends on body mass Image classification plays a vital role in providing
index (BMI). BMI is a measure of body fat based on support to development of different object detection
height and weight. Overweight and obesity result in
applications[ CITATION Liu2016 \l 1033 ].
more deaths than underweight[ CITATION
We present a food detection application which
Poonsri2016 \l 1033 ], so weight should be kept identifies the food item from image using
in control and for that it is important to know the convolutional neural network. After recognizing the
nutritional value of items that are being consumed. food item its nutrients information is displayed to
For image recognition, there are various techniques user on android interface. The application uses
like bag-of-features (BoF), color histogram, Gabor TensorFlow for visual recognition. We worked on
Page 1|6
two data set and accuracy and loss values have been algorithms. A dataset of 3616 images belonging on
calculated. 73 food classes. The best performance has been
obtained by using Convolution-Neural-Networks-
The Section II of paper describes literature review based features. The dataset UNIMIB2015, as well as
and Section III describes analysis of UEC-100 and the benchmark framework, are made available to the
ImageNet. In Section IV proposed methodology for research community.
development of application is explain and Section V
concludes the paper and future work is presented in For calculating nutrients using food images (Kawano
Section VI. Table 4 discusses different methods for & Yanai, 2013) purpose region of food image is
image recognition and classification. segmented by GrubCut, then color histogram is
extracted and SURF based on bag-of-features is
applied. The result finding of this application shows
81.55% classification rate is achieved.
Page 2|6
extracted and display to user. The application also analysis. Following eight categories are selected from
calculates body mass index by inserting height and both datasets to train them:
weight of a user. The purpose of BMI is to control Burger
the weight along with checking nutrients of meal Sandwich
taken. Both nutrients calculation and BMI plays very Toast
important role in taking care of health. Fried rice
Steak
Android Based Application: Pizza
Egg roll and
Today the need of era is that we should have
Rice.
enough information about how much healthy diet is
Now there are total 14 categories, seven categories of
our intake and what number of calories and nutrients’
each dataset. Every category of food contains 100
content are in there. But it is very difficult and time
food images in train directory and 10 images in
consuming for a person to manually records nutrients
validate/test directory.
and calories of food every time, he/she eats. Today
Classification of Train and Validate Directories:
technology has made it possible to automatically
detect food items and display information of nutrients
to user by making few swipes on phone.
The proposed android based food detection
application named “Smart Food” was implemented
keeping in mind the objective that by using it, people
can have health diet plan. The application provides
facility to a user to automatically detects food item by
just giving image to application and then displays
nutrients of that food item. Application uses the
concept of image recognition. It uses the method of
learning image features first and then detecting what
food item is. User can easily get percentage of
nutrients and then he/she can thinks of how healthy
the food is, is it beneficial to take or not, or how to
balance food quantity with health. Calories play a
major role in effecting ones’ weight. Keeping this
thing in mind, the user can also calculate Body Mass
Index to seek his/her weight information and manage Fig 1: Flow Diagram
diet accordingly. The diet plan can efficiently The results of application are shown below:
manage with the combination of BMI and nutrients
information. The application can also be used in
hospitals by patients in order to refrain from taking
food that is not suitable for their health.
Dataset:
UEC-100 and Image net images were used for
training purpose.
UEC-100
UEC-100 contains 100 kinds of food photos, where
each category of food includes 100 food images.
ImageNet (Food Synonyms sets)
ImageNet contains 1000,000 different synonyms sets
(synsets) organized in accordance with WordNet
hierarchy. Each synset in ImageNet contains average
1000 images. The images in this dataset represent
different categories such as animals, furniture, plant,
instrument, food etc. The paper mainly focuses on
food items, so eight synsets images are downloaded
by first registering to ImageNet repository.
After downloading, both datasets are observed and
common categories are chosen for first phase of
Page 3|6
Fig 2: Food Detection
Fig 5: Classification Process
Page 4|6
V. CONCLUSION
In this paper, first analysis of UEC-100 and
ImageNet has been discussed and then android based
food detection application is proposed. Analysis has
been done by training UEC-100 and ImageNet by
using CNN. The task of training has been
accomplished using machine intelligence library
called TensorFlow and image classification library
called Keras. Results of trained models shows that
UEC-100 dataset has shown good loss values when
validated with ImageNet images as loss values
become negative but accuracy values are are not
higher than 10% of all phases. The second
methodology is on development of food Detection
Android Application that detects food image given by
user using 16 layers neural network model named
VGG-16 and displays nutrients of detected food.
BMI helps a person to manage his/her weight and
BMI works best along with nutrients information of
food items. Results shows that Application has
successfully recognized different food items such as
strawberry, banana, cucumber and has displays
nutrients accordingly
VI. FUTURE WORK
Fig. 7: Analysis Model In future, it is aim to use own model in application
detection module by first training it from scratch
Results of first two phases of models of both datasets using specific categories of food such as meat, rice,
are quiet similar but in phase II, loss values of model fruits, vegetables, grains, fast food etc. The analysis
become more negative in phase 2 with ImageNet can also be done on more than two food datasets to
validation data, which means that UEC-100 has analyze the results of CCN for food recognition and
achieved good validation when tested On ImageNet classification. This will give accurate results of
categories. The results of accuracy and loss values of specific categories of food thus providing more
all three phases are mentioned in Table 1, Table 2 satisfaction related to health.
and Table 3.
TABLE 1: LOSS AND ACCURACY RESULTS OF UEC-100 AND
IMAGENET (ANALYSIS PHASE I)
REFERENCES
[1] Hoashi, H., Joutou, T., & Yanai, K. (2010). Image recognition
of 85 food categories by feature fusion. Multimedia (ISM), 2010
IEEE International Symposium on, (pp. 296-301).
TABLE 2: LOSS AND ACCURACY RESULTS OF UEC-100 AND
IMAGENET VALIDATION
[2] Abadi, Ms., Barham, P., Chen, J., Chen, Z., Davis, A., Dean, J.,
others. (2016). TensorFlow: A system for large-scale machine
learning. Proceedings of the 12th USENIX Symposium on
Operating Systems Design and Implementation (OSDI). Savannah,
TABLE 3: LOSS AND ACCURACY RESULTS OF UEC-100 AND Georgia, USA.
IMAGENET
[3] Bosch, M., Zhu, F., Khanna, N., Boushey, C. J., & Delp, E. J.
(2011). Combining global and local features for food identification
in dietary assessment. Image Processing (ICIP), 2011 18th IEEE
International Conference on, (pp. 1789-1792).
Page 5|6
[3] Chen, T., Li, M., Li, Y., Lin, M., Wang, N., Wang, M. . . . tuning. Multimedia \& Expo Workshops (ICMEW), 2015 IEEE
Zhang, Z. (2015). Mxnet: A flexible and efficient machine learning International Conference on, (pp. 1-6).
library for heterogeneous distributed systems. arXiv preprint
[15] Yang, S., Chen, M., Pomerleau, D., & Sukthankar, R. (2010).
arXiv:1512.01274.
Food recognition using statistics of pairwise local features.
[4] Chen, Y., Zhao, D., Lv, L., & Li, C. (2016). A visual attention Computer Vision and Pattern Recognition (CVPR), 2010 IEEE
based convolutional neural network for image classification. Conference on, (pp. 2249-2256).A.R. S Bahai and B.R. Saltzberg,
Intelligent Control and Automation (WCICA), 2016 12th World Multi-Carrier Digital Communications Theory and Applications of
Congress on, (pp. 764-769). OFDM, Kluwer Academic Publishers, New York, 1-221, 2002.
[6] Girshick, R., Donahue, J., Darrell, T., & Malik, J. (2014). Rich
feature hierarchies for accurate object detection and semantic
segmentation. Proceedings of the IEEE conference on computer
vision and pattern recognition, (pp. 580-587).
[8] Jia, Y., Shelhamer, E., Donahue, J., Karayev, S., Long, J.,
Girshick, R. Darrell, T. (2014). Caffe: Convolutional architecture
for fast feature embedding. Proceedings of the 22nd ACM
international conference on Multimedia, (pp. 675-678).
[10] Liu, C., Cao, Y., Luo, Y., Chen, G., Vokkarane, V., & Ma, Y.
(2016). Deepfood: Deep learning-based food image recognition for
computer-aided dietary assessment. International Conference on
Smart Homes and Health Telematics, (pp. 37-48).
[12] Pouladzadeh, P., Kuhad, P., Peddi, S. V., Yassine, A., &
Shirmohammadi, S. (2016). Food calorie measurement using deep
learning neural network. Instrumentation and Measurement
Technology Conference Proceedings (I2MTC), 2016 IEEE
International, (pp. 1-6).
Page 6|6