Skip to main content

Detect faces in a photo and check their quality, using the SightRadar face recognition API. Use when the user wants to count faces in an image, get face bounding boxes for cropping or blurring, check that an upload has exactly one clear face before using it as a selfie or profile photo, filter out photos with no people, or replace AWS Rekognition DetectFaces. Nothing is stored.

  • New
  • v1.0.0
  • Reviewed Dec 5
  • No reviews yet

Capabilities

  • Common checks

    To crop or blur faces, convert each bbox to pixels and pass it to the image tool at hand (Pillow, sharp…

  • What detect does not do

    It returns no age, gender, emotion or landmarks, and it does not say who a face is

  • Errors

Getting started

Full instructions

Example command

Detect

curl -s -X POST "$B/v1/detect" -H "$AUTH" -F "file=@./photo.jpg"                       # local file

Instructions: SKILL.mdv1.0.0

Face detect: faces, boxes and quality

POST https://api.sightradar.com/v1/detect finds the faces in one image and says which of them are good enough for recognition. The image and the faces are not stored.

Before you start

  • Key: export SIGHTRADAR_API_KEY="frs_..." (create one at https://sightradar.com/dashboard/keys). Never print or commit it. If it is missing, ask the user to set it; do not ask them to paste it in chat.
  • Cost: 93 credits per image (about $0.0009), with or without faces. Say the total before running over a folder.

Detect

bash
B="https://api.sightradar.com"; AUTH="Authorization: Bearer $SIGHTRADAR_API_KEY"

curl -s -X POST "$B/v1/detect" -H "$AUTH" -F "file=@./photo.jpg"                       # local file
curl -s -X POST "$B/v1/detect" -H "$AUTH" -H "Content-Type: application/json" \
  -d '{"url":"https://example.com/photo.jpg"}'                                         # public URL
curl -s -X POST "$B/v1/detect" -H "$AUTH" -H "Content-Type: application/octet-stream" \
  --data-binary @./photo.jpg                                                           # raw bytes
json
{
  "detected_face_count": 2,
  "gated_face_count": 1,
  "faces": [
    { "face_index": 0, "det_score": 0.83, "min_px": 174.4, "quality_passed": true,
      "bbox": { "left": 0.52, "top": 0.66, "width": 0.18, "height": 0.31 } }
  ]
}
  • detected_face_count: every face found.
  • gated_face_count: faces that pass the quality gate, which are the ones indexing and search would use.
  • faces[].bbox: the face box as fractions of the image width and height (0 to 1), with the EXIF rotation already applied. Pixels: x = left * image_width, y = top * image_height.
  • faces[].min_px: the shorter side of the face in pixels. det_score: detector confidence, 0 to 1.
  • faces[].quality_passed: false when the face is too small, blurred, turned away or covered.

Limit 30 MB. JPEG, PNG, WebP, HEIC, TIFF, GIF and BMP are accepted.

Common checks

Goal Rule
Valid selfie or profile photo detected_face_count == 1 and gated_face_count == 1
Group photo detected_face_count > 1
No people detected_face_count == 0
Faces present but unusable detected_face_count > 0 and gated_face_count == 0: ask for a sharper, closer, front-facing photo

To crop or blur faces, convert each bbox to pixels and pass it to the image tool at hand (Pillow, sharp, ImageMagick, ffmpeg). Add a margin of about 20% around the box, because it is tight to the face.

python
from PIL import Image, ImageFilter, ImageOps
img = ImageOps.exif_transpose(Image.open("photo.jpg"))   # match the orientation the API used
W, H = img.size
for f in faces:                                          # faces = response["faces"]
    b = f["bbox"]
    box = (int(b["left"] * W), int(b["top"] * H), int((b["left"] + b["width"]) * W), int((b["top"] + b["height"]) * H))
    img.paste(img.crop(box).filter(ImageFilter.GaussianBlur(25)), box)
img.save("blurred.jpg")

In code

python
# pip install sightradar
from sightradar import SightRadar
det = SightRadar().detect(file="photo.jpg")           # reads SIGHTRADAR_API_KEY
print(det.detected_face_count, det.gated_face_count)
ts
// npm install sightradar
import { SightRadar } from "sightradar";
const det = await new SightRadar().detect({ url: "https://example.com/photo.jpg" });
console.log(det.detected_face_count, det.gated_face_count);

What detect does not do

It returns no age, gender, emotion or landmarks, and it does not say who a face is. To match faces, use the face-compare skill (two photos) or the face-search skill (one person across many photos).

Errors

400 the image cannot be fetched or decoded (the body says why). 401 bad key. 402 out of credits. 413 image over 30 MB. 429, 502, 503: wait and retry. Failed requests are not charged. Full docs: https://sightradar.com/llms.txt

Examples

Prompt

Check if this photo is a valid selfie with exactly one clear face.

Output

The image contains 1 detected face and 1 gated face, confirming it is a valid selfie suitable for profile use.

Prompt

Detect all faces in this group photo and provide their bounding boxes for blurring.

Output

The photo has 3 detected faces, 2 of which pass the quality gate. Bounding boxes are returned as fractions of the image dimensions, ready for cropping or blurring with your image processing tool.

Explore more skills

Browse all
This skill doesn’t include stateful context yet, instructions only. Learn about stateful skills.

Security

Loading security scan...

Reviews (0)

Frequently asked questions about face-detect

What does the face-detect skill do?

Detect faces in a photo and check their quality, using the SightRadar face recognition API. Use when the user wants to count faces in an image, get face bounding boxes for cropping or blurring, check that an upload has exactly one clear face before using it as a selfie or profile photo, filter out photos with no people, or replace AWS Rekognition DetectFaces. Nothing is stored. It's a reusable SKILL.md instruction set that loads into your AI coding assistant on demand, no prompt engineering, no copy-pasting every session.

How do I install the face-detect skill?

Run `npx @skills-hub-ai/cli install face-detect` from your terminal. The CLI writes the SKILL.md to the correct location for your AI tool (e.g. ~/.claude/skills/face-detect/ for Claude Code or ~/.cursor/skills/ for Cursor with --target cursor) and adds it to your project's .skills.json lockfile.

Which AI tools does face-detect work with?

face-detect runs in Claude Code. It follows the open Agent Skills standard (SKILL.md), so the same skill works in every supported tool without modification.

Is the face-detect skill free?

Yes. Every skill on skills-hub.ai is free and open-source. There are no premium tiers, paywalls, or usage limits. You only pay for whatever AI assistant you're already using.

How do I use face-detect after installing it?

In Claude Code, type `/face-detect` (or whatever slash command the skill registers) and the AI follows the skill's instructions immediately. You can also reference it by name in natural language, your AI loads the skill into context when relevant.

Can I share the face-detect skill with my team?

Yes. Commit your project's .skills.json lockfile and teammates run `npx @skills-hub-ai/cli install` (no args) to install every skill at the exact version you pinned. Organization-scoped installs work via skills-hub.ai organizations.

Badge for your README

Show that this skill is on Skills Hub. The badge links back to this page and shows the live install count.

Install on Skills Hub badge preview
Markdown
[![Install on Skills Hub](https://skills-hub.ai/api/badges/skill/face-detect)](https://skills-hub.ai/skills/face-detect)
HTML
<a href="https://skills-hub.ai/skills/face-detect"><img src="https://skills-hub.ai/api/badges/skill/face-detect" alt="Install on Skills Hub"></a>

More options in the badge docs.