RetinaFace ResNet-50

RETINAFACE_RESNET50

Finds every face in a photo and returns a box around each one with five landmarks, the eyes, the nose tip and the mouth corners.

Utilitiesface-detectionfacial-landmarksretinafacemitFine-tunable
RetinaFace ResNet-50: Utilities model on Kainguru

About RetinaFace ResNet-50

Capabilities

  • Every face — small faces in crowds as well as close-ups, up to 200 per photo, best first
  • Five landmarks — eyes, nose tip and mouth corners for aligning or cropping faces
  • Pixel coordinates — boxes and points in the photo's own pixels, as JSON
  • Fine-tunable — train it on your own pictures with their face boxes

Good to know

  • Photos up to 30 MB and 40 megapixels, as PNG, JPEG or WebP. The network sees the photo scaled so its longer side is at most 1600 pixels; the boxes are returned in the photo's own pixels.
  • Detection only: it finds faces, it does not tell who they are.
  • Fine-tuning takes one ZIP (at most 4 GB, 5000 entries, no password) with 4 to 1000 pictures (each up to 30 MB and 40 megapixels) and a manifest.jsonl with one line per picture: {"file": "photos/a.jpg", "faces": [{"box": [x0, y0, x1, y1], "landmarks": [[x, y], [x, y], [x, y], [x, y], [x, y]]}]}. Paths are relative to the manifest, and manifest.jsonl is at most 16 MB.
  • Boxes and landmarks are in pixels of the picture as displayed (after its EXIF rotation). Landmarks are optional (null): a face without them trains the box only. A picture may have up to 1000 faces, or none.
  • Training letterboxes every picture to 640 x 640 pixels and mirrors half of them; it stops after 10,000 steps or 9 hours, whichever comes first, and keeps what it learned.

Attribution

RetinaFace as implemented and trained by the Pytorch_Retinaface project (biubug6), released under the MIT License, Copyright (c) 2019.

RetinaFace ResNet-50 inputs and output

NameTypeRequiredDefaultDetails
imagefileYes—The picture: PNG, JPEG or WebP, at most 30 MB and 40 megapixels.
1–2048 characters · image/png, jpeg, webp
score_thresholdnumberNo0.6Lowest score of a returned face, 0 to 1; higher returns fewer, surer faces.
0–1
max_facesintegerNo50The most faces to return, best first.
1–200

Output. JSON array, best first: [{"score": 0.99, "box": [x0, y0, x1, y1], "landmarks": [[x, y], ...]}], in pixels of the picture; landmarks: eyes, nose tip, mouth corners, left to right as seen. At most 200 faces.

Run RetinaFace ResNet-50 with the API

Send your API key in the X-API-Key header. The run is asynchronous: submit it, then poll it until it finishes. Create an API key.

cURL
curl -X POST "https://api.kainguru.com/api/v1/executions?mlFlowId=RETINAFACE_RESNET50" \
  -H "X-API-Key: kg_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
  "input": {
    "image": "https://example.com/input.png",
    "max_faces": 50,
    "score_threshold": 0.6
  },
  "outputFormat": "json"
}'

# Poll until the execution reaches a terminal state
curl "https://api.kainguru.com/api/v1/executions/{executionId}" \
  -H "X-API-Key: kg_your_api_key"
Python
from kainguru import KainguruClient

with KainguruClient(api_key="kg_your_api_key", base_url="https://api.kainguru.com/api") as client:
    submitted = client.executions.execute(
        "RETINAFACE_RESNET50",
        {
          "image": "https://example.com/input.png",
          "max_faces": 50,
          "score_threshold": 0.6
        },
        output_format="json",
    )
    result = client.executions.await_completion(submitted.id)
    print(result.execution.output)

Fine-tune RetinaFace ResNet-50

You can fine-tune RetinaFace ResNet-50 on your own data and run the tuned model through the same API. Dataset: One ZIP (at most 4 GB, no password) with 4 to 1000 pictures and a manifest.jsonl: one line per picture, {"file", "faces": [{"box", "landmarks"}]} in pixels. More rules: Good to know, in the README.

The steps are in the docs.

RetinaFace ResNet-50 pricing

Price per request: 0.0437 credits ($0.000437). The price is shown again before every run; all prices are on the pricing page.

Licence and source

YuNet Face Detection: Utilities model on Kainguru
Utilities

YuNet Face Detection

Fast face detection that returns a box around every face in a photo and five landmarks, the eyes, the nose tip and the…

Fine-tunable
BiRefNet General: Utilities model on Kainguru
Utilities

BiRefNet General

Removes the background from a photo and returns the subject on a transparent background, or as a black-and-white mask.

Fine-tunable
Cloth Segmentation U2-Net: Utilities model on Kainguru
Utilities

Cloth Segmentation U2-Net

Finds the clothes a person wears in a photo and returns a mask for the upper body, the lower body and full-body…

Fine-tunable
EoMT Large COCO Panoptic: Utilities model on Kainguru
Utilities

EoMT Large COCO Panoptic

Splits a picture into its objects and regions, such as people, cars, sky and road, with a label and a mask for each one.

Fine-tunable
InSPyReNet: Utilities model on Kainguru
Utilities

InSPyReNet

Removes the background from a photo with fine detail at hair and edges, and returns the subject on a transparent…

Fine-tunable
MoGe-2 ViT-L Normal: Utilities model on Kainguru
Utilities

MoGe-2 ViT-L Normal

Estimates metric depth, surface normals and the camera's field of view from a single photo of any scene, indoors or out.

Fine-tunable