Ameba-Pro KVS Getting Started Guide
Getting Started Guide All information provided in this document is subject to legal disclaimers. © REALTEK 2020. All rights reserved.
31
8.7
The Simple Demo Code for Getting the Results Locally (Python)
A simple python code “producer_rekognition_test.py” is given in “component/common/example/kvs_producer”. We can use it to perform the
demo with AmebaPro.
Before running the python code, you should install the necessary packages (like boto3, opencv…). In addition, remember to configure basic
settings that the AWS CLI and python code uses to interact with AWS. These include your security credentials, the default output format, and
the default AWS Region, see:
https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-quickstart.html
https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-envvars.html
The step of creating a face collection is not included in python, it make it more flexible to add the person id by using command line.
Setting the information of streams in producer_rekognition_test.py:
Create a face collection:
$ aws rekognition create-collection --collection-id my-collection
Add person ID to collection:
$ aws rekognition index-faces --collection-id my-collection --image '{"S3Object":{"Bucket":"<bucket>","Name":"<key>"}}' --external-
image-id <name>
Run the python code:
$ python producer_rekognition_test.py
After finishing the python code, you should check the stream processor is stop and deleted. It can avoid unnecessary expense:
$ aws rekognition stop-stream-processor --name my-stream-processor
$ aws rekognition delete-stream-processor --name my-stream-processor