Segment each person in an image and generate a pixel-level mask
POST
/services/aigc/image2image/image-synthesis
cURL
Copy
# 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/regionscurl --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": {}}'
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.
Available options:PENDING,RUNNING,SUCCEEDED,FAILED,SUSPENDED,UNKNOWN
cURL
Copy
# 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/regionscurl --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": {}}'