SlideShare ist ein Scribd-Unternehmen logo
1 von 48
ML Goes Fruitful Workshop
Preeti Negi, Deepika Sharma, Esha Ahuja, Sudhir Verma, Vikash Sharma
July 6, 2017
Plan for the workshop
• Introduction (40 min)
[Machine Learning, ANN, Architecture, Key Takeaways,
Image Classification using TensorFlow]
• Problem Statement (10 min)
[Object Detection Case Study for fruit salad.]
• Hands-On End to End Solution (110 min)
[Training and Testing the model, Studying the analytics,
Optimizing the trained model]
• Conclusion (20 min)
[Summary,Experience (Challenges) sharing by speakers]
Fig: Manual to Automation using Machine Learning
Pre-requisites for Participants
• Laptop (if possible install Android Studio for app
deployment)
Download Android Studio
• Android mobile or raspberry pi (optional) with camera
attached for the workshop.
• Project Source Code available at Github Link .
Key Takeaways and Learnings
• Learning of TensorFlow library, python, Docker, machine learning classification
techniques (parameters for testing accuracy), Raspberry Pi/mobile app.
• Implementation of business use case in food processing industry.
• Understanding the integration of varied technologies such as python, machine
learning, IoT, mobile etc.
• Gaining confidence in machine learning to identify more scenarios in different
industry domains.
• Feeling of achievement by creating end to end machine learning fruit detection
application.
• Gaining insights in the latest trends in technologies.
• Healthcare- identifying diseases like tumors, diabetes, cancer
etc.
• Food Sector- provide useful information like nutritional value,
quality etc. of the fruits and vegetables.
• Agriculture Sector- identifying crop diseases or automation of
sorting, segregation and packaging.
• Retail- identifying the quality of the products and remov
defective products.
Vision and Business Use Cases Identified
Introduction
Machine learning is the subfield of computer science that, gives
"computers the ability to learn without being explicitly programmed."
Approaches :
• General Algorithms
• Artificial neural networks (ANN or NN)
• Reinforcement learning
• Support vector machines
• Clustering etc.
ML Algorithms can perform for e.g. the following tasks:
Image Classification, Face Recognition, Cancer Detection,
Age estimating, Play Chess etc.
Neural Network
What is a neural network (NN)
• In computer science Artificial Neural Network
is a principal copy of the brain
• It consists of many neurons
• Mostly it is a “autonomous” system
What are the tasks of NNs
• It only has ONE Job … It makes decisions
Average human makes 35 000 decisions a day
• ANNs use the same schema
ANNs make decisions based on given input
Closer look at the business case
Food Processing industry: To cater to the high demand of
automation in food processing industry, machine learning
object detection plays a vital role in the production. For this
workshop, we propose the fruit-salad processing scenario.
We trained image classification model using TensorFlow Lib.
We optimized the trained model to fit mobile/RaspberryPi
performing live actions(fruit detection using camera).
Process
Task: build object detection machine learning model using
Google TensorFlow Library
• Build an Image Classification using Google TensorFlow.
• Use Inception v3 network to retrain on example fruits:
Apple, Mango, Watermelon and Strawberry.
• Use python to train the image classifier.
• Classify images with trained classifier.
• Run TensorFlow on mobile device or raspberry pi.
Skills:
• Identify different fruits pictures.
• It is pretrained to identify-
Apples, Strawberries, Mangoes and
Watermelons.
Properties:
• Convolutional neural network (CNN)
• Based on Inception-V3(Powerful CNN
Structure)
• Uses TensorFlow
• Runs inside a Docker Container
• Uses transfer learning
• You can retrain it on fruits.
Fruit Detection with ANN
Docker
• Docker is the world’s leading software container platform.
• The demo can be used comfortably on several platforms.
• Demo runs in a Ubuntu Container (Virtual Machine).
TensorFlow
• An open-source software library for Machine Intelligence. It is
a framework for deep-learning
• Open Source(developed by google)
• Python Programming
Camera App to run Tensorflow
• Optimize your model.
• Compress your model.
• Run it in a pre-made Android app /Raspberry Pi.
Docker- TensorFlow – Android / RaspberryPi
Architecture
Workshop Hands on
Docker Setup
• Install Docker from the link: Install Docker
• Download from Docker Store.
Docker Setup
• Install
 Double-click InstallDocker.msi to run the installer.
 When the installation finishes, Docker starts automatically. The whale in the notification
