Most Rekognition integrations start here. DetectLabels is the pretrained operation that answers "what is in this image" with a ranked list of objects, scenes, and concepts - the backbone of auto-tagging, content search, and catalog enrichment.
This page goes past the basic call shown earlier in this section into the shape of the full response: label hierarchies, bounding boxes for countable objects, category filters, and the optional image-properties feature for dominant colors.
Detect labels for a catalog photo, read the category hierarchy, pull bounding boxes for countable objects, and grab the image's dominant colors in the same call.
# --- Python (boto3) ---import boto3rekognition = boto3.client("rekognition")response = rekognition.detect_labels( Image={"S3Object": {"Bucket": "my-bucket", "Name": "catalog/sneaker.jpg"}}, MaxLabels=15, MinConfidence=75, Features=["GENERAL_LABELS", "IMAGE_PROPERTIES"],)for label in response["Labels"]: parents = [p["Name"] for p in label.get("Parents", [])] print(f"{label['Name']} ({label['Confidence']:.1f}) - under {parents}") for instance in label.get("Instances", []): print(" box:", instance["BoundingBox"])colors = response.get("ImageProperties", {}).get("DominantColors", [])for color in colors[:3]: print("dominant color:", color["SimplifiedColor"], color["PixelPercent"])
Every label can carry a Parents list, forming a tree from specific to general. "Golden Retriever" might roll up through "Dog" and "Canine" to "Animal". This lets you tag at whatever granularity a use case needs - narrow for precise search, broad for filtering.
You can filter by name or by category directly in the request instead of post-processing the response, using Settings.GeneralLabels with LabelInclusionFilters, LabelExclusionFilters, LabelCategoryInclusionFilters, and LabelCategoryExclusionFilters. This moves filtering server-side, which reduces response size and simplifies client code.
Only labels for countable, localizable things (people, vehicles, animals) include Instances. Abstract labels like "Outdoors" or "Daytime" describe the whole image and never carry bounding boxes. If your use case is "how many people are in this frame", read len(label["Instances"]) for the Person label rather than trying to count a scene label.
Features: ["IMAGE_PROPERTIES"] runs a separate analysis alongside labels and returns overall image quality (Quality.Brightness, Quality.Sharpness, Quality.Contrast) plus DominantColors, each with an RGB value, a SimplifiedColor name, and the percentage of pixels it covers. This is useful for building "find visually similar" search without a separate color-analysis step.
MinConfidence (default 55) filters weak matches before they reach you; raise it for a cleaner but shorter list, lower it if you would rather see borderline candidates and filter client-side. MaxLabels (default 1,000) caps the response size - most catalog use cases set it in the 10-20 range since relevance drops fast past the top labels.
Treating labels as ground truth. Confidence is a model estimate, not a certainty. Fix: validate MinConfidence against a labeled sample from your own domain before trusting a threshold in production.
Expecting Instances on every label. Only countable object labels carry bounding boxes; scene and concept labels never do. Fix: check label.get("Instances") for emptiness rather than assuming it exists.
Sending images over 5 MB as bytes. The Image.Bytes path is capped at 5 MB. Fix: upload to S3 first and use S3Object for larger images, which has a higher limit.
Ignoring the category hierarchy. Filtering only on top-level label names misses synonyms and sibling labels under the same parent. Fix: use LabelCategoryInclusionFilters or walk Parents when you need category-level matching.
Assuming Features defaults include IMAGE_PROPERTIES. Only GENERAL_LABELS is returned unless you request IMAGE_PROPERTIES explicitly. Fix: pass Features: ["GENERAL_LABELS", "IMAGE_PROPERTIES"] when you need both.
Re-running DetectLabels on unchanged images. Every call is billed regardless of whether the image was analyzed before. Fix: cache results keyed by object version or content hash.
What is the difference between a label and a category?
A label is a specific detected concept ("Sneaker"); a category groups related labels ("Apparel and Accessories"). Categories come from the Parents hierarchy and can be filtered directly with LabelCategoryInclusionFilters.
Why don't all labels have bounding boxes?
Only countable, localizable objects (people, vehicles, animals, and similar) populate Instances. Whole-scene labels like "Outdoors" or "Daytime" describe the entire image and have no single location.
What does MinConfidence actually filter?
It sets the minimum confidence percentage a label must reach to be included in the response. Rekognition still runs the same analysis - the parameter only trims what comes back to you.
Can I get dominant colors without requesting labels?
IMAGE_PROPERTIES runs alongside GENERAL_LABELS in the same DetectLabels call; there is no separate operation for colors alone, so you receive Labels in the response either way.
How large can the input image be?
Up to 5 MB when sent as raw Bytes. Images stored in S3 and referenced via S3Object support a higher limit, so prefer that path for large files.
Is DetectLabels good enough for a product catalog?
For general categories, yes. For distinguishing your own SKUs or specific product variants, it usually is not - that is the gap Custom Labels is built to fill.
Can I filter out labels I don't care about server-side?
Yes, with Settings.GeneralLabels.LabelExclusionFilters or LabelCategoryExclusionFilters, which removes them from the response before it reaches you.
Does DetectLabels work on video frames?
You can extract a frame and call DetectLabels on it as a still image, but for full video coverage use the asynchronous StartLabelDetection/GetLabelDetection pair instead.