SlideShare a Scribd company logo
1 of 37
Download to read offline
Husam Aamer
from
Image Recognition
Applications & Dataset Preparation
Did you see this before ?
•Cover violence or
nudity images
facebook app
AppChief
Did you see this before ?
•Suggests sharing
photos with
recognized facebook
friends
Moments app
AppChief
Did you see this before ?
•Search for photo
content in iOS and
Android
Photos
AppChief
Did you see this before ?
•Cutting out a person
from an image
Sticky app
Did you see this before ?
What is image recognition ?
How to build my own app ?
Why I need it ?
Is the ability of software to identify objects, places, people, writing and
actions in images.
labeling the content of images with meta-tags, performing image content
search and guiding autonomous robots, self-driving cars and accident
avoidance systems…etc
Next slides
How to build my own app ?
TRAIN THE MODEL
PREPARE DATASET
BUILD AND RUN
…
…
What do you need ?
PREPARE DATASET
Classify image ? Detect multiple objects
inside image ?
or
Image recognition types
&
IMAGE
CLASSIFICATION
OBJECT
DETECTION
PREPARE DATASET
vs
OBJECT
DETECTION
input
output
Image Image
Class labelsClass label
OBJECT
DETECTION
INSTANCE
SEGMENTATION
types
+
bounding box
+
bounding boxes
+
segmentation
PREPARE DATASET
Image recognition types
-
IMAGE
CLASSIFICATION
CLASSIFICATION
CLASSIFICATION
+ LOCALIZATION
vs
IMAGE
CLASSIFICATION
OBJECT
DETECTION
CLASSIFICATION
CLASSIFICATION
+ LOCALIZATION
OBJECT
DETECTION
INSTANCE
SEGMENTATION
types
PREPARE DATASET
Image recognition types
Example
vs
IMAGE
CLASSIFICATION
OBJECT
DETECTION
CLASSIFICATION
CLASSIFICATION
+ LOCALIZATION
OBJECT
DETECTION
INSTANCE
SEGMENTATION
types
PREPARE DATASET
Image recognition types
WE
WILL
CONTINUE
WITH
OBJECT
DETECTION
Let’s create a money reader model
STEP 1. Naming objects (Object labels)
PREPARE DATASET / OBJECT DETECTION
1 IQD_50000_ar
3 IQD_25000_ar
5 IQD_10000_ar
7 IQD_5000_ar
9 IQD_1000_ar
11 IQD_500_ar
13 IQD_250_ar
2 IQD_50000_en
4 IQD_25000_en
6 IQD_10000_en
8 IQD_5000_en
10 IQD_1000_en
12 IQD_500_en
14 IQD_250_en
Let’s create a money reader model
STEP 2. Take photos for each money face AS MUCH AS YO CAN
PREPARE DATASET / OBJECT DETECTION
For better accuracy take hundreds of photos with
• Different backgrounds

• Different positions

• Different light conditions

• Different orientations
Let’s create a money reader model
PREPARE DATASET / OBJECT DETECTION
• Different backgrounds

• Different positions

• Different light conditions

