SlideShare a Scribd company logo
1 of 100
Using AI to Power Your Images
Doug Sillars
NI AI
July 30, 2019
Contact Me:
@DougSillars
Doug.Sillars@gmail.com
www.dougsillars.com
Doug Sillars
Freelance Developer Relations
Performance Audits: Web/Native
Workshops:
Performance/Images/Video/AR/ML
http://bit.ly/HighPerformanceAndroidApps
Images Dominate the Web
HTTPArchive mobile websites 04/2019
Image Prep for the Web
Image Prep for the Web
Image Prep for the Web
Image Prep for the Web
Image Prep for the Web
Shortcuts for Image Prep?
Shortcuts for Image Prep?
Ensure You are delivering the optimal image
Shortcuts: Taking screenshots of Photoshop
Shortcuts for Image Prep?
Images on the web named screen*shot
426,000 screenshots live on the web
April 2019
Images on the web named screen*shot
106,000 sites with Screen Shots
April 2019
Images on the web named screen*shot
5M sites tested
106,000 sites with Screen Shots
Images on the web named screen*shot
5M sites tested
106,000 sites with Screen Shots 2.1%
of the
web!
=
Image Formats – Screenshots -> JPG
https://dougsillars.com/2019/02/10/using-screenshots-in-production/
Sometimes our Shortcuts have lasting effects
Shortcuts for Image Prep?
Shortcuts for Image Prep?
Shortcuts for Image Prep?
https://res.cloudinary.com/dougsillars/image/upload/c_crop,h_1000,w_1000,q_auto,f_auto/v1558503538/doug_headshot_alps
_tfzado.jpg
Shortcuts for Image Prep?
https://res.cloudinary.com/dougsillars/image/upload/c_crop,h_1000,w_1000,q_auto,f_auto/v1558503538/doug_headshot_alps
_tfzado.jpg
120 KB
Shortcuts for Image Prep?
Shortcuts for Image Prep?
https://res.cloudinary.com/dougsillars/image/upload/c_crop,h_1080,w_1000,q_auto,f_auto/
v1558504239/IMG_20160527_131042692_HDR_c21a3k.jpg
Shortcuts for Image Prep
Manual crop
Shortcuts for Image Prep
Manual crops are not a shortcut
Shortcuts for Image Prep: Detection of Objects
https://res.cloudinary.com/dougsillars/image/upload/g_auto,c_crop,w_1000,h_1000/
v1558504239/IMG_20160527_131042692_HDR_c21a3k.jpg
Image Cropping in Production: Twitter
Image Cropping in Production: Twitter
https://blog.twitter.com/engineering/en_us/topics/infrastructure/2018/Smart-Auto-Cropping-of-Images.html
Object Detection Using Machine Learning
• ImageAI library
• Tensorflow based
• Need Image Model Library
detector = ObjectDetection()
detector.setModelTypeAsRetinaNet()
detector.setModelPath( os.path.join(execution_path , "resnet50_coco_best_v2.0.1.h5"))
detector.loadModel()
detections = detector.detectObjectsFromImage(input_image=os.path.join(execution_path , "berwickontweed.jpg"),
output_image_path=os.path.join(execution_path , "resnet.jpg"))
resnet=plt.imread('resnet.jpg')
Object Detection Using Machine Learning
Object Detection Using Machine Learning
Object Detection with Machine Learning
Object Detection
• Cropping
Object Detection
• Cropping
• Blurring objects
Object Detection
• Cropping
• Blurring objects
• Object Removal
http://bit.ly/bootsphoto
Object Detection
• Cropping
• Blurring objects
• Object Removal
• Alt Text Creation
Object Detection
• Cropping
• Blurring objects
• Object Removal
• Alt Text Creation
Alt = “A Person and 2 dogs”
If the Object is not Modeled…
If the Object is not Modeled…
•person : 99.72
•dog : 88.67
•dog : 96.92
…Try a new library
• https://llama.vision
…Try a new library
• https://llama.vision
ML ALT text in production
ML ALT text in production
alt="Image may contain: sky, cloud, ocean, outdoor and
nature"
…Or you can train a model
Google Object Detection
Google Object Detection: Model Creation
Google Object Detection: Model Creation
Google Object Detection: Model Creation
Google Object Detection: Model Creation
Train Your Model
Precision: How often Model’s
predictions were correct. In this case
1/6 is a false positive
Recall: How often model found
known objects. 1/6 is a missed
prediction.
Deploy Model and Use
Deploy Model and Use
Model Results!!
Model Results!!
Image Fix 1: Cropping
Image Fix 1: Cropping
Image Fix 1: Cropping
Image Fix 2: Inpainting
Image Fix 2: Inpainting
Create a mask of the area
Image Fix 2: Inpainting
Create a mask of the area
Image Fix 2: Inpainting
Image Fix 2: Inpainting
InPaint: Works well on single color areas
InPaint: Works Not So well with lots of color
Tricking InPaint
Remove “outlier” colors from
the border
Use the inside as inpainting area
Tricking InPaint
Convert to Grayscale
colors are 0 – 255 (1D)
Kmeans to bucket the colors
Tricking InPaint
Tricking InPaint
10 most common gray colors found
Tricking InPaint
10 most common gray colors found
Frequency
Tricking InPaint 1. Loop through Color list
Tricking InPaint 2. Ignore the White Center
Tricking InPaint
3. If Color is an outlier
(lower than 25th percentile
Higher than 75th)
Mask and replace
Tricking InPaint
Tricking InPaint
Tricking InPaint
Sunglasses Project
Sunglasses Project
Manually edit 1,000s of glasses?
Sunglasses Project
Sunglasses Project
Sunglasses Project
Sunglasses Project
1. Remove Background
Sunglasses Project
1. Remove Background
Sunglasses Project
2. Make (slightly) transparent
https://res.cloudinary.com/dougsillars/image
/upload/e_make_transparent,o_70/v1558760
129/6658.png
Train a model!
Want to minimize frame capture
Train a model!
Beginning
Find the arms
Find the arms
Finding an Odd number: Fail
Modify the border around the arms
Inpaint and upload
Putting it all together
https://res.cloudinary.com/dougsillars/image/upload/v1558855691/IMG_20181207_163533_ibfm7a.jpg
Putting it all together
https://res.cloudinary.com/dougsillars/image/upload/c_crop,g_face,w_1500,h_1500/v1558855691/IMG_2018120
7_163533_ibfm7a.jpg
Putting it all together
https://res.cloudinary.com/dougsillars/image/upload/c_crop,g_face,w_1500,h_1500/v1558855691/IMG_2018120
7_163533_ibfm7a.jpg
l_6558_f,o_80,e_make_transparent/
Putting it all together
https://res.cloudinary.com/dougsillars/image/upload/c_crop,g_face,w_1500,h_1500/l_6558_f,o_80,e_make_transparent/
g_adv_eyes,fl_layer_apply/v1558855691/IMG_20181207_163533_ibfm7a.jpg
Demo Time
https://res.cloudinary.com/dougsillars/image/upload/c_crop,g_face,w_1500,h_1500/l_6558_f,o_80,e_make_transparent/
g_adv_eyes,fl_layer_apply/v1558855691/IMG_20181207_163533_ibfm7a.jpg
Conclusion
• Image processing with AI and ML can simplify image prep for the web
• Cropping
• Blurring
• Object removal
• Alt text
Love Building with Video and Images?
Media Developer Expert
mde-comm@cloudinary.com
Become a

