Inpaint Mask Maker
Real-Time Open-Vocabulary Object Detection
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) 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
https://api.segmind.com/v1/inpaint-mask-makerParameters
imagerequiredstring (uri)Upload your input image
promptrequiredstringPrompt to render
base64optionalbooleanBase64 encoding of the output image.
falseconfidence_threshoptionalnumberLowering it reduces false positives and increases sensitivity to desired objects. Increasing it minimizes false positives and prevents identifying undesired objects.
0.5Range: 0 - 1grow_maskoptionalintegerSelectively expand image regions
10Range: 0 - 100invert_maskoptionalbooleanRefers to inverting the mask.
falseiou_threshoptionalnumberLowering the value reduces bounding box overlap, making detection more stringent. Increasing it allows more overlap and adapts to a wider detection range.
0.2Range: 0 - 1return_maskoptionalbooleanCheck this to obtain the mask as the output.
falseResponse Type
Returns: Image
Common Error Codes
The API returns standard HTTP status codes. Detailed error messages are provided in the response body.
Bad Request
Invalid parameters or request format
Unauthorized
Missing or invalid API key
Forbidden
Insufficient permissions
Not Found
Model or endpoint not found
Insufficient Credits
Not enough credits to process request
Rate Limited
Too many requests
Server Error
Internal server error
Bad Gateway
Service temporarily unavailable
Timeout
Request timed out