«by Sri Vijay Bharat Peddi Thesis submitted to the Faculty of Graduate and Postdoctoral Studies In partial fulfillment of the requirements For the ...»
Cloud Computing Frameworks for Food
Recognition from Images
Sri Vijay Bharat Peddi
Thesis submitted to the
Faculty of Graduate and Postdoctoral Studies
In partial fulfillment of the requirements
For the degree of Masters of Applied Science in
Electrical and Computer Engineering
Ottawa-Carleton Institute for Electrical and Computer Engineering
School of Electrical Engineering and Computer Science
University of Ottawa
© Sri Vijay Bharat Peddi, Ottawa, Canada, 2015
Distributed cloud computing, when integrated with smartphone capabilities, contribute to building an efficient multimedia e-health application for mobile devices.
Unfortunately, mobile devices alone do not possess the ability to run complex machine learning algorithms, which require large amounts of graphic processing and computational power. Therefore, offloading the computationally intensive part to the cloud, reduces the overhead on the mobile device. In this thesis, we introduce two such distributed cloud computing models, which implement machine learning algorithms in the cloud in parallel, thereby achieving higher accuracy. The first model is based on MapReduce SVM, wherein, through the use of Hadoop, the system distributes the data and processes it across resizable Amazon EC2 instances. Hadoop uses a distributed processing architecture called MapReduce, in which a task is mapped to a set of servers for processing and the results are then reduced back to a single set. In the second method, we implement cloud virtualization, wherein we are able to run our mobile application in the cloud using an Android x86 image. We describe a cloud-based virtualization mechanism for multimedia-assisted mobile food recognition, which allow users to control their virtual smartphone operations through a dedicated client application installed on their smartphone. The application continues to be processed on the virtual mobile image even if the user is disconnected for some reason. Using these two distributed cloud computing models, we were able to achieve higher accuracy and reduced timings for the overall execution of machine learning algorithms and calorie measurement methodologies, when implemented on the mobile device.
ii Acknowledgements I am very grateful to Prof. Shervin Shirmohammadi, who gave me the incredible opportunity of being part of a research project that has excited and inspired me from day one.
He has also offered me research assistantship to support my studies, provided all the equipment necessary for my experiments and directed me towards the right path to make the right choices in my research and career.
I would like to take this opportunity to also thank all of my teammates, including Dr. Abdulsalam Yassine, Pallavi Kuhad, and Parisa, who have been vital in the success of my thesis. I am very fortunate to be part of this enthusiastic team, with which I always enjoy working. We have achieved some amazing heights together. I am also very appreciative of the kind support from Dr. Abdulsalam Yassine, who always shared some great insights into our project and made it successful. I have learned a lot in the company of Parisa, who has always been supportive and shared knowledge from her experiences. I would also like to thank Pallavi, who was also completing her Master’s along with me and has been an incredible person to work with. She was always full of novel ideas and a passion that drove her to bring some unique perspectives to the table.
allowing them to turn into ones that were viable for implementation.
I would also like to thank all of the members of the Discover Lab. Being a part of this lab gave me this unique opportunity to witness some interesting projects, which always motivated me in my own work.
I would like thank my parents, who have always been caring and supportive in my decision to pursue a Master’s degree in Canada. My Dad, who is a scientific researcher himself, always contributed novel ideas and encouraged me to think differently. I’d also like to thank my younger brother Sharat, who always enjoyed talking to me about my thesis and who shared some out-of-the-box opinions that encouraged me to pursue my thesis.
iv Table of Content
Table of Content
List of Figures
List of Tables
1.2 Problem Statement
1.3 Thesis Goals
1.4 Thesis Contributions
1.5 Research Publications
1.6 Thesis Organization
2.1 Distributed Cloud Computing Model
2.1.1 MapReduce Model
2.1.2 Cloud Virtualization
2.1.3 Types of Virtualization
3.1 Cloud Computing Models for Healthcare Applications
3.2 Mobile Cloud Computing Models
3.2.1 MapReduce Models and Traditional Client Server Models
3.2.2 Mobile Cloud Virtualization Models
3.3 Conclusion of the Related Work
4. Proposed Method
4.1 MapReduce as a Parallel Classifier for Recognizing Food Objects
4.2 MapReduce-based Mobile Cloud Computing Model
4.2.1 Cloud Components
4.3 Cloud-Based Virtualization
4.3.1 Android and Android x86
4.3.2 KVM QEMU Cloud-Based Virtualization
4.3.4 Cloud Virtualization Components
4.3.5 One-Way Virtual Swap
4.3.6 Two-Way Virtual Swap of Foreground/Background sessions between Mobile and Cloud
5. Implementation Design
5.1 Implementation of MapReduce Train and MapReduce Test on Amazon EC2 Instances
5.1.1 Software & Development Configurations
5.1.2 MapReduce Implementation
5.2 Implementation of the Virtualization Framework in a Mobile Environment........... 55 5.2.1 Hardware Configurations
5.2.2 Flow Charts of the Cloud Based Virtualization Model
5.2.3 Decision Making Algorithm and Multiple Object Detection
6. Evaluation Result
6.1 MapReduce Results
6.2 Processing Time of Various Cloud Instances
6.3 Processing Time for Cloud Virtualization & Intelligent Decision Mechanism.......... 67 6.4 Energy Consumption
7.2 Future Work
Figure 2: Memory Virtualization
Figure 3: Hadoop Integration on Amazon EC2/AWS
Figure 4: MapReduce-based Mobile Cloud Architecture.
Figure 5: Cloud-based KVM Virtualization Model for EHSH
Figure 6: Hardware-Assisted Android Emulator
Figure 7: Android x86 Images with KVM on Linux
Figure 8: Android x86 Image 1 Configuration Details.
Figure 9: Implementation of One-Way Android Virtualization
Figure 10: Virtual Swapping of Foreground and Background Session between Cloud and Mobile Session
Figure 11: Cloud Components of e-Health Application (EHSH) 
Figure 12: Flow Chart for Enabling Hardware-Assisted KVM Virtualization.
Figure 13: Flow Chart for Running Android Emulator with Hardware Acceleration............. 58 Figure 14: Mobile Cloud Virtualization Architecture
Figure 15: SLOTS_MILLIS_MAPS and SLOTS_MILLIS_REDUCES based on different cluster sets .
Figure 16: Time Comparison between Calorie Measurement vs. Food Name.
Figure 17: Comparison between time taken and proposed methods
Figure 18: Comparison Based on CPU Utilization of the e-Health Application.
Table 2: Virtualization Components for the e-Health Application
Table 3: Steps to Implement the MapReduceSVM code on the local host.
Table 4: Comparison of Time Used by MapReduce for Various Cluster Nodes ................ 66 Table 5: Comparison of the results of the application processing times 
Table 6: Percentage improvement in processing times 
High calorie intake has a severe impact on people’s health. Studies show that a number of diseases are a result of excessive calorie intake by humans. High calorie values in food that is nutritionally poor leads to systemic inflammation, reduced insulin sensitivity, and clusters of metabolic abnormalities, including obesity, hypertension, dyslipidemia, and glucose intolerance . From these facts, we can conclude that excessive calories, when consumed through food, are harmful to the human body and need to be kept in check.
One way to keep a check on calorie intake is by using applications installed in smartphones, which can help users monitor their calorie consumption. Smartphones have become an integral part of people’s daily lives. People are dependent on smartphones for communication, shopping via mobile websites (m-commerce), and even for maintaining their health and fitness. With advancements in smartphone’s hardware capabilities, a number of new and improved sensors have been built into smartphones, further empowering developers to create applications that make efficient use of these sensor capabilities. Specifically the health and fitness applications have benefited significantly from these sensors. Fitness tracker applications on phones allow us to keep track of
we have run or biked, etc. However, there is still a need for applications that can assist us through a proactive approach of checking what we eat, how much to eat, and calorie intake.
To run such an application, a mobile phone should have the capacity to implement complex machine learning algorithms and calorie measurement techniques.
Although advancements in smartphone hardware have equipped them to handle parallel and complex processing, there is still the problem of the physical resources of mobile devices being limited, to some extent, when applications demand intensive computations. Cloud services, address these issues by offloading a portion of the processing to the cloud and by making use of cloud resources to efficiently run such complex algorithms.
1.2 Problem Statement One of the main problems we address is the limited ability of mobile phones to run complex, computing-intensive algorithms, like deep learning, calorie measurement applications, etc. Unfortunately, mobile devices alone do not possess the ability to run complex machine learning algorithms that require high amounts of graphic processing and computational power.
Another problem is that offloading content or processing to the cloud could impact the response times to users’ interactions with the mobile application. For example, it would take a mobile phone less time to switch from one mobile activity to another if everything
cloud involves several dependencies, such as the network quality, the bandwidth, the cloud vendor providing the services, the time it takes to start the cloud instances, the cost to maintain the cloud instances, and the requirements of the cloud administrator (in some scenarios). Hence, a standalone application would be faster in terms of response time to the user, since it wouldn’t be dependent on the above-mentioned cloud resources. However, it would be devoid of the computing power needed to run complex algorithms, such as in our scenario, which involves a requirement for complex algorithms that the mobile phone alone could not run.
During our implementation of the MapReduce model (which will be explained in further sections), we faced several issues. Firstly, the initial time needed to distribute the data and process it across resizable Amazon EC2 instances was considerably higher for smaller training sets of data. Secondly, the client-server architecture model required us to re-write the computer vision code to allow it to run in a cloud-based MapReduce environment.
While implementing our other cloud-based virtualization model, we faced major challenges in designing the virtualization architecture, which was otherwise easy to design on local server. During its design phase, we had to make use of virtualization extensions, and then create virtual images on the top of these extensions to give them an additional performance boost. Since we had to depend on cloud-based services from Amazon, we were limited by their services in terms of designing our virtualization architectures.
The goal of this work is to implement a distributed cloud computing model that will enable our smartphone application (Eat Healthy Stay Healthy, or EHSH) to offload a major part of its intensive computing to the cloud. We would like to explore two cloud computing models that could be integrated with existing smartphone capabilities to run our mobile application (EHSH). This would allow us to intelligently offload intensive computations from the smartphone to the cloud in a manner would make efficient use of both of systems’ capabilities. We also take into account the scalability of the application by further introducing the concepts of parallel computing and virtualization mechanism in the cloud.
We will investigate some of the issues that arise in the parallel computing model and how the cloud virtualization mechanism addresses them without affecting the overall functionality of the mobile application. In designing this model, we have taken into account its ability to run autonomously, without any user intervention (e.g., from the user using the phone or from the administrator), as well as its ability to make independent decisions (using a decision algorithm) regarding how to perform the computing.
We propose a parallel Support Vector Machine (SVM) training mechanism in a cloud computing environment, using the MapReduce technique to facilitate distributed machine learning used for recognizing food objects.