More Related Content

Similar to Ai powered images-nibelfast

Similar to Ai powered images-nibelfast (20)

Ai powered images-fullstackporto
Ai powered images-fullstackportoAi powered images-fullstackporto
Ai powered images-fullstackporto
 
Ai powered images-gdgtirana
Ai powered images-gdgtiranaAi powered images-gdgtirana
Ai powered images-gdgtirana
 
Ai powered images-pythonljubjana
Ai powered images-pythonljubjanaAi powered images-pythonljubjana
Ai powered images-pythonljubjana
 
Ai powered images-seattle
Ai powered images-seattleAi powered images-seattle
Ai powered images-seattle
 
Ai powered images-belfast
Ai powered images-belfastAi powered images-belfast
Ai powered images-belfast
 
Ai powered images
Ai powered imagesAi powered images
Ai powered images
 
Deep Learning on iOS #360iDev
Deep Learning on iOS #360iDevDeep Learning on iOS #360iDev
Deep Learning on iOS #360iDev
 
Getting Intimate with Images on Android with James Halpern
Getting Intimate with Images on Android with James HalpernGetting Intimate with Images on Android with James Halpern
Getting Intimate with Images on Android with James Halpern
 
Digital Fabrication Studio: 3D Scanning
Digital Fabrication Studio: 3D ScanningDigital Fabrication Studio: 3D Scanning
Digital Fabrication Studio: 3D Scanning
 
Mad scientist-roadshow
Mad scientist-roadshowMad scientist-roadshow
Mad scientist-roadshow
 
Top Tips for Android UIs - Getting the Magic on Tablets
Top Tips for Android UIs - Getting the Magic on TabletsTop Tips for Android UIs - Getting the Magic on Tablets
Top Tips for Android UIs - Getting the Magic on Tablets
 
Android design lecture #1
Android design   lecture #1Android design   lecture #1
Android design lecture #1
 
Incarnation - Turning Real World Objects into Perfume World
Incarnation - Turning Real World Objects into Perfume WorldIncarnation - Turning Real World Objects into Perfume World
Incarnation - Turning Real World Objects into Perfume World
 
Image recognition applications and dataset preparation - DevFest Baghdad 2018
Image recognition applications and dataset preparation - DevFest Baghdad 2018Image recognition applications and dataset preparation - DevFest Baghdad 2018
Image recognition applications and dataset preparation - DevFest Baghdad 2018
 
