AWS Rekognition to SNS

1

Hello, I have set up Kinesis Video - Kinesis Data Streams with Rekognition so that a face that is shown in front of my webcam is compared to a picture that I have uploaded into S3.

I can see from the "data preview" within a record in Kinesis data streams that a face is recognized as desired, but I would like to make it so that if a certain face is detected (via faceID), an alert is sent via SNS regarding the payload of the record that is shown in Kinesis data streams.

I believe that this can be done via Eventbridge pipes but I am not sure how to get the correct filter set up. I would like to set it up so that when a record is found with the FaceID as shown below, then send an email via SNS with the record below:

{

"InputInformation": {

"KinesisVideo": {

"StreamArn": "arn:aws:kinesisvideo:us-east-1:237434669218:stream/kaldi/1695283330882",

"FragmentNumber": "91343852333181620708120838749119373902959965155",

"ServerTimestamp": 1695613363.46,

"ProducerTimestamp": 1695613358.782,

"FrameOffsetInSeconds": 0.9739999771118164

}

},

"StreamProcessorInformation": {

 "Status": "RUNNING"

},

"FaceSearchResponse": [

{

  "DetectedFace": {
    
    "BoundingBox": {
     
       "Height": 0.24642423,
        
    "Width": 0.15441418,
        
    "Left": 0.4637209,
      
      "Top": 0.3429617
        
},
      
  "Confidence": 99.99462,
        
"Landmarks": [
         
   {
              
  "X": 0.5266707,
               
 "Y": 0.44316232,
            
    "Type": "eyeLeft"

                },

                {

                    "X": 0.58807695,

                    "Y": 0.43760425,

                    "Type": "eyeRight"

                },

                {

                    "X": 0.53079176,

                    "Y": 0.5369772,

                    "Type": "mouthLeft"

                },

                {

                    "X": 0.582353,

                    "Y": 0.53203446,

                    "Type": "mouthRight"

                },

                {

                    "X": 0.5700108,

                    "Y": 0.50527626,

                    "Type": "nose"

                }

            ],

            "Pose": {

                "Pitch": -24.09738,

                "Roll": -4.106561,

                "Yaw": 16.596313

            },

            "Quality": {

                "Brightness": 78.15648,

                "Sharpness": 20.92731

            }

        },

        "MatchedFaces": [

            {

                "Similarity": 99.984825,

                "Face": {

                    "BoundingBox": {

                        "Height": 0.445171,

                        "Width": 0.419821,

                        "Left": 0.308388,

                        "Top": 0.16587

                    },

                    "FaceId": "5dbbfa77-98a4-4932-ac91-c0fad800e0c6",

                    "Confidence": 99.9999,

                    "ImageId": "fbf8786d-917c-3b9a-aa9c-2b43537d6446"

                }

            }

        ]

    }

]

}

1 Answer
1
Accepted Answer

Hi John,

You can follow this blog post to create a similar pattern to notify via SNS: https://aws.amazon.com/blogs/machine-learning/easily-perform-facial-analysis-on-live-feeds-by-creating-a-serverless-video-analytics-environment-with-amazon-rekognition-video-and-amazon-kinesis-video-streams/

Especially, look at the CloudFormation template provided to understand the resources and configuration clearly. A similar template is posted here, just for your reference: https://gist.github.com/mcfantom-3xm/d72b6f63059218cb930ccaaa87736d47

Please let me know if this is what you're looking for.

Thanks!

profile picture
answered 7 months ago
  • Hey thank you for responding! I was able to look at that guide and actually get it working but lambda function is not what I thought it would be. If I stay in the frame for like a few minutes it keeps sending me an email continuously and says that it detected 100 matching faces. I guess this is something that I need to look into.

    Thank you

  • I am glad that it worked for you! Regarding the email spam issue, you can modify the logic to detect unique faces within a given timeframe, and avoid sending multiple notifications.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions