API Reference

Detect objects in image

Automatically detect removable objects in an image. Use the optional lang parameter to choose the language of returned object class names.

You can pass the returned session_id and selected detected_objects item to the Remove Objects API.

Supported lang values: en (English), es (Spanish), id (Indonesian), jp (Japanese), ms (Malay), pt (Portuguese), th (Thai), vi (Vietnamese).

Model:object-detection
Credit:1
post/v1/images/detect-objects

Authorization — This endpoint requires an API key. Pass it in the api-key header on every request. Learn more

Average processing time

Per request.

Processing time
≈ 1.2 s

Input requirements

Images

Formats
JPEG, PNG, WEBP
Maximum resolution
3000 × 3000 px
View all input requirements

Parameters

NameTypeStatusDescription
input_image
fileRequiredImage file or URL to detect objects in.
lang
stringOptionalLanguage for object class names.(default: en)

Responses

Objects detected successfullyDetectionResponse

FieldTypeDescription
session_idstringSession ID for the processed image. Pass as `original_session_id` to the Remove Objects API.
detected_objectsobject[]Detected regions sorted by confidence (descending)
boxnumber[]Bounding box [x1, y1, x2, y2]
maskstringBase64-encoded RGBG mask (same resolution as bbox)
accuracynumberConfidence score (0.0 to 1.0)
object_typestringDetection category
object_descriptionstringDetection class name
curl -X POST "https://api.snapedit.app/v1/images/detect-objects" \
  -H "api-key: YOUR_API_KEY" \
  -F "input_image=@./image.jpg" \
  -F "lang=en"
Response
{
  "session_id": "sess_abc123",
  "detected_objects": [
    {
      "box": [
        120,
        50,
        300,
        400
      ],
      "mask": "base64_encoded_data...",
      "accuracy": 0.95,
      "object_type": "person",
      "object_description": "person"
    }
  ]
}

Examples (1 example)

Input

Input 1

Output

Output