The Art of Web Design, 101
The Art of Web Design, 101The Art of Web Design, 101
The Art of Web Design, 101
 
Easy path to machine learning
Easy path to machine learningEasy path to machine learning
Easy path to machine learning
 
A Responsive Design Case Study - What We Did Wrong Building ResponsiveDesign....
A Responsive Design Case Study - What We Did Wrong Building ResponsiveDesign....A Responsive Design Case Study - What We Did Wrong Building ResponsiveDesign....
A Responsive Design Case Study - What We Did Wrong Building ResponsiveDesign....
 
Fmp proposal
Fmp proposalFmp proposal
Fmp proposal
 
Xamarin.Android Introduction
Xamarin.Android IntroductionXamarin.Android Introduction
Xamarin.Android Introduction
 
打造你的第一個iPhone APP
打造你的第一個iPhone APP打造你的第一個iPhone APP
打造你的第一個iPhone APP
 

More from Doug Sillars

More from Doug Sillars (20)

Fastandbeautiful belfast
Fastandbeautiful belfastFastandbeautiful belfast
Fastandbeautiful belfast
 
Fastandbeautiful gdg sacremento
Fastandbeautiful gdg sacrementoFastandbeautiful gdg sacremento
Fastandbeautiful gdg sacremento
 
Fastandbeautiful gd glittlerock
Fastandbeautiful gd glittlerockFastandbeautiful gd glittlerock
Fastandbeautiful gd glittlerock
 
Fastandbeautiful webinale
Fastandbeautiful webinaleFastandbeautiful webinale
Fastandbeautiful webinale
 
Fastandbeautiful zagrebtechsauna
Fastandbeautiful zagrebtechsaunaFastandbeautiful zagrebtechsauna
Fastandbeautiful zagrebtechsauna
 
Video js zagreb
Video js zagrebVideo js zagreb
Video js zagreb
 
Vkmdp cologne
Vkmdp cologneVkmdp cologne
Vkmdp cologne
 
A rt gallery pantalks
A rt gallery pantalksA rt gallery pantalks
A rt gallery pantalks
 
A rt gallery hub387
A rt gallery hub387A rt gallery hub387
A rt gallery hub387
 
Fastandbeautiful vienna
Fastandbeautiful viennaFastandbeautiful vienna
Fastandbeautiful vienna
 
A rt gallery devfestlondon
A rt gallery devfestlondonA rt gallery devfestlondon
A rt gallery devfestlondon
 
Fastandbeautiful devfest london
Fastandbeautiful devfest londonFastandbeautiful devfest london
Fastandbeautiful devfest london
 
A rt gallery cardiff
A rt gallery cardiffA rt gallery cardiff
A rt gallery cardiff
 
Fastandbeautiful oredev
Fastandbeautiful oredevFastandbeautiful oredev
Fastandbeautiful oredev
 
A rt gallery oredev
A rt gallery oredevA rt gallery oredev
A rt gallery oredev
 
A rt gallery webcamp-zg
A rt gallery webcamp-zgA rt gallery webcamp-zg
A rt gallery webcamp-zg
 
Qa fest kiev_when its just too slow
Qa fest kiev_when its just too slowQa fest kiev_when its just too slow
Qa fest kiev_when its just too slow
 
A rt gallery coding-serbia_novisad
A rt gallery coding-serbia_novisadA rt gallery coding-serbia_novisad
A rt gallery coding-serbia_novisad
 
Armadajs video
Armadajs videoArmadajs video
Armadajs video
 
Fastandbeautiful novi sad
Fastandbeautiful novi sadFastandbeautiful novi sad
Fastandbeautiful novi sad
 

Recently uploaded

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
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
 
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc
 

Recently uploaded (20)

WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
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
 
Choreo: Empowering the Future of Enterprise Software Engineering
Choreo: Empowering the Future of Enterprise Software EngineeringChoreo: Empowering the Future of Enterprise Software Engineering
Choreo: Empowering the Future of Enterprise Software Engineering
 
Design and Development of a Provenance Capture Platform for Data Science
Design and Development of a Provenance Capture Platform for Data ScienceDesign and Development of a Provenance Capture Platform for Data Science
Design and Development of a Provenance Capture Platform for Data Science
 
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...
 
Quantum Leap in Next-Generation Computing
Quantum Leap in Next-Generation ComputingQuantum Leap in Next-Generation Computing
Quantum Leap in Next-Generation Computing
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
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
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
JavaScript Usage Statistics 2024 - The Ultimate Guide
JavaScript Usage Statistics 2024 - The Ultimate GuideJavaScript Usage Statistics 2024 - The Ultimate Guide
JavaScript Usage Statistics 2024 - The Ultimate Guide
 
The Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and InsightThe Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and Insight
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
 
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...
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
 

Ai powered images-nibelfast