201910 awsinnovate aiml-autocheckin · 2019-11-05 · © 2019, amazon web services, inc. or its...

37

Upload: others

Post on 27-Jul-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 201910 AWSInnovate AIML-AutoCheckIn · 2019-11-05 · © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. AI 顔認証イベント受付サービス を作ってみよう
Page 2: 201910 AWSInnovate AIML-AutoCheckIn · 2019-11-05 · © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. AI 顔認証イベント受付サービス を作ってみよう

© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.

AI 顔認証イベント受付サービスを作ってみよう針原 佳貴アマゾン ウェブ サービス ジャパン技術本部 ソリューションアーキテクト

#AWSInnovate

Page 3: 201910 AWSInnovate AIML-AutoCheckIn · 2019-11-05 · © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. AI 顔認証イベント受付サービス を作ってみよう

© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.

深層学習フレームワーク& インフラストラクチャ

A I サービス

ML サービス Amazon SageMaker

A M A Z O N E C 2 C 5 I n s t a n c e s

A M A Z O N E C 2 P 3 I n s t a n c e s

F P G A s

Frameworks

AWS の機械学習スタック

A m a z o n R e k o g n i t i o n

I m a g e / V i d e o

A m a z o nP o l l y

A m a z o nT r a n s c r i b e

A m a z o nT r a n s l a t e

A m a z o nC o m p r e h e n d

A m a z o nL e x

Chatbots

A m a z o nF o r e c a s t

Forecasting

A m a z o nT e x t r a c t

A m a z o nP e r s o n a l i z e

RecommendationsVision Speech Language

E l a s t i c I n f e r e n c e

Infrastructure

Interfaces

Page 4: 201910 AWSInnovate AIML-AutoCheckIn · 2019-11-05 · © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. AI 顔認証イベント受付サービス を作ってみよう

© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.

深層学習フレームワーク& インフラストラクチャ

A I サービス

ML サービス Amazon SageMaker

A M A Z O N E C 2 C 5 I n s t a n c e s

A M A Z O N E C 2 P 3 I n s t a n c e s

F P G A s

Frameworks

AWS の機械学習スタック

A m a z o n R e k o g n i t i o n

I m a g e / V i d e o

A m a z o nP o l l y

A m a z o nT r a n s c r i b e

A m a z o nT r a n s l a t e

A m a z o nC o m p r e h e n d

A m a z o nL e x

Chatbots

A m a z o nF o r e c a s t

Forecasting

A m a z o nT e x t r a c t

A m a z o nP e r s o n a l i z e

RecommendationsVision Speech Language

E l a s t i c I n f e r e n c e

Infrastructure

Interfaces

機械学習の知識があまりなくても学習済みのモデルを API で簡単にご利⽤頂ける• コンピュータビジョン (画像及び動画内の物体検出・顔認識・不適切コンテンツ

の検出や OCR)• ⾳声 (読み上げ・書き起こし)• ⾃然⾔語処理 (翻訳・⽂書意味理解)• チャットボット

Page 5: 201910 AWSInnovate AIML-AutoCheckIn · 2019-11-05 · © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. AI 顔認証イベント受付サービス を作ってみよう

© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.

Agendaイベント受付の課題

Amazon Rekognition と顔認識

顔認証イベント受付サービスのアーキテクチャ

実装・運⽤時の考慮事項

Page 6: 201910 AWSInnovate AIML-AutoCheckIn · 2019-11-05 · © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. AI 顔認証イベント受付サービス を作ってみよう

© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.

Page 7: 201910 AWSInnovate AIML-AutoCheckIn · 2019-11-05 · © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. AI 顔認証イベント受付サービス を作ってみよう

© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.

イベント受付の課題• ⼈が集まるイベントでは受付業務が発⽣• ⾳楽コンサート・ライブ• スポーツ• 全社集会

• 本⼈確認が⼤変• なりすまし防⽌

• 参加者リストとの照合に時間がかかる• ⼈⼿でリスト内を検索する場合が多い

• オペレーション改善のためのメトリクスが取りづらい• 通過時間や時間帯ごとの通過⼈数など

Page 8: 201910 AWSInnovate AIML-AutoCheckIn · 2019-11-05 · © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. AI 顔認証イベント受付サービス を作ってみよう

© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.

Page 9: 201910 AWSInnovate AIML-AutoCheckIn · 2019-11-05 · © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. AI 顔認証イベント受付サービス を作ってみよう

© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.

Amazon Rekognition

• 深層学習に基づく画像・動画分析サービス• Rekognition API に画像・動画を送るだけで簡単に対象物・⼈やテキス

トの検出、シーン・アクティビティ認識や不適切コンテンツの検出ができる

• 顔認識の API を利⽤すると、⼤規模な画像のコレクションの中から似た顔を⾒つけることができる

Page 10: 201910 AWSInnovate AIML-AutoCheckIn · 2019-11-05 · © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. AI 顔認証イベント受付サービス を作ってみよう

© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.

Amazon Rekognition による顔認識コレクション内での顔の検索

1. コレクションの作成2. 顔の登録3. 顔の検索

Page 11: 201910 AWSInnovate AIML-AutoCheckIn · 2019-11-05 · © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. AI 顔認証イベント受付サービス を作ってみよう

© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.

Amazon Rekognition による顔認識

• CreateCollection でコレクションを作成• コレクションを作成すると、最新バージョンの顔検出モデルに関連付けられる

コレクション内での顔の検索

Page 12: 201910 AWSInnovate AIML-AutoCheckIn · 2019-11-05 · © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. AI 顔認証イベント受付サービス を作ってみよう

© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.

Amazon Rekognition による顔認識

• IndexFaces オペレーションで、⼊⼒イメージ (JPEG または PNG) 内の顔を検出し、これを指定されたコレクションに追加• 顔の特徴に関する多次元情報 (特徴ベクトル) を抽出し、その情報を顔コレクションに保存• ⾃動的に割り振られる顔 ID だけでなく、ExternalImageId を指定することも可能• 詳細はドキュメント「コレクションへの顔の追加」をご覧下さい

コレクション内での顔の検索

Page 13: 201910 AWSInnovate AIML-AutoCheckIn · 2019-11-05 · © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. AI 顔認証イベント受付サービス を作ってみよう

© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.

Amazon Rekognition による顔認識

• SearchFacesByImage で、送った画像に似た登録済みの顔 ID を検索• FaceMatchThreshold というパラメータで類似度の閾値を設定することができる• 詳細はドキュメント「コレクション内での顔の検索」• これとは別に、2枚の画像を使って「イメージ間の顔の⽐較」を⾏う⽅法もある

コレクション内での顔の検索

Page 14: 201910 AWSInnovate AIML-AutoCheckIn · 2019-11-05 · © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. AI 顔認証イベント受付サービス を作ってみよう

© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.

import boto3

client = boto3.client('rekognition')

client.create_collection(

CollectionId=‘InnovateFaceCollection’ #分かりやすい名前を付ける

)

AWS SDK for Python (boto3) でコレクションの作成

Page 15: 201910 AWSInnovate AIML-AutoCheckIn · 2019-11-05 · © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. AI 顔認証イベント受付サービス を作ってみよう

© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.

client.index_faces(

CollectionId='InnovateFaceCollection',

Image={

'S3Object': {

'Bucket': 'innovate-ai-reception',

'Name': 'yoshitaka.jpeg'

}

},

ExternalImageId='Yoshitaka'

)

AWS SDK for Python (boto3) で顔の登録

Page 16: 201910 AWSInnovate AIML-AutoCheckIn · 2019-11-05 · © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. AI 顔認証イベント受付サービス を作ってみよう

© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.

with open('face.jpeg', 'rb') as image:

response = client.search_faces_by_image(

CollectionId='InnovateFaceCollection',

Image={'Bytes': image.read()}

)

print(response['FaceMatches'][0])

{'Similarity': 99.86331176757812,

'Face': {'FaceId': 'b4340821-c006-40c8-aa9a-553650577ff9’,

'BoundingBox': {'Width': 0.5504249930381775, 'Height': 0.5131639838218689, 'Left': 0.21713200211524963, 'Top': 0.25286099314689636},

'ImageId': 'ebf11b5e-8233-30c3-bcba-a1bd68969459’,

'ExternalImageId': 'Yoshitaka’,

'Confidence': 99.99979400634766}}

AWS SDK for Python (boto3) で顔の検索

Page 17: 201910 AWSInnovate AIML-AutoCheckIn · 2019-11-05 · © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. AI 顔認証イベント受付サービス を作ってみよう

© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.

