AWSome Day 2018
AWS Rekognition -
Riconoscimento Facciale
PUG Torino - Marzo 2019
Walter Dal Mut
Solution Architect - AWS Certified
SysOps Administrator - AWS Certified
Docker Certified Associate
@walterdalmut
walter.dalmut@corley.it
corley.it
28 Marzo 2019
Codice Sconto: pug-sconto
Scalability and cost optimization with Container Services
CloudConf2019 - General
Setup
AWS Rekognition
Summary
Get the APP
https://u.corley.it/s/b4
➢ Receive the CloudConf email with the web
application endpoint
➢ The barcode is used on the web application
➢ The user upload its own picture connecting the
identification number
➢ The pictures is checked to drop common mistakes
○ Drop multiple users (too many people)
○ Dark or too bright pictures
○ Low quality pictures
○ etc.
■ We believe that users are somehow polite
➢ AWS Rekognition tear apart the picture in favor of
raw information
○ (no images are stored)
The user upload its own picture
➢ Locally runs a simple face recognition algorithm
➢ When a face is detected a frame is captured
➢ The captured frame is processed by AWS
Rekognition Service
➢ The External Image Identification number is
used to get the user information
➢ The user information is stored as PDF file
➢ The file is printed using a thermal printer
Local algorithm
Local configuration
AWS Rekognition
$ aws rekognition list-collections
{
"CollectionIds": [
"collection-10",
"corley-test"
],
"FaceModelVersions": [
"4.0",
"4.0"
]
}
AWS Rekognition
$ aws rekognition create-collection --collection-id collection-11
{
"StatusCode": 200,
"CollectionArn":
"aws:rekognition:eu-west-1:xxxxxxxxxxxx:collection/collection-11",
"FaceModelVersion": "4.0"
}
Upload pictures on s3
$aws s3 cp wdm1.jpg s3://faces.walterdalmut.com/
$ aws s3 ls s3://faces.walterdalmut.com
2019-02-15 17:46:24 6753 thor1.jpg
2019-02-15 17:40:00 44897 wdm1.jpg
Detect faces (when you upload a picture)
$ aws rekognition detect-faces --image 'S3Object={Bucket=faces.walterdalmut.com,Name=wdm1.jpg}'
{
"FaceDetails": [
{
"Landmarks": [
{
"Type": "eyeLeft",
"X": 0.4940113127231598,
"Y": 0.28493359684944153
},
{
"Type": "eyeRight",
"X": 0.5633826851844788,
"Y": 0.2943187952041626
},
{
"Type": "mouthLeft",
"X": 0.4960087239742279,
"Y": 0.41778162121772766
},
{
"Type": "mouthRight",
"X": 0.5530909895896912,
"Y": 0.42552411556243896
},
{
"Type": "nose",
"X": 0.5306091904640198,
"Y": 0.34477418661117554
}
],
}
]
}
// continue...
{
"FaceDetails": [
{
"BoundingBox": {
"Width": 0.1618916094303131,
"Height": 0.4021730124950409,
"Left": 0.43909329175949097,
"Top": 0.12676428258419037
},
"Pose": {
"Roll": 3.8218839168548584,
"Yaw": 5.0268073081970215,
"Pitch": 5.38221549987793
},
"Quality": {
"Brightness": 64.7296142578125,
"Sharpness": 32.20803451538086
},
"Confidence": 99.9999771118164
}
]
}
Index faces (when you upload a picture)
$ aws rekognition index-faces 
--collection-id collection-11 
--image 'S3Object={Bucket=faces.walterdalmut.com,Name=wdm1.jpg}'
{
"FaceRecords": [
{
"Face": {
"FaceId": "310b383e-66c1-43b8-918a-75388619ee7b",
"BoundingBox": {
"Width": 0.1618916094303131,
"Height": 0.4021730124950409,
"Left": 0.43909329175949097,
"Top": 0.12676428258419037
},
"ImageId": "da1ae019-db88-3713-8e9e-7d01238ea609",
"Confidence": 99.9999771118164
},
}
]
…
}
Index faces (when you upload a picture)
$ aws rekognition index-faces 
--collection-id collection-11 
--image 'S3Object={Bucket=faces.walterdalmut.com,Name=wdm1.jpg}' 
--external-image-id my-user-id
{
"FaceRecords": [
{
"Face": {
"FaceId": "my-user-id",
"BoundingBox": {
"Width": 0.1618916094303131,
"Height": 0.4021730124950409,
"Left": 0.43909329175949097,
"Top": 0.12676428258419037
},
"ImageId": "da1ae019-db88-3713-8e9e-7d01238ea609",
"Confidence": 99.9999771118164
},
}
]
…
}
Search faces (when you upload a picture)
$ aws rekognition search-faces-by-image 
--collection-id collection-11 
--image 'S3Object={Bucket=faces.walterdalmut.com,Name=wdm1.jpg}'
{
"SearchedFaceBoundingBox": {
"Width": 0.1618916094303131,
"Height": 0.4021730124950409,
"Left": 0.43909329175949097,
"Top": 0.12676428258419037
},
"SearchedFaceConfidence": 99.9999771118164,
"FaceMatches": [
{
"Similarity": 99.99999237060547,
"Face": {
"FaceId": "my-user-id",
"BoundingBox": {
"Width": 0.16189199686050415,
"Height": 0.4021730124950409,
"Left": 0.4390929937362671,
"Top": 0.12676399946212769
},
"ImageId": "da1ae019-db88-3713-8e9e-7d01238ea609",
"Confidence": 100.0
}
}
],
"FaceModelVersion": "4.0"
}
List existing faces (management)
$ aws rekognition list-faces --collection-id collection-16
{
"Faces": [
{
"FaceId": "18215496-3282-46ae-a265-aecf140fba65",
"BoundingBox": {
"Width": 0.37553301453590393,
"Height": 0.3338260054588318,
"Left": 0.43626898527145386,
"Top": 0.289465993642807
},
"ImageId": "ea5e78fc-3fdb-32d3-b053-5a22f95dbd55",
"ExternalImageId": "6639219",
"Confidence": 100.0
},
{
"FaceId": "2b85a18f-7570-4568-9fe0-b770ace00745",
"BoundingBox": {
"Width": 0.47415900230407715,
"Height": 0.3649649918079376,
"Left": 0.34846198558807373,
"Top": 0.28914299607276917
},
"ImageId": "c601ee26-224b-308a-a25c-ecd56ad0a400",
"ExternalImageId": "6639219",
"Confidence": 100.0
},
],
"FaceModelVersion": "4.0"
}
Drop existing faces (management)
$ aws rekognition delete-faces --collection-id collection-16 
--face-ids 2b85a18f-7570-4568-9fe0-b770ace00745
{
"DeletedFaces": [
"2b85a18f-7570-4568-9fe0-b770ace00745"
]
}
Thanks for listening.
Torino 2018 - walter.dalmut@corley.it