area indicates that Docker is running, and accessible from a terminal.
• Run
 Open a command-line terminal. Run docker run hello-world to verify that Docker can pull
and run images.
TensorFlow Setup
• Install:
 After downloading your prompt should change to root@xxxxxxx:/notebooks#
 Next check to confirm that your TensorFlow installation works by invoking Python from the
container's command line:
TensorFlow Setup
• Run
 When python prompt, >>>, run the following code:
 This should print Hello TensorFlow!
• Exit
 Press Ctrl-d, on a blank line, once to exit python, and a second time to exit the docker image.
Relaunch Docker
• Create the working directory tf_files
• Relaunch Docker with above directory, and port number
6006 published for TensorBoard:
• Your prompt will change to root@xxxxxxxxx:/tf_files#
Retrieving Images - Github
• Extract the downloaded
project and extract all the zip
folders inside the project.
• Download project from Github
Link in zip format.
Retrieving Images – Github
• Move folders apple,
mango, strawberry and
watermelon to
fruits_train folder.
• Create a new folder
tf_files in C:/
• Move fruits_train,
fruits_test and
fruitClassify.py to tf_files
folder.
Retrieving Images - Docker
• Note the name of latest container in use for Docker.
• Copy the training data from local system to Docker:
Verifying Images in Docker
• Run the docker and verify the contents for tf_files
• Try the ls commands to validate the presence of training
images.
 ls apple
 ls mango , etc
(Re)training Inception
• Download retrain script manually to the current directory:
• Before starting the training, launch Tensorboard in the
background so you can monitor the training progress.
(Re)training Inception
• At this point, we have a trainer, we have data, so let's train!
We will train the Inception v3 network
• This step gives the final test accuracy after creation of
bottlenecks.
Trained model in TensorBoard
TensorBoard Graphs
Using the Retrained Model
• Retraining script will write out a version of the Inception v3
network with a final layer retrained to your categories to
tf_files/retrained_graph.pb and a text file containing the
labels to tf_files/retrained_labels.txt
• To copy the fruits_test data and label_image.py to docker,
identify the latest container for docker first:
Classifying Script in Docker
• Copying fruits_test data and label_image.py to Docker
• Displaying contents for tf_files in Docker:
Classifying an Image
• Run the Python file and pass the image path as test data.
The script will classify the image for us.
Deployment- Client side
Limitations for Mobile Device / Raspberry Pi
• Memory Constraints
• Computation power
Challenges :
• Memory overflow if we run the retrained graph directly without
optimization for both mobile device and raspberry.
• Performance issues in system when parameters like flip are
extensively used in re-training model.
Limitations / Challenges
Deployment on Android phone :
1. Copy the folder tf_android into docker
2. Launch docker with the directory tf_android
Steps:
3. Test the model
4. Optimize the model
Steps:
5. Test the optimized model
6. Compress the model
Steps:
7. Quantize the network weights
8. Compress the quantized model
Steps:
9. Test the quantized compressed model
Steps:
10. Copy the graphs into the system folder android/assets/
11. Install Android Studio
Download
Step 12 : Android Phone Configuration
• Activate developer mode and usb debugging
• Settings->About Phone
• Scroll down to Build number
• Tap 7 times the build number to enable developer option
• You will see the message “you are now a developer”.
• Click back button-> you will see developer option -> enable USB
debugging
Steps: continued.
13. Open an existing android studio project
14. Select Android folder from tf_android
15. Gradle-sync the project
16. Connect the android phone using USB
17. Click on run in android studio.
18. Select the phone and run the app.
Live Demo Mobile App
• Mango
• 0.9976017
• Apple
• 0.9934278
Deployment on Raspberry
• Raspberry Pi 2 Model B V1.1
• Raspbian GNU/Linux 8
• Python 2.7.9
Steps:
1. Install the dependencies for Tensorflow:
2. Download tensorflow from Link
Steps:
3. Install Tensorflow
4. Re-install mock library
Steps:
5. Run the script label_image.py to test the model.
Final Test Accuracy
About Speakers
Preeti Negi:
Preeti has 9 years of industry experience with SAP Labs India Pvt. Ltd. She has worked on
innovation projects- Simplify Predictive Analytics for multiple industries solutions, Machine
Learning Image classification for fruit detection, Optimizing the usage of Learning Rooms
through IoT Solutions, Contract Approval SAP Fiori app.
Preeti was the speaker at various events:
SAP HANA & IoT Meet-Up Event 2016, SAP d-kom 2015 Silicon Valley (US), Official trainer for
‘Effective Communication with customers and colleagues’ workshops, Empowering Workshop
for Israel Customer.
Deepika Sharma
Deepika Sharma has 4 years of experience with SAP Labs India Pvt. Ltd. She has worked on
projects related to Internet of Things and Image Classification using Google Tensorflow.
About Speakers
Esha Ahuja:
Esha has been working in industry for 4 years. She has also worked on multiple development
projects & offered an internet of things solution as in-house project.
Esha was speaker at:
Delhi-NCR meet-up workshop in internet of things, hands-on workshop on SAP UI5 technology,
an official trainer for Fiori Advanced Development, SAP d-Kom event Bangalore.
Sudhir Verma
Linkedin Profile
Vikash Sharma
Vikash is working with SAP Labs India Pvt. Ltd. for almost 8 years. His functional and technical
expertise is in SAP GRC and SAP ABAP language. He has also worked on SAP HANA and he had
developed innovative, real time, SAP HANA based application i.e. SAP Rakshak 2.0. Vikash was
speaker multiple workshops and info pods for customers.
Thank you.
Preeti Negi, Deepika Sharma, Esha Ahuja, Sudhir
Verma, Vikash Sharma