Page 18: 201910 AWSInnovate AIML-AutoCheckIn · 2019-11-05 · © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. AI 顔認証イベント受付サービス を作ってみよう

© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.

顔認証イベント受付サービスに求められる機能Reception desk

GuestName USB Camera

Operator

AWS Cloud

Image (bytes)

{“Name”: “Yoshitaka”, “Similarity”: 99.86}

Page 19: 201910 AWSInnovate AIML-AutoCheckIn · 2019-11-05 · © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. AI 顔認証イベント受付サービス を作ってみよう

© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.

⼀般的なサーバーレス REST API の構成AWS Cloud

Amazon API Gateway

Amazon DynamoDB

AWS Lambda

Data access (boto3)

Lambda proxyHTTPS requestClient

Page 20: 201910 AWSInnovate AIML-AutoCheckIn · 2019-11-05 · © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. AI 顔認証イベント受付サービス を作ってみよう

© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.

サーバーレス AI サービスAWS Cloud

Amazon Rekognition

Amazon API Gateway

Amazon DynamoDB

AWS Lambda

Data access (boto3)

Lambda proxy

ClientHTTPS request

Page 21: 201910 AWSInnovate AIML-AutoCheckIn · 2019-11-05 · © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. AI 顔認証イベント受付サービス を作ってみよう

© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.

顔認証イベント受付サービスのアーキテクチャ

Lambda function

S3 Bucket Photo + Name

Reception desk

GuestName

ImageUSB Camera

FaceID

Amazon Cognito

AmazonAPI Gateway

OperatorAmazon DynamoDB

Amazon Rekognition

Amazon CloudWatch

AWS Cloud

Page 22: 201910 AWSInnovate AIML-AutoCheckIn · 2019-11-05 · © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. AI 顔認証イベント受付サービス を作ってみよう

© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.

GuestName

顔認証イベント受付サービスのアーキテクチャReception desk

USB Camera

Amazon Cognito

AmazonAPI Gateway

OperatorAmazon DynamoDB

Amazon Rekognition

Amazon CloudWatch

Lambda function

S3 Bucket

AWS Cloud

Photo + Name

Image

FaceID

Page 23: 201910 AWSInnovate AIML-AutoCheckIn · 2019-11-05 · © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. AI 顔認証イベント受付サービス を作ってみよう

© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.

Photo + Name

顔認証イベント受付サービスのアーキテクチャ

Lambda function

S3 Bucket

Reception desk

GuestName

ImageUSB Camera

FaceID

Amazon Cognito

AmazonAPI Gateway

OperatorAmazon DynamoDB

Amazon Rekognition

Amazon CloudWatch

AWS Cloud

Page 24: 201910 AWSInnovate AIML-AutoCheckIn · 2019-11-05 · © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. AI 顔認証イベント受付サービス を作ってみよう

© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.

Page 25: 201910 AWSInnovate AIML-AutoCheckIn · 2019-11-05 · © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. AI 顔認証イベント受付サービス を作ってみよう

© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.

実装のためのガイド• AWS Lambda は3つの関数 (コレクション作成・画像登録・検索) を作成

• 表⽰⽤に顔 ID と名前などの参加者情報を Amazon DynamoDB に保存• 名前は画像登録時にファイル名やメタデータとして渡す• 受付した際、タイムスタンプをつけて DynamoDB のアイテムを更新する

• AWS CloudFormation テンプレートを AWS ソリューション“Auto Check-in App” として公開予定

Page 26: 201910 AWSInnovate AIML-AutoCheckIn · 2019-11-05 · © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. AI 顔認証イベント受付サービス を作ってみよう

© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.

顔の登録に関するベストプラクティス• 以下の条件を満たす顔写真を⽤いる• 顔が推奨される⾓度範囲内を向いている• ピッチが下向き 30 度未満、上向き 45 度未満。ヨーイングはどちらの⽅向にも 45 度未満• IndexFaces を使⽤してコレクションに登録する際、正⾯と上下左右の5枚を使⽤する

• 両⽬が開いている• 顔がピンぼけしておらず、⼈の頭全体と肩が含まれ、顔が画像の⼤部分を占めている• ヘッドバンドやマスクなど、顔を遮るものは避ける• 解像度の観点から、登録⽤の画像が⼗分に⼤きいことを確認

• ガイドラインは「顔認識⽤の⼊⼒イメージに関する推奨事項」を参照