Aws rekognition - riconoscimento facciale

  • 1.
    AWSome Day 2018 AWSRekognition - Riconoscimento Facciale PUG Torino - Marzo 2019
  • 2.
    Walter Dal Mut SolutionArchitect - AWS Certified SysOps Administrator - AWS Certified Docker Certified Associate @walterdalmut walter.dalmut@corley.it corley.it
  • 3.
    28 Marzo 2019 CodiceSconto: pug-sconto
  • 4.
    Scalability and costoptimization with Container Services CloudConf2019 - General Setup AWS Rekognition Summary
  • 5.
  • 6.
    ➢ Receive theCloudConf email with the web application endpoint ➢ The barcode is used on the web application ➢ The user upload its own picture connecting the identification number ➢ The pictures is checked to drop common mistakes ○ Drop multiple users (too many people) ○ Dark or too bright pictures ○ Low quality pictures ○ etc. ■ We believe that users are somehow polite ➢ AWS Rekognition tear apart the picture in favor of raw information ○ (no images are stored) The user upload its own picture
  • 7.
    ➢ Locally runsa simple face recognition algorithm ➢ When a face is detected a frame is captured ➢ The captured frame is processed by AWS Rekognition Service ➢ The External Image Identification number is used to get the user information ➢ The user information is stored as PDF file ➢ The file is printed using a thermal printer Local algorithm
  • 8.
  • 9.
    AWS Rekognition $ awsrekognition list-collections { "CollectionIds": [ "collection-10", "corley-test" ], "FaceModelVersions": [ "4.0", "4.0" ] }
  • 10.
    AWS Rekognition $ awsrekognition create-collection --collection-id collection-11 { "StatusCode": 200, "CollectionArn": "aws:rekognition:eu-west-1:xxxxxxxxxxxx:collection/collection-11", "FaceModelVersion": "4.0" }
  • 11.
    Upload pictures ons3 $aws s3 cp wdm1.jpg s3://faces.walterdalmut.com/ $ aws s3 ls s3://faces.walterdalmut.com 2019-02-15 17:46:24 6753 thor1.jpg 2019-02-15 17:40:00 44897 wdm1.jpg
  • 12.
    Detect faces (whenyou upload a picture) $ aws rekognition detect-faces --image 'S3Object={Bucket=faces.walterdalmut.com,Name=wdm1.jpg}' { "FaceDetails": [ { "Landmarks": [ { "Type": "eyeLeft", "X": 0.4940113127231598, "Y": 0.28493359684944153 }, { "Type": "eyeRight", "X": 0.5633826851844788, "Y": 0.2943187952041626 }, { "Type": "mouthLeft", "X": 0.4960087239742279, "Y": 0.41778162121772766 }, { "Type": "mouthRight", "X": 0.5530909895896912, "Y": 0.42552411556243896 }, { "Type": "nose", "X": 0.5306091904640198, "Y": 0.34477418661117554 } ], } ] } // continue... { "FaceDetails": [ { "BoundingBox": { "Width": 0.1618916094303131, "Height": 0.4021730124950409, "Left": 0.43909329175949097, "Top": 0.12676428258419037 }, "Pose": { "Roll": 3.8218839168548584, "Yaw": 5.0268073081970215, "Pitch": 5.38221549987793 }, "Quality": { "Brightness": 64.7296142578125, "Sharpness": 32.20803451538086 }, "Confidence": 99.9999771118164 } ] }
  • 13.
    Index faces (whenyou upload a picture) $ aws rekognition index-faces --collection-id collection-11 --image 'S3Object={Bucket=faces.walterdalmut.com,Name=wdm1.jpg}' { "FaceRecords": [ { "Face": { "FaceId": "310b383e-66c1-43b8-918a-75388619ee7b", "BoundingBox": { "Width": 0.1618916094303131, "Height": 0.4021730124950409, "Left": 0.43909329175949097, "Top": 0.12676428258419037 }, "ImageId": "da1ae019-db88-3713-8e9e-7d01238ea609", "Confidence": 99.9999771118164 }, } ] … }
  • 14.
    Index faces (whenyou upload a picture) $ aws rekognition index-faces --collection-id collection-11 --image 'S3Object={Bucket=faces.walterdalmut.com,Name=wdm1.jpg}' --external-image-id my-user-id { "FaceRecords": [ { "Face": { "FaceId": "my-user-id", "BoundingBox": { "Width": 0.1618916094303131, "Height": 0.4021730124950409, "Left": 0.43909329175949097, "Top": 0.12676428258419037 }, "ImageId": "da1ae019-db88-3713-8e9e-7d01238ea609", "Confidence": 99.9999771118164 }, } ] … }
  • 15.
    Search faces (whenyou upload a picture) $ aws rekognition search-faces-by-image --collection-id collection-11 --image 'S3Object={Bucket=faces.walterdalmut.com,Name=wdm1.jpg}' { "SearchedFaceBoundingBox": { "Width": 0.1618916094303131, "Height": 0.4021730124950409, "Left": 0.43909329175949097, "Top": 0.12676428258419037 }, "SearchedFaceConfidence": 99.9999771118164, "FaceMatches": [ { "Similarity": 99.99999237060547, "Face": { "FaceId": "my-user-id", "BoundingBox": { "Width": 0.16189199686050415, "Height": 0.4021730124950409, "Left": 0.4390929937362671, "Top": 0.12676399946212769 }, "ImageId": "da1ae019-db88-3713-8e9e-7d01238ea609", "Confidence": 100.0 } } ], "FaceModelVersion": "4.0" }
  • 16.
    List existing faces(management) $ aws rekognition list-faces --collection-id collection-16 { "Faces": [ { "FaceId": "18215496-3282-46ae-a265-aecf140fba65", "BoundingBox": { "Width": 0.37553301453590393, "Height": 0.3338260054588318, "Left": 0.43626898527145386, "Top": 0.289465993642807 }, "ImageId": "ea5e78fc-3fdb-32d3-b053-5a22f95dbd55", "ExternalImageId": "6639219", "Confidence": 100.0 }, { "FaceId": "2b85a18f-7570-4568-9fe0-b770ace00745", "BoundingBox": { "Width": 0.47415900230407715, "Height": 0.3649649918079376, "Left": 0.34846198558807373, "Top": 0.28914299607276917 }, "ImageId": "c601ee26-224b-308a-a25c-ecd56ad0a400", "ExternalImageId": "6639219", "Confidence": 100.0 }, ], "FaceModelVersion": "4.0" }
  • 17.
    Drop existing faces(management) $ aws rekognition delete-faces --collection-id collection-16 --face-ids 2b85a18f-7570-4568-9fe0-b770ace00745 { "DeletedFaces": [ "2b85a18f-7570-4568-9fe0-b770ace00745" ] }
  • 18.
    Thanks for listening. Torino2018 - walter.dalmut@corley.it