Amazon Rekognition

Amazon Rekognition is a managed computer-vision service for images and video. It provides pre-trained APIs for object and scene detection, facial analysis, text-in-image OCR, content moderation, celebrity recognition, and PPE detection — plus Custom Labels for training bespoke image classifiers with a small labeled dataset, and Face Liveness for anti-spoofing identity flows.


Key Features:


Common Use Cases:


Service Limits & Quotas:


Pricing Model:


Code Example:


import boto3

rek = boto3.client("rekognition", region_name="us-west-2")

# Detect labels in an image
labels = rek.detect_labels(
    Image={"S3Object": {"Bucket": "my-images", "Name": "warehouse/row-4.jpg"}},
    MaxLabels=10,
    MinConfidence=75,
)
for label in labels["Labels"]:
    print(f"{label['Name']:20s} {label['Confidence']:.1f}%")

# Compare a selfie to an ID photo for verification
match = rek.compare_faces(
    SourceImage={"S3Object": {"Bucket": "kyc", "Name": "selfie.jpg"}},
    TargetImage={"S3Object": {"Bucket": "kyc", "Name": "id-photo.jpg"}},
    SimilarityThreshold=90,
)
print("Match similarity:", match["FaceMatches"][0]["Similarity"] if match["FaceMatches"] else "no match")

# Search a face collection (1-to-many)
search = rek.search_faces_by_image(
    CollectionId="employees",
    Image={"S3Object": {"Bucket": "kyc", "Name": "selfie.jpg"}},
    FaceMatchThreshold=90,
    MaxFaces=1,
)
for m in search["FaceMatches"]:
    print(m["Face"]["ExternalImageId"], m["Similarity"])
  


Common Interview Questions:

When should you use Custom Labels vs SageMaker?

Use Custom Labels when you have a relatively small dataset (10–10,000 images), need a managed training experience, and standard image classification or object detection is enough. Move to SageMaker for full control over architecture, larger datasets, custom losses, on-device export, or non-image vision tasks.

How does face comparison differ from face search?

CompareFaces matches one source image against one target image (1-to-1, no storage). SearchFacesByImage matches a face against a stored Face Collection (1-to-many) — required for "find this person across our user base" workflows.

What is Face Liveness and why does it matter?

Liveness detects whether a face in a video stream belongs to a real, present person versus a printed photo, screen replay, or deepfake. Mandatory for any production identity verification flow to prevent spoofing attacks.

How does Rekognition handle moderation taxonomies?

Returns hierarchical labels (parent + child) like "Suggestive → Female Swimwear" with confidence scores. You set a threshold per category and route flagged content to manual review (often via Amazon A2I).

How do you process video efficiently?

Use the async video APIs (StartLabelDetection, StartContentModeration) on S3-hosted video. Subscribe to the SNS completion topic instead of polling. Output includes timestamped detections so you can build timelines without re-scanning frames.

What's the cost trap with Custom Labels?

Hosted models bill per inference-hour while running, regardless of traffic. Stop the model when not in use, and consolidate labels into a single project where possible to avoid hosting many small models.


Rekognition covers the common vision tasks end-to-end; reach for SageMaker when you need fully custom models, non-standard outputs, or on-premises deployment.