Weitere ähnliche Inhalte

Ähnlich wie Ml goes fruitful

Django Article V0
Django Article V0Django Article V0
Django Article V0
Udi Bauman
 
Cis247 a ilab 1 of 7 creating a user interface
Cis247 a ilab 1 of 7 creating a user interfaceCis247 a ilab 1 of 7 creating a user interface
Cis247 a ilab 1 of 7 creating a user interface
cis247
 
Cis247 i lab 1 of 7 creating a user interface
Cis247 i lab 1 of 7 creating a user interfaceCis247 i lab 1 of 7 creating a user interface
Cis247 i lab 1 of 7 creating a user interface
sdjdskjd9097
 
Machine Learning , Analytics & Cyber Security the Next Level Threat Analytics...
Machine Learning , Analytics & Cyber Security the Next Level Threat Analytics...Machine Learning , Analytics & Cyber Security the Next Level Threat Analytics...
Machine Learning , Analytics & Cyber Security the Next Level Threat Analytics...
PranavPatil822557
 
Cis247 i lab 1 of 7 creating a user interface
Cis247 i lab 1 of 7 creating a user interfaceCis247 i lab 1 of 7 creating a user interface
Cis247 i lab 1 of 7 creating a user interface
sdjdskjd9097
 
Neural_Programmer_Interpreter
Neural_Programmer_InterpreterNeural_Programmer_Interpreter
Neural_Programmer_Interpreter
Katy Lee
 
Cis247 a ilab 1 of 7 creating a user interface
Cis247 a ilab 1 of 7 creating a user interfaceCis247 a ilab 1 of 7 creating a user interface
Cis247 a ilab 1 of 7 creating a user interface
ccis224477
 

Ähnlich wie Ml goes fruitful (20)

Scalable TensorFlow Deep Learning as a Service with Docker, OpenPOWER, and GPUs
Scalable TensorFlow Deep Learning as a Service with Docker, OpenPOWER, and GPUsScalable TensorFlow Deep Learning as a Service with Docker, OpenPOWER, and GPUs
Scalable TensorFlow Deep Learning as a Service with Docker, OpenPOWER, and GPUs
 
Enterprise PHP (PHP London Conference 2008)
Enterprise PHP (PHP London Conference 2008)Enterprise PHP (PHP London Conference 2008)
Enterprise PHP (PHP London Conference 2008)
 
Django Article V0
Django Article V0Django Article V0
Django Article V0
 
iPhone App from concept to product
iPhone App from concept to productiPhone App from concept to product
iPhone App from concept to product
 
Creating a Custom ML Model for your Application - Kotlin/Everywhere
Creating a Custom ML Model for your Application - Kotlin/EverywhereCreating a Custom ML Model for your Application - Kotlin/Everywhere
Creating a Custom ML Model for your Application - Kotlin/Everywhere
 
Cis247 a ilab 1 of 7 creating a user interface
Cis247 a ilab 1 of 7 creating a user interfaceCis247 a ilab 1 of 7 creating a user interface
Cis247 a ilab 1 of 7 creating a user interface
 
Cis247 i lab 1 of 7 creating a user interface
Cis247 i lab 1 of 7 creating a user interfaceCis247 i lab 1 of 7 creating a user interface
Cis247 i lab 1 of 7 creating a user interface
 
Tensorflow windows installation
Tensorflow windows installationTensorflow windows installation
Tensorflow windows installation
 
Machine Learning , Analytics & Cyber Security the Next Level Threat Analytics...
Machine Learning , Analytics & Cyber Security the Next Level Threat Analytics...Machine Learning , Analytics & Cyber Security the Next Level Threat Analytics...
Machine Learning , Analytics & Cyber Security the Next Level Threat Analytics...
 
Machine learning in cybersecutiry
Machine learning in cybersecutiryMachine learning in cybersecutiry
Machine learning in cybersecutiry
 
Python Open CV
Python Open CVPython Open CV
Python Open CV
 
AWS DeepLens Workshop: Building Computer Vision Applications - BDA201 - Atlan...
AWS DeepLens Workshop: Building Computer Vision Applications - BDA201 - Atlan...AWS DeepLens Workshop: Building Computer Vision Applications - BDA201 - Atlan...
AWS DeepLens Workshop: Building Computer Vision Applications - BDA201 - Atlan...
 
Autonomous Machines with Project Bonsai
Autonomous Machines with Project BonsaiAutonomous Machines with Project Bonsai
Autonomous Machines with Project Bonsai
 
Cis247 i lab 1 of 7 creating a user interface
Cis247 i lab 1 of 7 creating a user interfaceCis247 i lab 1 of 7 creating a user interface
Cis247 i lab 1 of 7 creating a user interface
 
Neural_Programmer_Interpreter
Neural_Programmer_InterpreterNeural_Programmer_Interpreter
Neural_Programmer_Interpreter
 
Android Development recipes with java.pptx
Android Development recipes with java.pptxAndroid Development recipes with java.pptx
Android Development recipes with java.pptx
 
Cis247 a ilab 1 of 7 creating a user interface
Cis247 a ilab 1 of 7 creating a user interfaceCis247 a ilab 1 of 7 creating a user interface
Cis247 a ilab 1 of 7 creating a user interface
 
Closer To the Metal - Why and How We Use XCTest and Espresso by Mario Negro P...
Closer To the Metal - Why and How We Use XCTest and Espresso by Mario Negro P...Closer To the Metal - Why and How We Use XCTest and Espresso by Mario Negro P...
Closer To the Metal - Why and How We Use XCTest and Espresso by Mario Negro P...
 
OpenCV @ Droidcon 2012
OpenCV @ Droidcon 2012OpenCV @ Droidcon 2012
OpenCV @ Droidcon 2012
 
Cypress report
Cypress reportCypress report
Cypress report
 

Kürzlich hochgeladen

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Kürzlich hochgeladen (20)

Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 

