This application retrieves images from the Soracom Cloud Camera Service (Sorakame) using the SORACOM API, detects specific labels with Amazon Rekognition, and sends notifications via LINE Notify. You can deploy it using the AWS Serverless Application Model (SAM) template.
Please note that it runs every minute by default.
The scripts in this repository are just examples and do not guarantee their operation. Also, the content of these scripts is not intended for commercial use. Please use at your own risk.
- Regularly invoke AWS Lambda with Amazon EventBridge
- Retrieve a list of events from the last minute with the Sorakame API
- Download still images from when the event occurred
- Label the still images with Amazon Rekognition
- Notify the labeling results via LINE Notify
You can use it following the steps below.
Prepare the necessary accounts and environment.
- Prepare a camera compatible with Soracom Cloud Camera Service (A license agreement is required to use the API)
- Set up LINE Notify
- Prepare an AWS account
- Prepare authentication information (authentication key ID, authentication key) for SORACOM SAM Users
- Set up AWS Serverless Application Model (SAM)
- Prepare the necessary environment variables for deploying
sora-cam-label-detection-with-rekognition
.- soracomAuthKeyId: Authentication key ID for SORACOM SAM user
- soracomAuthKey: Authentication key for SORACOM SAM user
- deviceId: Device ID of the Sorakame compatible camera
- lineNotifyToken: LINE Notify token
- rekognitionRegion: Amazon Rekognition region
- targetLabelName: Name of the label you want to detect
- targetConfidence: Detect labels with this confidence or higher
- Build and deploy
sora-cam-label-detection-with-rekognition
- Use
sam build
sam deploy --guided --capabilities CAPABILITY_NAMED_IAM
- Use
NOTE: If sam build
fails due to a PythonPipBuilder:ResolveDependencies
error, run pip install wheel
or pip3 install wheel
and try again.
NOTE: If you're running from CloudShell, install Python 3.9 on CloudShell. You can build and deploy with the following steps:
script/cloudshell_install_python39.sh
python3.9 -m venv .venv
source .venv/bin/activate
pip install wheel
sam build
sam deploy --guided --capabilities CAPABILITY_NAMED_IAM
Applications deployed with SAM can be deleted using the sam delete
command, or from the CloudFormation menu in the AWS Console.