Depth Anything v2 Small

DEPTH_ANYTHING_V2_SMALL

Turns any photo into a depth map that shows which parts are near and which are far.

Utilitiesdepth-estimationrelative-depthapache-2.0Fine-tunable
Depth Anything v2 Small: Utilities model on Kainguru

About Depth Anything v2 Small

Capabilities

  • Any scene — indoor and outdoor photos, close-ups and landscapes
  • Relative depth — near and far for every pixel, as a 16-bit PNG where bright is near
  • Colour preview — a colour depth map for viewing, near is bright
  • Fine-tuning — adapt it with your own photo and depth-map pairs

Good to know

  • The values are relative, not metres; each depth map is scaled to its own picture.
  • Training depth maps are 16-bit grayscale PNGs of their photo's size as displayed, at most 50 MB, holding the distance from the camera (larger = farther, 0 = unknown), not this model's own nearness output.
  • Training pairs are centre-cropped to 518 x 518 pixels; a pair with fewer than 16 pixels of usable depth there is left out.
  • Training photos are as for a run: PNG, JPEG or WebP, at most 50 MB and 40 megapixels, at least 32 pixels a side and at most 4:1.
  • In the training ZIP, manifest.jsonl is at most 10 MB and its paths are relative to it.

Depth Anything v2 Small inputs and output

NameTypeRequiredDefaultDetails
imagefileYes—The photo: PNG, JPEG or WebP, at most 50 MB and 40 megapixels, at least 32 pixels a side and at most 4:1. The depth map has the photo's size, scaled down to 2048 pixels on the longer side.
1–2048 characters · image/png, jpeg, webp
outputtextNopng16png16: a 16-bit grayscale PNG with the raw depth (metric models: millimetres; relative models: nearness scaled to 0-65535). colormap: a colour picture for viewing, near is bright.
Allowed: png16, colormap

Output. Returns PNG image: The depth map as a PNG (16-bit grayscale or a colour picture, as chosen in output).

Run Depth Anything v2 Small 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=DEPTH_ANYTHING_V2_SMALL" \
  -H "X-API-Key: kg_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
  "input": {
    "image": "https://example.com/input.png",
    "output": "png16"
  },
  "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(
        "DEPTH_ANYTHING_V2_SMALL",
        {
          "image": "https://example.com/input.png",
          "output": "png16"
        },
        output_format="json",
    )
    result = client.executions.await_completion(submitted.id)
    print(result.execution.output)

Fine-tune Depth Anything v2 Small

You can fine-tune Depth Anything v2 Small on your own data and run the tuned model through the same API. Dataset: One ZIP (at most 4 GB, 5000 entries, no password) with 4 to 1000 photos, a depth map for each and a manifest.jsonl with one {"file", "depth"} line per pair. Depth maps are 16-bit grayscale PNGs of distance. More rules: Good to know, in the README.

The steps are in the docs.

Depth Anything v2 Small pricing

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

Licence and source

SAM 2.1 Hiera Large: Utilities model on Kainguru
Utilities

SAM 2.1 Hiera Large

Click or draw a box on an object and get back a mask outlining it.

Fine-tunable
Grounded SAM 2: Utilities model on Kainguru
Utilities

Grounded SAM 2

Outlines the things you name in a picture, such as "red car, person with a helmet", with a mask and a box for each one.

Fine-tunable
DWPose Wholebody: Utilities model on Kainguru
Utilities

DWPose Wholebody

Finds every person in a photo and returns 133 keypoints for each: body, feet, face and both hands, as JSON in the…

Fine-tunable
LightGlue DISK: Utilities model on Kainguru
Utilities

LightGlue DISK

Finds the points two pictures have in common and pairs them up: send two photos of one scene and get the matching…

Fine-tunable
MODNet Portrait Matting: Utilities model on Kainguru
Utilities

MODNet Portrait Matting

Cuts people out of photos with a soft alpha matte that keeps hair and fine edges, and returns the cutout or the matte…

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