Skip to main content
Person instance segmentation

Person instance segmentation — Create a task

Segment each person in an image and generate a pixel-level mask

POST
/services/aigc/image2image/image-synthesis
cURL
# China North 2 (Beijing). This model is available only in this region.
# API keys are region-specific. See https://docs.qwencloud.com/developer-guides/getting-started/regions
curl --request POST \
  --url https://cn-beijing.maas.qwencloudapi.com/api/v1/services/aigc/image2image/image-synthesis \
  --header 'X-DashScope-Async: enable' \
  --header "Authorization: Bearer $DASHSCOPE_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
  "model": "image-instance-segmentation",
  "input": {
    "image_url": "https://example.com/image.png"
  },
  "parameters": {}
}'
{
  "output": {
    "task_id": "53950fb7-281a-4e60-9c1a-3f8f6c5f8f21",
    "task_status": "PENDING"
  },
  "request_id": "4909100c-7b5a-9f92-bfe5-28c7cece6b47"
}
image-instance-segmentation detects each person in an image and generates a pixel-level mask for each instance. The result includes a mask image, where each person instance has a different grayscale value and the background is 0, and a visualization image, where each instance is overlaid in a different color. Supported regions: China North 2 (Beijing) only. Use an API key created in that region and the https://cn-beijing.maas.qwencloudapi.com endpoint. See Regions and endpoints.
The model is available for free trial only. After the free quota is used, calls are no longer possible.
The mask can be used as the mask_url input of Image erase completion to remove one or more people. Processing is asynchronous: this operation returns a task_id, and you poll Query the result until the task finishes.

Authorizations

string
header
required

QwenCloud API key. See API keys.

Header Parameters

enum<string>
required

Asynchronous task flag. Must be set to enable.

enable

Body

application/json
enum<string>
required

Model name. Fixed to image-instance-segmentation.

image-instance-segmentation
image-instance-segmentation
object
required

Input image parameters.

object

Generation parameters. No parameters are available. Pass an empty object {}.

Response

200-application/json
string

Unique request identifier for tracing and troubleshooting.

4909100c-7b5a-9f92-bfe5-28c7cece6b47
object