• Different orientations
STEP 2. Take photos for each money face AS MUCH AS YO CAN
STEP 2. Take photos for each money face AS MUCH AS YO CAN
Let’s create a money reader model
PREPARE DATASET / OBJECT DETECTION
Let’s create a money reader model
2. Take about 300 photos for each money face
PREPARE DATASET / OBJECT DETECTION
Let’s create a money reader model
2. Take about 300 photos for each money face
PREPARE DATASET / OBJECT DETECTION
Let’s create a money reader model
2. Take about 300 photos for each money face
PREPARE DATASET / OBJECT DETECTION
Let’s create a money reader model
STEP 3. Labeling objects inside images
PREPARE DATASET / OBJECT DETECTION
Label : IQD_50000_en
x : 6
y : 120
width : 150
heigh : 370
Objects :
Object #1
Let’s create a money reader model
STEP 3. Labeling objects inside images
PREPARE DATASET / OBJECT DETECTION
Label : IQD_50000_en
x : 90
y : 125
width : 313
heigh : 313
Objects :
Object #1
CAUTION : Some training libraries prefers different coordinates system in labeling
PREPARE DATASET / OBJECT DETECTION
X, Y, Width , Height midX, midY, Width , Height
minX, minY, maxX , maxY
It’s recommended to check the library needs you want to use for training before start labeling
How many photos do you think we need
for each label ?
PREPARE DATASET / OBJECT DETECTION
10 ?
20 ?
50 ?
100 ?
200 ?
300 ?
Assuming 300 photos
is good for our model
let’s calculate time required
PREPARE DATASET / OBJECT DETECTION
300 image x 14 Label x (5 sec) taking photo x (30 sec) labeling
175 hours !!! 7 Days !
We made a timesaving app
PREPARE DATASET / OBJECT DETECTION
Only 1 hour
300 image x 14 Label x (5 sec) taking photo x (60 sec) labeling
50 image x 14 Label x (5 sec) taking photo x (0 sec) labeling
PREPARE DATASET / OBJECT DETECTION
1 2 3Create labels Capture Generate
PREPARE DATASET / OBJECT DETECTION
3 Transfer
Easy Dataset
PREPARE DATASET / OBJECT DETECTION
Demo time
Easy Dataset
PREPARE DATASET / OBJECT DETECTION
Money Reader - ‫العملة‬ ‫قارئ‬
Final live app
Final dataset
kaggle.com/husamaamer/iraqi-currency-
~1 GB
Iraqi Money ‫العراقية‬ ‫العملة‬
Object detection dataset for Iraqi currency
MODEL TRAINING
import turicreate as tc
import os
# Define all images annotations with bounding box details (I am showing only 1)
annotations = tc.SArray([
[{
“label”:”5000ar",
“type":"rectangle",
“coordinates”:{“y":188.5,"x":207,"width":304,"height":152}
}],
… , … …
])
MODEL TRAINING
import turicreate as tc
import os
# Define all images annotations with bounding box details (I am showing only 1)
annotations = tc.SArray([
[{
“label”:”5000ar",
“type":"rectangle",
“coordinates”:{“y":188.5,"x":207,"width":304,"height":152}
}],
… , … …
])
# 1. Load images (Note: you can ignore 'Not a JPEG file' errors)
data = tc.image_analysis.load_images('mr_turi_ic', with_path=True)
data['label'] = data['path'].apply(lambda path: os.path.basename(os.path.dirname(path)))
data['annotations'] = tc.SArray(data=annotations, dtype=list)
MODEL TRAINING
import turicreate as tc
import os
# Define all images annotations with bounding box details (I am showing only 1)
annotations = tc.SArray([
[{
“label”:”5000ar",
“type":"rectangle",
“coordinates”:{“y":188.5,"x":207,"width":304,"height":152}
}],
… , … …
])
# 1. Load images (Note: you can ignore 'Not a JPEG file' errors)
data = tc.image_analysis.load_images('mr_turi_ic', with_path=True)
data['label'] = data['path'].apply(lambda path: os.path.basename(os.path.dirname(path)))
data['annotations'] = tc.SArray(data=annotations, dtype=list)
# Make a train-test split
train_data, test_data = data.random_split(0.8)
MODEL TRAINING
import turicreate as tc
import os
# Define all images annotations with bounding box details (I am showing only 1)
annotations = tc.SArray([
[{
“label”:”5000ar",
“type":"rectangle",
“coordinates”:{“y":188.5,"x":207,"width":304,"height":152}
}],
… , … …
])
# 1. Load images (Note: you can ignore 'Not a JPEG file' errors)
data = tc.image_analysis.load_images('mr_turi_ic', with_path=True)
data['label'] = data['path'].apply(lambda path: os.path.basename(os.path.dirname(path)))
data['annotations'] = tc.SArray(data=annotations, dtype=list)
# Make a train-test split
train_data, test_data = data.random_split(0.8)
# Create a model using Turi Create's object detector API
model = tc.object_detector.create(train_data, max_iterations=1000)
# Save the predictions to an SArray
predictions = model.predict(test_data)
# Evaluate the model and save the results into a dictionary
metrics = model.evaluate(test_data)
print('Precision' , metrics['mean_average_precision'])
MODEL TRAINING
import turicreate as tc
import os
# Define all images annotations with bounding box details (I am showing only 1)
annotations = tc.SArray([
[{
“label”:”5000ar",
“type":"rectangle",
“coordinates”:{“y":188.5,"x":207,"width":304,"height":152}
}],
… , … …
])
# 1. Load images (Note: you can ignore 'Not a JPEG file' errors)
data = tc.image_analysis.load_images('mr_turi_ic', with_path=True)
data['label'] = data['path'].apply(lambda path: os.path.basename(os.path.dirname(path)))
data['annotations'] = tc.SArray(data=annotations, dtype=list)
# Make a train-test split
train_data, test_data = data.random_split(0.8)
# Create a model using Turi Create's object detector API
model = tc.object_detector.create(train_data, max_iterations=1000)
# Save the predictions to an SArray
predictions = model.predict(test_data)
# Evaluate the model and save the results into a dictionary
metrics = model.evaluate(test_data)
print('Precision' , metrics['mean_average_precision'])
# Save the model for later use in Turi Create
model.save(‘turi_ic.model')
# Export for use in Core ML file to the current directory
model.export_coreml('turi_ic.mlmodel')
Thanks for listening,

More Related Content

What's hot

Html5 canvas
Html5 canvasHtml5 canvas
Html5 canvasGary Yeh
 
HTML5 Canvas - The Future of Graphics on the Web
HTML5 Canvas - The Future of Graphics on the WebHTML5 Canvas - The Future of Graphics on the Web
HTML5 Canvas - The Future of Graphics on the WebRobin Hawkes
 
기획, 디자인 변경에 강한 카드뷰 만들기 - iOS Tech Talk 2017
기획, 디자인 변경에 강한 카드뷰 만들기 - iOS Tech Talk 2017기획, 디자인 변경에 강한 카드뷰 만들기 - iOS Tech Talk 2017
기획, 디자인 변경에 강한 카드뷰 만들기 - iOS Tech Talk 2017Wanbok Choi
 
Introduction to jQuery
Introduction to jQueryIntroduction to jQuery
Introduction to jQuerymanugoel2003
 

What's hot (11)

jQuery Essentials
jQuery EssentialsjQuery Essentials
jQuery Essentials
 
Html5 canvas
Html5 canvasHtml5 canvas
Html5 canvas
 
J query
J queryJ query
J query
 
J query1
J query1J query1
J query1
 
Jquery
JqueryJquery
Jquery
 
HTML5 Canvas - The Future of Graphics on the Web
HTML5 Canvas - The Future of Graphics on the WebHTML5 Canvas - The Future of Graphics on the Web
HTML5 Canvas - The Future of Graphics on the Web
 
기획, 디자인 변경에 강한 카드뷰 만들기 - iOS Tech Talk 2017
기획, 디자인 변경에 강한 카드뷰 만들기 - iOS Tech Talk 2017기획, 디자인 변경에 강한 카드뷰 만들기 - iOS Tech Talk 2017
기획, 디자인 변경에 강한 카드뷰 만들기 - iOS Tech Talk 2017
 
jQuery
jQueryjQuery
jQuery
 
Introduction to jQuery
Introduction to jQueryIntroduction to jQuery
Introduction to jQuery
 
Jquery
JqueryJquery
Jquery
 
jQuery
jQueryjQuery
jQuery
 

Similar to Image Recognition App Dataset Preparation

Observational Science With Python and a Webcam
Observational Science With Python and a WebcamObservational Science With Python and a Webcam
Observational Science With Python and a WebcamIntellovations, LLC
 
Easy path to machine learning
Easy path to machine learningEasy path to machine learning
Easy path to machine learningwesley chun
 
Universal Image Loader: Story, Architecture, FAQ
Universal Image Loader: Story, Architecture, FAQUniversal Image Loader: Story, Architecture, FAQ
Universal Image Loader: Story, Architecture, FAQSergey Tarasevich
 
Machine Tags
Machine TagsMachine Tags
Machine Tagshchen1
 
Presentation1.pptx
Presentation1.pptxPresentation1.pptx
Presentation1.pptxK Manjunath
 
Ember.js Tokyo event 2014/09/22 (English)
Ember.js Tokyo event 2014/09/22 (English)Ember.js Tokyo event 2014/09/22 (English)
Ember.js Tokyo event 2014/09/22 (English)Yuki Shimada
 
Ai powered images-frankfurt
Ai powered images-frankfurtAi powered images-frankfurt
Ai powered images-frankfurtDoug Sillars
 
Ai powered images-nibelfast
Ai powered images-nibelfastAi powered images-nibelfast
Ai powered images-nibelfastDoug Sillars
 
iOSDevCamp 2011 - Getting "Test"-y: Test Driven Development & Automated Deplo...
iOSDevCamp 2011 - Getting "Test"-y: Test Driven Development & Automated Deplo...iOSDevCamp 2011 - Getting "Test"-y: Test Driven Development & Automated Deplo...
iOSDevCamp 2011 - Getting "Test"-y: Test Driven Development & Automated Deplo...Rudy Jahchan
 
Internal training - Eda
Internal training - EdaInternal training - Eda
Internal training - EdaTony Vo
 
When Relational Isn't Enough: Neo4j at Squidoo
When Relational Isn't Enough: Neo4j at SquidooWhen Relational Isn't Enough: Neo4j at Squidoo
When Relational Isn't Enough: Neo4j at SquidooGil Hildebrand
 
#NewMeetup Performance
#NewMeetup Performance#NewMeetup Performance
#NewMeetup PerformanceJustin Cataldo
 
Ai powered images-geneva
Ai powered images-genevaAi powered images-geneva
Ai powered images-genevaDoug Sillars
 
Ai powered images-madridsc
Ai powered images-madridscAi powered images-madridsc
Ai powered images-madridscDoug Sillars
 
Transfer learning, active learning using tensorflow object detection api
Transfer learning, active learning  using tensorflow object detection apiTransfer learning, active learning  using tensorflow object detection api
Transfer learning, active learning using tensorflow object detection api설기 김
 
Viktor Tsykunov: Azure Machine Learning Service
Viktor Tsykunov: Azure Machine Learning ServiceViktor Tsykunov: Azure Machine Learning Service
Viktor Tsykunov: Azure Machine Learning ServiceLviv Startup Club
 
Android Custom views
Android Custom views   Android Custom views
Android Custom views Matej Vukosav
 
Automated Design Validation The Solid Works Api
Automated Design Validation The Solid Works ApiAutomated Design Validation The Solid Works Api
Automated Design Validation The Solid Works ApiRazorleaf Corporation
 

Similar to Image Recognition App Dataset Preparation (20)

Observational Science With Python and a Webcam
Observational Science With Python and a WebcamObservational Science With Python and a Webcam
Observational Science With Python and a Webcam
 
Easy path to machine learning
Easy path to machine learningEasy path to machine learning
Easy path to machine learning
 
Universal Image Loader: Story, Architecture, FAQ
Universal Image Loader: Story, Architecture, FAQUniversal Image Loader: Story, Architecture, FAQ
Universal Image Loader: Story, Architecture, FAQ
 
Machine Tags
Machine TagsMachine Tags
Machine Tags
 
Intro to appcelerator
Intro to appceleratorIntro to appcelerator
Intro to appcelerator
 
Presentation1.pptx
Presentation1.pptxPresentation1.pptx
Presentation1.pptx
 
Ember.js Tokyo event 2014/09/22 (English)
Ember.js Tokyo event 2014/09/22 (English)Ember.js Tokyo event 2014/09/22 (English)
Ember.js Tokyo event 2014/09/22 (English)
 
Ai powered images-frankfurt
Ai powered images-frankfurtAi powered images-frankfurt
Ai powered images-frankfurt
 
Ai powered images-nibelfast
Ai powered images-nibelfastAi powered images-nibelfast
Ai powered images-nibelfast
 
iOSDevCamp 2011 - Getting "Test"-y: Test Driven Development & Automated Deplo...
iOSDevCamp 2011 - Getting "Test"-y: Test Driven Development & Automated Deplo...iOSDevCamp 2011 - Getting "Test"-y: Test Driven Development & Automated Deplo...
iOSDevCamp 2011 - Getting "Test"-y: Test Driven Development & Automated Deplo...
 
Internal training - Eda
Internal training - EdaInternal training - Eda
Internal training - Eda
 
When Relational Isn't Enough: Neo4j at Squidoo
When Relational Isn't Enough: Neo4j at SquidooWhen Relational Isn't Enough: Neo4j at Squidoo
When Relational Isn't Enough: Neo4j at Squidoo
 
#NewMeetup Performance
#NewMeetup Performance#NewMeetup Performance
#NewMeetup Performance
 
Ai powered images-geneva
Ai powered images-genevaAi powered images-geneva
Ai powered images-geneva
 
Ai powered images-madridsc
Ai powered images-madridscAi powered images-madridsc
Ai powered images-madridsc
 
Demystifying The Solid Works Api
Demystifying The Solid Works ApiDemystifying The Solid Works Api
Demystifying The Solid Works Api
 
Transfer learning, active learning using tensorflow object detection api
Transfer learning, active learning  using tensorflow object detection apiTransfer learning, active learning  using tensorflow object detection api
Transfer learning, active learning using tensorflow object detection api
 
Viktor Tsykunov: Azure Machine Learning Service
Viktor Tsykunov: Azure Machine Learning ServiceViktor Tsykunov: Azure Machine Learning Service
Viktor Tsykunov: Azure Machine Learning Service
 
Android Custom views
Android Custom views   Android Custom views
Android Custom views
 
Automated Design Validation The Solid Works Api
Automated Design Validation The Solid Works ApiAutomated Design Validation The Solid Works Api
Automated Design Validation The Solid Works Api
 

Recently uploaded

GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 

Recently uploaded (20)

GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 

Image Recognition App Dataset Preparation

  • 2. Image Recognition Applications & Dataset Preparation
  • 3. Did you see this before ? •Cover violence or nudity images facebook app AppChief
  • 4. Did you see this before ? •Suggests sharing photos with recognized facebook friends Moments app AppChief
  • 5. Did you see this before ? •Search for photo content in iOS and Android Photos AppChief
  • 6. Did you see this before ? •Cutting out a person from an image Sticky app
  • 7. Did you see this before ?
  • 8. What is image recognition ? How to build my own app ? Why I need it ? Is the ability of software to identify objects, places, people, writing and actions in images. labeling the content of images with meta-tags, performing image content search and guiding autonomous robots, self-driving cars and accident avoidance systems…etc Next slides
  • 9. How to build my own app ? TRAIN THE MODEL PREPARE DATASET BUILD AND RUN … …
  • 10. What do you need ? PREPARE DATASET Classify image ? Detect multiple objects inside image ? or
  • 12. vs OBJECT DETECTION input output Image Image Class labelsClass label OBJECT DETECTION INSTANCE SEGMENTATION types + bounding box + bounding boxes + segmentation PREPARE DATASET Image recognition types - IMAGE CLASSIFICATION CLASSIFICATION CLASSIFICATION + LOCALIZATION
  • 15. Let’s create a money reader model STEP 1. Naming objects (Object labels) PREPARE DATASET / OBJECT DETECTION 1 IQD_50000_ar 3 IQD_25000_ar 5 IQD_10000_ar 7 IQD_5000_ar 9 IQD_1000_ar 11 IQD_500_ar 13 IQD_250_ar 2 IQD_50000_en 4 IQD_25000_en 6 IQD_10000_en 8 IQD_5000_en 10 IQD_1000_en 12 IQD_500_en 14 IQD_250_en
  • 16. Let’s create a money reader model STEP 2. Take photos for each money face AS MUCH AS YO CAN PREPARE DATASET / OBJECT DETECTION For better accuracy take hundreds of photos with • Different backgrounds • Different positions • Different light conditions • Different orientations
  • 17. Let’s create a money reader model PREPARE DATASET / OBJECT DETECTION • Different backgrounds • Different positions • Different light conditions • Different orientations STEP 2. Take photos for each money face AS MUCH AS YO CAN
  • 18. STEP 2. Take photos for each money face AS MUCH AS YO CAN Let’s create a money reader model PREPARE DATASET / OBJECT DETECTION
  • 19. Let’s create a money reader model 2. Take about 300 photos for each money face PREPARE DATASET / OBJECT DETECTION
  • 20. Let’s create a money reader model 2. Take about 300 photos for each money face PREPARE DATASET / OBJECT DETECTION
  • 21. Let’s create a money reader model 2. Take about 300 photos for each money face PREPARE DATASET / OBJECT DETECTION
  • 22. Let’s create a money reader model STEP 3. Labeling objects inside images PREPARE DATASET / OBJECT DETECTION Label : IQD_50000_en x : 6 y : 120 width : 150 heigh : 370 Objects : Object #1
  • 23. Let’s create a money reader model STEP 3. Labeling objects inside images PREPARE DATASET / OBJECT DETECTION Label : IQD_50000_en x : 90 y : 125 width : 313 heigh : 313 Objects : Object #1
  • 24. CAUTION : Some training libraries prefers different coordinates system in labeling PREPARE DATASET / OBJECT DETECTION X, Y, Width , Height midX, midY, Width , Height minX, minY, maxX , maxY It’s recommended to check the library needs you want to use for training before start labeling
  • 25. How many photos do you think we need for each label ? PREPARE DATASET / OBJECT DETECTION 10 ? 20 ? 50 ? 100 ? 200 ? 300 ?
  • 26. Assuming 300 photos is good for our model let’s calculate time required PREPARE DATASET / OBJECT DETECTION 300 image x 14 Label x (5 sec) taking photo x (30 sec) labeling 175 hours !!! 7 Days !
  • 27. We made a timesaving app PREPARE DATASET / OBJECT DETECTION Only 1 hour 300 image x 14 Label x (5 sec) taking photo x (60 sec) labeling 50 image x 14 Label x (5 sec) taking photo x (0 sec) labeling
  • 28. PREPARE DATASET / OBJECT DETECTION 1 2 3Create labels Capture Generate
  • 29. PREPARE DATASET / OBJECT DETECTION 3 Transfer Easy Dataset
  • 30. PREPARE DATASET / OBJECT DETECTION Demo time Easy Dataset
  • 31. PREPARE DATASET / OBJECT DETECTION Money Reader - ‫العملة‬ ‫قارئ‬ Final live app Final dataset kaggle.com/husamaamer/iraqi-currency- ~1 GB Iraqi Money ‫العراقية‬ ‫العملة‬ Object detection dataset for Iraqi currency
  • 32. MODEL TRAINING import turicreate as tc import os # Define all images annotations with bounding box details (I am showing only 1) annotations = tc.SArray([ [{ “label”:”5000ar", “type":"rectangle", “coordinates”:{“y":188.5,"x":207,"width":304,"height":152} }], … , … … ])
  • 33. MODEL TRAINING import turicreate as tc import os # Define all images annotations with bounding box details (I am showing only 1) annotations = tc.SArray([ [{ “label”:”5000ar", “type":"rectangle", “coordinates”:{“y":188.5,"x":207,"width":304,"height":152} }], … , … … ]) # 1. Load images (Note: you can ignore 'Not a JPEG file' errors) data = tc.image_analysis.load_images('mr_turi_ic', with_path=True) data['label'] = data['path'].apply(lambda path: os.path.basename(os.path.dirname(path))) data['annotations'] = tc.SArray(data=annotations, dtype=list)
  • 34. MODEL TRAINING import turicreate as tc import os # Define all images annotations with bounding box details (I am showing only 1) annotations = tc.SArray([ [{ “label”:”5000ar", “type":"rectangle", “coordinates”:{“y":188.5,"x":207,"width":304,"height":152} }], … , … … ]) # 1. Load images (Note: you can ignore 'Not a JPEG file' errors) data = tc.image_analysis.load_images('mr_turi_ic', with_path=True) data['label'] = data['path'].apply(lambda path: os.path.basename(os.path.dirname(path))) data['annotations'] = tc.SArray(data=annotations, dtype=list) # Make a train-test split train_data, test_data = data.random_split(0.8)
  • 35. MODEL TRAINING import turicreate as tc import os # Define all images annotations with bounding box details (I am showing only 1) annotations = tc.SArray([ [{ “label”:”5000ar", “type":"rectangle", “coordinates”:{“y":188.5,"x":207,"width":304,"height":152} }], … , … … ]) # 1. Load images (Note: you can ignore 'Not a JPEG file' errors) data = tc.image_analysis.load_images('mr_turi_ic', with_path=True) data['label'] = data['path'].apply(lambda path: os.path.basename(os.path.dirname(path))) data['annotations'] = tc.SArray(data=annotations, dtype=list) # Make a train-test split train_data, test_data = data.random_split(0.8) # Create a model using Turi Create's object detector API model = tc.object_detector.create(train_data, max_iterations=1000) # Save the predictions to an SArray predictions = model.predict(test_data) # Evaluate the model and save the results into a dictionary metrics = model.evaluate(test_data) print('Precision' , metrics['mean_average_precision'])
  • 36. MODEL TRAINING import turicreate as tc import os # Define all images annotations with bounding box details (I am showing only 1) annotations = tc.SArray([ [{ “label”:”5000ar", “type":"rectangle", “coordinates”:{“y":188.5,"x":207,"width":304,"height":152} }], … , … … ]) # 1. Load images (Note: you can ignore 'Not a JPEG file' errors) data = tc.image_analysis.load_images('mr_turi_ic', with_path=True) data['label'] = data['path'].apply(lambda path: os.path.basename(os.path.dirname(path))) data['annotations'] = tc.SArray(data=annotations, dtype=list) # Make a train-test split train_data, test_data = data.random_split(0.8) # Create a model using Turi Create's object detector API model = tc.object_detector.create(train_data, max_iterations=1000) # Save the predictions to an SArray predictions = model.predict(test_data) # Evaluate the model and save the results into a dictionary metrics = model.evaluate(test_data) print('Precision' , metrics['mean_average_precision']) # Save the model for later use in Turi Create model.save(‘turi_ic.model') # Export for use in Core ML file to the current directory model.export_coreml('turi_ic.mlmodel')