Inpaint Mask Maker

Real-Time Open-Vocabulary Object Detection

~8.06s
~$0.005
 1import requests
 2import json
 3
 4url = "https://api.segmind.com/v1/inpaint-mask-maker"
 5headers = {
 6    "x-api-key": "YOUR_API_KEY",
 7    "Content-Type": "application/json"
 8}
 9
10data = {
11    "prompt": "white horse",
12    "image": "https://segmind-sd-models.s3.amazonaws.com/display_images/inpaint-mask-maker-input.jpg",
13    "invert_mask": false,
14    "confidence_thresh": 0.5,
15    "iou_thresh": 0.2,
16    "return_mask": false,
17    "grow_mask": 10,
18    "base64": false
19}
20
21response = requests.post(url, headers=headers, json=data)
22
23if response.status_code == 200:
24    result = response.json()
25    print(json.dumps(result, indent=2))
26else:
27    print(f"Error: {response.status_code}")
28    print(response.text)

API Endpoint

POSThttps://api.segmind.com/v1/inpaint-mask-maker

Parameters

imagerequired
string (uri)

Upload your input image

promptrequired
string

Prompt to render

base64optional
boolean

Base64 encoding of the output image.

Default: false
confidence_threshoptional
number

Lowering it reduces false positives and increases sensitivity to desired objects. Increasing it minimizes false positives and prevents identifying undesired objects.

Default: 0.5Range: 0 - 1
grow_maskoptional
integer

Selectively expand image regions

Default: 10Range: 0 - 100
invert_maskoptional
boolean

Refers to inverting the mask.

Default: false
iou_threshoptional
number

Lowering the value reduces bounding box overlap, making detection more stringent. Increasing it allows more overlap and adapts to a wider detection range.

Default: 0.2Range: 0 - 1
return_maskoptional
boolean

Check this to obtain the mask as the output.

Default: false

Response Type

Returns: Image

Common Error Codes

The API returns standard HTTP status codes. Detailed error messages are provided in the response body.

400

Bad Request

Invalid parameters or request format

401

Unauthorized

Missing or invalid API key

403

Forbidden

Insufficient permissions

404

Not Found

Model or endpoint not found

406

Insufficient Credits

Not enough credits to process request

429

Rate Limited

Too many requests

500

Server Error

Internal server error

502

Bad Gateway

Service temporarily unavailable

504

Timeout

Request timed out