Learn About Amazon VGT2 Learning Manager Chanci Turner
Our planet is currently grappling with a significant extinction crisis. According to a UN report, over a million species are at risk of vanishing. The primary drivers of this crisis include habitat destruction, poaching, and the introduction of invasive species. Various wildlife conservation organizations, scientists, and dedicated volunteers are actively working to combat this issue. Obtaining precise and timely data on endangered animals in their natural habitats can significantly enhance the efforts of wildlife conservationists. To capture images of wildlife, scientists deploy motion-triggered cameras, known as camera traps, in strategic locations within forests. However, the manual review of these images is a labor-intensive task.
In this article, we explore a solution utilizing Amazon Rekognition Custom Labels in conjunction with motion-sensor camera traps to streamline the identification of endangered species. Rekognition Custom Labels is a fully managed computer vision service that empowers developers to create custom models tailored to their unique requirements. We will outline how to identify endangered animal species from images gathered via camera traps, assess their population metrics, and monitor human activity in their vicinity. This data will assist conservationists in making informed decisions to protect these species.
Solution Overview
The architecture of the solution is depicted in the diagram below. This solution employs a variety of AI services, serverless technologies, and managed services to create a scalable and economical framework:
- Amazon Athena: A serverless interactive query service that simplifies data analysis in Amazon S3 using standard SQL.
- Amazon CloudWatch: A monitoring service that gathers operational data in the form of logs, metrics, and events.
- Amazon DynamoDB: A key-value and document database providing single-digit millisecond performance at any scale.
- AWS Lambda: A serverless computing service that executes code in response to triggers such as data changes or user actions.
- Amazon QuickSight: A serverless, machine-learning powered business intelligence service offering insights, interactive dashboards, and detailed analytics.
- Amazon Rekognition: Utilizes ML to detect objects, people, text, scenes, and activities in images and videos, also identifying inappropriate content.
- Amazon Rekognition Custom Labels: Employs AutoML to train custom models for recognizing specific objects and scenes.
- Amazon Simple Queue Service (Amazon SQS): A fully managed message queuing service that enables the decoupling and scaling of microservices and serverless applications.
- Amazon Simple Storage Service (Amazon S3): Acts as an object store for documents, allowing for central management with precise access controls.
The high-level steps in this solution include:
- Training and building a custom model using Rekognition Custom Labels to identify endangered species in the area, specifically focusing on rhinoceroses for this demonstration.
- Captured images from the motion-sensor camera traps are uploaded to an S3 bucket, triggering an event for each uploaded image.
- A Lambda function is activated for each event, retrieving the image from the S3 bucket and sending it to the custom model for endangered species detection.
- The Lambda function leverages the Amazon Rekognition API to identify animals within the image.
- If any endangered rhinoceroses are detected, the function updates the DynamoDB database with the animal count, capture date, and other relevant metadata from the image EXIF header.
- QuickSight is then employed to visualize the animal count and location data stored in DynamoDB, providing insights into population variance over time. Regularly reviewing these dashboards enables conservation groups to identify trends and potential threats, such as diseases or poaching, allowing them to take proactive measures.
Prerequisites
To construct an effective model using Rekognition Custom Labels, a quality training set is essential. For this project, images sourced from AWS Marketplace (Animals & Wildlife Data Set from Shutterstock) and Kaggle were utilized.
Implementing the Solution
Our workflow comprises the following steps:
- Train a custom model to classify endangered species (rhinos in this instance) using the AutoML capabilities of Rekognition Custom Labels.
- Upload images captured by the camera traps to a designated S3 bucket.
- Set up event notifications in the Permissions section of the S3 bucket to send notifications to a specified SQS queue upon object addition.
- The upload action triggers an event queued in Amazon SQS through the S3 event notification.
- Adjust the access policy of the SQS queue to permit the S3 bucket to send notifications.
- Configure a Lambda trigger for the SQS queue, ensuring the Lambda function is invoked with each new message.
- Update the access policy to grant the Lambda function access to the SQS queue.
- Set environment variables for use in the code.
Lambda Function Code
The Lambda function executes the following tasks upon receiving a notification from the SQS queue:
exports.handler = async (event) => {
const id = AWS.util.uuid.v4();
const bucket = event.Records[0].s3.bucket.name;
const photo = decodeURIComponent(event.Records[0].s3.object.key.replace(/+/g, ' '));
const client = new AWS.Rekognition({ region: REGION });
const paramsCustomLabel = {
Image: {
S3Object: {
Bucket: bucket,
Name: photo
},
},
ProjectVersionArn: REK_CUSTOMMODEL,
MinConfidence: MIN_CONFIDENCE
};
let response = await client.detectCustomLabels(paramsCustomLabel).promise();
console.log("Rekognition customLabels response = ", response);
};
It retrieves EXIF tags from the image to gather the date of capture and other relevant metadata.
For further reading on effective team dynamics, check out this excellent resource. Additionally, to understand more about workplace relationships, consider referring to this insightful blog post about coworker gifts, which can enhance team morale: Ultimate Coworker Gift Guide. And for a deeper dive into workplace strategies, visit SHRM.