Page 27: 201910 AWSInnovate AIML-AutoCheckIn · 2019-11-05 · © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. AI 顔認証イベント受付サービス を作ってみよう

© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.

パフォーマンスの改善• イメージのバイトを Amazon Rekognition Image に送る⽅が、S3 に

アップロードしたものを参照させるより⾼速• 詳細はドキュメント「Amazon Rekognition Image オペレーションのレイテンシー」も参照し

てください

• 検索時に写真をそのまま Rekognition に送るのではなく、画像サイズを⼩さくしたり顔の部分を切り出して送るとパフォーマンスが向上する場合がある• 顔検出には例えば OpenCV などの既存ライブラリを使⽤

• Rekognition ⾃体のパフォーマンスは CloudWatch Metrics で確認• ネットワークの遅延も考慮し、トータルでレスポンス時間を短縮できるよう設計

Page 28: 201910 AWSInnovate AIML-AutoCheckIn · 2019-11-05 · © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. AI 顔認証イベント受付サービス を作ってみよう

© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.

⼀般的なセキュリティの考慮事項• AWS IAM によるきめ細やかなアクセス制御• API Gateway には Amazon Cognito による認証• Lambda 実⾏ロールに DynamoDB Table 単位など最⼩権限の認可

• ログの取得とインフラストラクチャのセキュリティ• Amazon CloudWatch Logs でのログ取得• サーバーレスのマネージドサービス API Gateway, AWS Lambda, Amazon DynamoDB を利⽤

• 転送時・保存時のデータを暗号化• HTTPS の利⽤• Amazon S3, DynamoDB の サーバーサイド暗号化 (SSE)

Page 29: 201910 AWSInnovate AIML-AutoCheckIn · 2019-11-05 · © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. AI 顔認証イベント受付サービス を作ってみよう

© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.

Amazon Rekognition での考慮事項• Amazon Rekognition の SearchFacesByImage が返す Similarity • Similarity は0から100の範囲を取るため、適切な閾値設定が重要• 精度は Collection で使⽤されているモデルのバージョンによる

• 顔認証だけでなく、⾝分証などとの多要素認証を検討• イベントごとのセキュリティ要件に依存

• 登録⽤の写真・認証⽤の画像は保存されない• Rekognition image への⼊⼒画像は保持されず、顔から抽出された特徴ベクトルを保存・検索

• その他重要な場⾯での使⽤を検討される際はドキュメント「公共安全に関係するユースケース」も合わせてご確認ください

Page 30: 201910 AWSInnovate AIML-AutoCheckIn · 2019-11-05 · © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. AI 顔認証イベント受付サービス を作ってみよう

© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.

Page 31: 201910 AWSInnovate AIML-AutoCheckIn · 2019-11-05 · © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. AI 顔認証イベント受付サービス を作ってみよう
Page 32: 201910 AWSInnovate AIML-AutoCheckIn · 2019-11-05 · © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. AI 顔認証イベント受付サービス を作ってみよう

© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.

Page 33: 201910 AWSInnovate AIML-AutoCheckIn · 2019-11-05 · © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. AI 顔認証イベント受付サービス を作ってみよう

© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.

「思ったよりもずっと早く⼿続きが終了したので驚きました」

イベント参加者の声

Page 34: 201910 AWSInnovate AIML-AutoCheckIn · 2019-11-05 · © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. AI 顔認証イベント受付サービス を作ってみよう

© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.

「カメラの前に⽴ってすぐ認証できて、スピードに驚いた」

イベント参加者の声

Page 35: 201910 AWSInnovate AIML-AutoCheckIn · 2019-11-05 · © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. AI 顔認証イベント受付サービス を作ってみよう

© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.

「素晴らしかった︕髪型がかなり変わっていたにも関わらず、あっさり成功して驚いた」

イベント参加者の声

Page 36: 201910 AWSInnovate AIML-AutoCheckIn · 2019-11-05 · © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. AI 顔認証イベント受付サービス を作ってみよう

© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.

まとめイベント受付の課題と顔認証による解決

Amazon Rekognition の顔認識を boto3 経由で呼び出す⽅法

顔認証イベント受付サービスのアーキテクチャ

実装・運⽤時の考慮事項

Page 37: 201910 AWSInnovate AIML-AutoCheckIn · 2019-11-05 · © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. AI 顔認証イベント受付サービス を作ってみよう

Thank you!

© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.

針原 佳貴@_hariby