Module 5 Aws
Module 5 Aws
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Module overview
Sections Demonstrations
1. Introducing computer vision 1. Introducing Amazon Rekognition
2. Analyzing images and videos 2. Labeling Images with Amazon
SageMaker Ground Truth
3. Preparing custom datasets for computer
vision Lab
4. Module wrap-up Guided Lab: Facial Recognition
Knowledge check
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 2
Module objectives
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 3
M o d u l e 5 : I n t ro d u c i n g C o m p u t e r Vi s i o n
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Computer vision overview
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 5
Computer vision applications
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 6
Computer vision problems
Content recognition
Image analysis
• Object classification
Food?
Breakfast?
Lunch?
Dinner?
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 7
Computer vision problems
Confidence
Content recognition
Image analysis Milk 97.1
• Object classification
Peaches 92.3
• Object detection
Ice Cream 97.1
Salad 69.5
Nuggets 77.5
Bread Roll 94.5
Bounding boxes
(top,left,width,height)
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 8
Computer vision problems
Content recognition
Image analysis Milk
• Object classification Peaches
• Object detection Ice Cream
• Object segmentation
Salad
Nuggets
Bread Roll
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 9
Computer vision use cases
Content recognition
Video analysis
• Instance tracking
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 10
Computer vision use cases
Content recognition
Video analysis
• Instance tracking
• Action recognition
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 11
Computer vision use cases
Content recognition
Video analysis
• Instance tracking
• Action recognition
• Motion estimation
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 12
• Computer vision is the automated
Section 1 key extraction of information from
takeaways images
• Image analysis includes object
classification, detection, and
segmentation
• Video analysis includes instance
tracking, action recognition, and
motion estimation
13 © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
M o d u l e 5 : I n t ro d u c i n g C o m p u t e r Vi s i o n
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Amazon Rekognition
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 16
Use case 1: Searchable image library
1 2 3 4
6 5
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 17
Use case 2: Image moderation
1 2 3
Users Amazon S3
AWS Lambda Amazon Rekognition
6
Inappropriate Appropriate
content content
detected detected
5 4
Manual Pictures
Review Posted
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 18
Use case 3: Sentiment analysis
1 2 3
4
7 6 5
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 19
Using Amazon Rekognition
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 20
Image analysis: Object and scene detection
City
97.6%
"Name": "Car",
"Confidence": 96.9476089477539,
"Instances": [
x = imageHeight * BoundingBox[“Left”] {
y = imageWidth * BoundingBox[“Top”] "BoundingBox": {
"Width":
0.07903634756803513,
"Height":
0.08699918538331985,
"Left": 0.7790974974632263,
"Top": 0.6977462768554688
},
"Confidence": 96.9476089477539
}
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 22
Face detection
• Bounding box
• Attributes
• Emotions
• Facial landmarks
• Quality
• Pose
• Confidence score
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 23
Using facial recognition
Amazon Rekognition
Response
{ "FaceMatches": [ {
"Face": {
"BoundingBox": { "Height": 0.0633333027, "Left": 0.171851992, "Top":
0.73666697, "Width": 0.1106169968 },
"Confidence": 100,
"ExternalImageId": "input.jpg",
"FaceId": "578e2e1b-d0b0-493c-aa39-ba476a421a34",
"ImageId": "9ba38e68-35b6-5509-9d2e-fcffa75d1653" },
"Similarity": 99.9764175415039 } ],
"FaceModelVersion": "3.0",
"SearchedFaceBoundingBox": { "Height": 0.063333332, "Left": 0.171851858, "Top":
0.73666667, "Width": 0.11061728 },
"SearchedFaceConfidence": 99.99999237060547 }
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 26
Guidelines
• Facial detection
• Bounding box, attributes, emotions, landmarks, quality, pose
• Confidence score
• Detection is based on image data
• Gender based on image, not identity
• Emotions are inferred from physical appearance
• You can use the appropriate confidence score for your use case
• Facial recognition should never be used in a way that violates an
individual’s rights, including the right to privacy, or makes autonomous
decisions for scenarios that require analysis by a human*
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 27
Demonstration:
Introducing
Amazon
Rekognition
28 © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Working with stored videos
Process: H.264
MOV/MPEG-4
• Start detection Max 10 GB
• People, faces, labels, celebrities, text, Start detection
inappropriate content
• Monitor Amazon Simple Queue Existing video
Service (Amazon SQS) queue for
completion
Topic Amazon
• Get detection results
Monitor SQS Rekognition
Client Queue
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 29
Working with streaming videos
Application process:
1. Stream video to Amazon Kinesis Video
Streams
Amazon Kinesis
2. Connect Amazon Rekognition Video Video Streams
stream processor
3. Read analysis from the Amazon
Kinesis data stream
Amazon Rekognition
Client
Amazon Kinesis
Data Streams
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 30
• You can use Amazon Rekognition for
Section 2 Key image and video analysis that uses proven,
Takeaways highly scalable, deep learning technology
that doesn’t require machine learning
expertise
• Provides image and video detection of
faces, sentiment, text, unsafe content, and
library search
• Is integrated into other AWS services
31 © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
M o d u l e 5 : I n t ro d u c i n g C o m p u t e r Vi s i o n
Section 3: Preparing custom datasets for computer
vision
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Video analysis, labels, Ben, and Metric
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 33
Models need training on domain
Wood 97%
Canvas 88.7%
Text 84.7%
Envelope 71.7%
Greeting Card 70.4%
Mail 70.4%
Hardwood 60.6%
Plywood 60.4%
Paper 57.7%
Advertisement 55.8%
Poster 55.8%
Art 55.6%
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 34
Amazon Rekognition Custom Labels
• Use for –
• Search for logos
• Identify products
• Identify machine parts
• Distinguish between healthy and infected plants
• Almost all vision solutions start with an existing model
• Benefits –
• Simplified data labeling
• Automated machine learning
• Simplified model evaluation, inference, and feedback
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 35
Custom labeling process
1: Collect images 2: Create training dataset 3: Create test dataset 4: Train the model 5: Evaluate 6: Use Model
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 36
Step 1: Collect images
1: Collect images 2: Create training dataset 3: Create test dataset 4: Train the model 5: Evaluate 6: Use Model
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 37
Step 2: Create training dataset
1: Collect images 2: Create training dataset 3: Create test dataset 4: Train the model 5: Evaluate 6: Use Model
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 38
Image-level versus object-level labels
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 39
Images need labels
{
"source-ref": "s3://b/…/img_2783.jpg",
"small_beach": 1,
"small_beach-metadata": {
"confidence": 1,
"job-name": "labeling-job/small_beach",
"class-name": “Beach",
"human-annotated": "yes",
"creation-date": "2020-03-02T20:42:03.525Z",
"type": "groundtruth/image-classification"
}
}
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 40
Objects need bounding boxes
"small_BB": { "annotations": [
{ "left": 186,"top": 125,”width": 346,"height": 580,
"annotationType": "bounding-box", "id": 5,"class_id": 0},
{ "left": 732,"top": 445,"width": 270,"height": 192,
"annotationType": "bounding-box", "id": 6,"class_id": 1}],
"image_size": [
{ "width": 1152,"height": 864,"depth": 3 }]},
"small_BB-metadata": {
"job-name": "labeling-job/small_BB",
"class-map": { "0": "Echo", "1": "Echo dot“ },
"human-annotated": "yes",
"objects": [ {"confidence": 1}, {"confidence": 1}],
"creation-date": "2020-03-02T20:42:25.930Z",
"type": "groundtruth/object-detection"
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 41
Amazon SageMaker Ground Truth
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 42
Step 3: Create test dataset
1: Collect images 2: Create training dataset 3: Create test dataset 4: Train the model 5: Evaluate 6: Use Model
0% 80% 100%
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 43
Step 4: Train the model
1: Collect images 2: Create training dataset 3: Create test dataset 4: Train the model 5: Evaluate 6: Use Model
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 44
Step 5: Evaluate - Metrics
1: Collect Images 2: Create training dataset 3: Create test dataset 4: Train the model 5: Evaluate 6: Use Model
Predicted
• Overall model performance Cat TP FP
Not a Cat FN TN
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 45
Step 5: Evaluate – Improve
1: Collect Images 2: Create training dataset 3: Create test dataset 4: Train the model 5: Evaluate 6: Use Model
• Data
• Reducing false positives (better precision)
• Adjust the confidence threshold to improve precision
• Add additional classes as labels for training
• Reducing false negatives (better recall)
• Lower the confidence threshold to improve recall
• Use better data or more precise classes (labels) for training
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 46
Step 6: Use the model
1: Collect Images 2: Create training dataset 3: Create test dataset 4: Train the model 5: Evaluate 6: Use Model
48 © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
• Models must be trained for the
Section 3 key specific domain that you want to
takeaways analyze
• You can set custom labeling for the
specific business case
• Custom labeling workflow
• You must label images and create
bounding boxes for objects
• You can use Amazon SageMaker
Ground Truth to build training
datasets for your models
49 © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Module 5 – Guided
Lab:
Facial Recognition
50 © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
M o d u l e 5 : I n t r o d u c i n g C o m p u t e r Vi s i o n
Module wrap-up
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Module summary
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 52
Complete the knowledge check
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 53
Additional resources
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 54
Thank you
© 2021 Amazon Web Services, Inc. or its affiliates. All rights reserved. This work may not be reproduced or redistributed, in whole or in part, without prior written permission from Amazon
Web Services, Inc. Commercial copying, lending, or selling is prohibited. Corrections, feedback, or other questions? Contact us at https://support.aws.amazon.com/#/contacts/aws-training.
All trademarks are the property of their owners.