1
0

More than 3 years have passed since last update.

AWS rekognitionで、ローカルの画像ファイルを認識させる方法

Posted at

TL;DR

'Bytes'というkeyのvalueにバイナリデータを入れて、Imageに渡す

import boto3

client = boto3.client('rekognition')

with open('image.jpg', 'rb') as f:
    response = client.search_faces_by_image(
        CollectionId='string',
        Image={
            'Bytes': f.read()
        }
    )

その他の事例

世の中のサンプルでは、s3に格納した画像ファイルを渡す事例が圧倒的に多かった。
s3から渡す場合は、bucket名とObject名を渡せば解析できる。

response = client.search_faces_by_image(
    CollectionId='string',
    Image={
        'S3Object': {
            'Bucket': 'string',
            'Name': 'string',
            'Version': 'string'
        }
    },
)
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0