Ml goes fruitful

  • 1. ML Goes Fruitful Workshop Preeti Negi, Deepika Sharma, Esha Ahuja, Sudhir Verma, Vikash Sharma July 6, 2017
  • 2. Plan for the workshop • Introduction (40 min) [Machine Learning, ANN, Architecture, Key Takeaways, Image Classification using TensorFlow] • Problem Statement (10 min) [Object Detection Case Study for fruit salad.] • Hands-On End to End Solution (110 min) [Training and Testing the model, Studying the analytics, Optimizing the trained model] • Conclusion (20 min) [Summary,Experience (Challenges) sharing by speakers] Fig: Manual to Automation using Machine Learning
  • 3. Pre-requisites for Participants • Laptop (if possible install Android Studio for app deployment) Download Android Studio • Android mobile or raspberry pi (optional) with camera attached for the workshop. • Project Source Code available at Github Link .
  • 4. Key Takeaways and Learnings • Learning of TensorFlow library, python, Docker, machine learning classification techniques (parameters for testing accuracy), Raspberry Pi/mobile app. • Implementation of business use case in food processing industry. • Understanding the integration of varied technologies such as python, machine learning, IoT, mobile etc. • Gaining confidence in machine learning to identify more scenarios in different industry domains. • Feeling of achievement by creating end to end machine learning fruit detection application. • Gaining insights in the latest trends in technologies.
  • 5. • Healthcare- identifying diseases like tumors, diabetes, cancer etc. • Food Sector- provide useful information like nutritional value, quality etc. of the fruits and vegetables. • Agriculture Sector- identifying crop diseases or automation of sorting, segregation and packaging. • Retail- identifying the quality of the products and remov defective products. Vision and Business Use Cases Identified
  • 6. Introduction Machine learning is the subfield of computer science that, gives "computers the ability to learn without being explicitly programmed." Approaches : • General Algorithms • Artificial neural networks (ANN or NN) • Reinforcement learning • Support vector machines • Clustering etc. ML Algorithms can perform for e.g. the following tasks: Image Classification, Face Recognition, Cancer Detection, Age estimating, Play Chess etc.
  • 7. Neural Network What is a neural network (NN) • In computer science Artificial Neural Network is a principal copy of the brain • It consists of many neurons • Mostly it is a “autonomous” system What are the tasks of NNs • It only has ONE Job … It makes decisions Average human makes 35 000 decisions a day • ANNs use the same schema ANNs make decisions based on given input
  • 8. Closer look at the business case Food Processing industry: To cater to the high demand of automation in food processing industry, machine learning object detection plays a vital role in the production. For this workshop, we propose the fruit-salad processing scenario. We trained image classification model using TensorFlow Lib. We optimized the trained model to fit mobile/RaspberryPi performing live actions(fruit detection using camera).
  • 9. Process Task: build object detection machine learning model using Google TensorFlow Library • Build an Image Classification using Google TensorFlow. • Use Inception v3 network to retrain on example fruits: Apple, Mango, Watermelon and Strawberry. • Use python to train the image classifier. • Classify images with trained classifier. • Run TensorFlow on mobile device or raspberry pi.
  • 10. Skills: • Identify different fruits pictures. • It is pretrained to identify- Apples, Strawberries, Mangoes and Watermelons. Properties: • Convolutional neural network (CNN) • Based on Inception-V3(Powerful CNN Structure) • Uses TensorFlow • Runs inside a Docker Container • Uses transfer learning • You can retrain it on fruits. Fruit Detection with ANN
  • 11. Docker • Docker is the world’s leading software container platform. • The demo can be used comfortably on several platforms. • Demo runs in a Ubuntu Container (Virtual Machine). TensorFlow • An open-source software library for Machine Intelligence. It is a framework for deep-learning • Open Source(developed by google) • Python Programming Camera App to run Tensorflow • Optimize your model. • Compress your model. • Run it in a pre-made Android app /Raspberry Pi. Docker- TensorFlow – Android / RaspberryPi
  • 14. Docker Setup • Install Docker from the link: Install Docker • Download from Docker Store.
  • 15. Docker Setup • Install  Double-click InstallDocker.msi to run the installer.  When the installation finishes, Docker starts automatically. The whale in the notification area indicates that Docker is running, and accessible from a terminal. • Run  Open a command-line terminal. Run docker run hello-world to verify that Docker can pull and run images.
  • 16. TensorFlow Setup • Install:  After downloading your prompt should change to root@xxxxxxx:/notebooks#  Next check to confirm that your TensorFlow installation works by invoking Python from the container's command line:
  • 17. TensorFlow Setup • Run  When python prompt, >>>, run the following code:  This should print Hello TensorFlow! • Exit  Press Ctrl-d, on a blank line, once to exit python, and a second time to exit the docker image.
  • 18. Relaunch Docker • Create the working directory tf_files • Relaunch Docker with above directory, and port number 6006 published for TensorBoard: • Your prompt will change to root@xxxxxxxxx:/tf_files#
  • 19. Retrieving Images - Github • Extract the downloaded project and extract all the zip folders inside the project. • Download project from Github Link in zip format.
  • 20. Retrieving Images – Github • Move folders apple, mango, strawberry and watermelon to fruits_train folder. • Create a new folder tf_files in C:/ • Move fruits_train, fruits_test and fruitClassify.py to tf_files folder.
  • 21. Retrieving Images - Docker • Note the name of latest container in use for Docker. • Copy the training data from local system to Docker:
  • 22. Verifying Images in Docker • Run the docker and verify the contents for tf_files • Try the ls commands to validate the presence of training images.  ls apple  ls mango , etc
  • 23. (Re)training Inception • Download retrain script manually to the current directory: • Before starting the training, launch Tensorboard in the background so you can monitor the training progress.
  • 24. (Re)training Inception • At this point, we have a trainer, we have data, so let's train! We will train the Inception v3 network • This step gives the final test accuracy after creation of bottlenecks.
  • 25. Trained model in TensorBoard
  • 27. Using the Retrained Model • Retraining script will write out a version of the Inception v3 network with a final layer retrained to your categories to tf_files/retrained_graph.pb and a text file containing the labels to tf_files/retrained_labels.txt • To copy the fruits_test data and label_image.py to docker, identify the latest container for docker first:
  • 28. Classifying Script in Docker • Copying fruits_test data and label_image.py to Docker • Displaying contents for tf_files in Docker:
  • 29. Classifying an Image • Run the Python file and pass the image path as test data. The script will classify the image for us.
  • 31. Limitations for Mobile Device / Raspberry Pi • Memory Constraints • Computation power Challenges : • Memory overflow if we run the retrained graph directly without optimization for both mobile device and raspberry. • Performance issues in system when parameters like flip are extensively used in re-training model. Limitations / Challenges
  • 32. Deployment on Android phone : 1. Copy the folder tf_android into docker 2. Launch docker with the directory tf_android
  • 33. Steps: 3. Test the model 4. Optimize the model
  • 34. Steps: 5. Test the optimized model 6. Compress the model
  • 35. Steps: 7. Quantize the network weights 8. Compress the quantized model
  • 36. Steps: 9. Test the quantized compressed model
  • 37. Steps: 10. Copy the graphs into the system folder android/assets/ 11. Install Android Studio Download
  • 38. Step 12 : Android Phone Configuration • Activate developer mode and usb debugging • Settings->About Phone • Scroll down to Build number • Tap 7 times the build number to enable developer option • You will see the message “you are now a developer”. • Click back button-> you will see developer option -> enable USB debugging
  • 39. Steps: continued. 13. Open an existing android studio project 14. Select Android folder from tf_android 15. Gradle-sync the project 16. Connect the android phone using USB 17. Click on run in android studio. 18. Select the phone and run the app.
  • 40. Live Demo Mobile App • Mango • 0.9976017 • Apple • 0.9934278
  • 41. Deployment on Raspberry • Raspberry Pi 2 Model B V1.1 • Raspbian GNU/Linux 8 • Python 2.7.9
  • 42. Steps: 1. Install the dependencies for Tensorflow: 2. Download tensorflow from Link
  • 43. Steps: 3. Install Tensorflow 4. Re-install mock library
  • 44. Steps: 5. Run the script label_image.py to test the model.
  • 46. About Speakers Preeti Negi: Preeti has 9 years of industry experience with SAP Labs India Pvt. Ltd. She has worked on innovation projects- Simplify Predictive Analytics for multiple industries solutions, Machine Learning Image classification for fruit detection, Optimizing the usage of Learning Rooms through IoT Solutions, Contract Approval SAP Fiori app. Preeti was the speaker at various events: SAP HANA & IoT Meet-Up Event 2016, SAP d-kom 2015 Silicon Valley (US), Official trainer for ‘Effective Communication with customers and colleagues’ workshops, Empowering Workshop for Israel Customer. Deepika Sharma Deepika Sharma has 4 years of experience with SAP Labs India Pvt. Ltd. She has worked on projects related to Internet of Things and Image Classification using Google Tensorflow.
  • 47. About Speakers Esha Ahuja: Esha has been working in industry for 4 years. She has also worked on multiple development projects & offered an internet of things solution as in-house project. Esha was speaker at: Delhi-NCR meet-up workshop in internet of things, hands-on workshop on SAP UI5 technology, an official trainer for Fiori Advanced Development, SAP d-Kom event Bangalore. Sudhir Verma Linkedin Profile Vikash Sharma Vikash is working with SAP Labs India Pvt. Ltd. for almost 8 years. His functional and technical expertise is in SAP GRC and SAP ABAP language. He has also worked on SAP HANA and he had developed innovative, real time, SAP HANA based application i.e. SAP Rakshak 2.0. Vikash was speaker multiple workshops and info pods for customers.
  • 48. Thank you. Preeti Negi, Deepika Sharma, Esha Ahuja, Sudhir Verma, Vikash Sharma