Updated on 2026-02-13 GMT+08:00

Pangu-CV-InstanceSegmentation-1.1.0

Function

The Pangu CV Instance Segmentation Model can segment and recognize different labels of objects and the object instances in input images, and output the labels, confidence, and coordinates of each instance.

Service API calling method:

  • Image inference and video inference are supported.
  • Image and video inference services can be deployed as real-time services or edge services.
  • Video inference calling: You need to set environment variables and add the RTSP video stream address when creating a deployment task.
    • Add the ADDRS environment variable. The value of the environment variable is the video stream address, for example, rtsp://{Edge node address:Port}/{RTSP video stream address}.
    • Query the model inference result in container logs. After remotely logging in to the deployment server, run the docker ps command to obtain the container list and information.
    • Record the deployment task name. In the navigation pane of ModelArts, choose Model Deployment, go to the Real-Time Services or Edge Services tab page based on the model deployment mode, and find the task ID based on the task name. Search the container information for the CONTAINER ID corresponding to the name generated during deployment task creation.

    • Run the docker logs -f {CONTAINER ID} command to view container logs. You can view the inference execution process in the container logs and search for result to obtain the inference result.

Authorization Information

An account has required permissions to call all APIs by default. To call this API as an IAM user, the IAM user must be granted the required permissions. For details, see Permissions and Supported Actions.

URI

POST /v1/{project_id}/infer-api/proxy/service/{deployment_id}/

For details about how to obtain the URI, see Request URI.

Request Parameters

Table 1 Request header parameters (token-based authentication)

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Definition:

User token.

Used to obtain the permission required to call APIs. The token is the value of X-Subject-Token in the response header in Figure 4.

Constraints:

N/A

Value range:

N/A

Default value:

N/A

Content-Type

Yes

String

Definition:

MIME type of the body in the request.

Constraints:

N/A

Value range:

N/A

Default value:

application/json

Table 2 Request header parameters (API key authentication)

Parameter

Mandatory

Type

Description

X-Apig-AppCode

Yes

String

Definition:

API key.

Used to obtain the permission required to call APIs. The API key is the value of X-Apig-AppCode in the response header in API key authentication.

Constraints:

N/A

Value range:

N/A

Default value:

N/A

Content-Type

Yes

String

Definition:

MIME type of the body in the request.

Constraints:

N/A

Value range:

N/A

Default value:

application/json

Table 3 Request Parameters

Parameter

Mandatory

Type

Description

images

Yes

String

Definition:

Base64-encoded image.

Constraints:

By default, only the RGB three-channel images are supported.

Value range:

N/A

Default value:

N/A

Response Parameters

Table 4 Response Parameters

Parameter

Type

Description

img_res

List

Definition:

Instance segmentation result. This field is available if the task is successful. Each element in the result indicates the segmentation result of an instance.

Constraints:

N/A

Value range:

N/A

Default value:

N/A

dataset_id

String

Definition:

Training dataset ID

Constraints:

N/A

Value range:

N/A

Default value:

N/A

Table 5 Structure of img_res

Parameter

Type

Description

label

String

Definition:

Predicted label

Constraints:

N/A

Value range:

N/A

Default value:

N/A

score

Float

Definition:

Confidence score

Constraints:

N/A

Value range:

N/A

Default value:

N/A

box

Dict

Definition:

Information about the bounding box of the detected object, in the format of {"x":x1,"y":y1,"width":w,"height":h,"angle":r}

  • x: X coordinate of the upper left corner of the bounding box.
  • y: Y coordinate of the upper left corner of the bounding box.
  • width: width of the bounding box.
  • height: height of the bounding box.
  • angle: angle of the bounding box. The default value is 0.

Constraints:

N/A

Value range:

N/A

Default value:

N/A

mask

Dict

Definition:

Image information in the format of {"counts":string,"size":[h,w]}

  • counts: an RLE-encoded string. The string is a Boolean array indicating the same width and height as the original image. If the value of a location in the array is 0, the pixel at the corresponding location of the original image is not part of the detection target. If the value is 1, the pixel at the corresponding location of the original image is part of the detection target. The Python open-source library pycocotools._mask can be used for encoding and decoding.
  • size: image size. h indicates the image height, and w the width.

Constraints:

N/A

Value range:

N/A

Default value:

N/A

Example Request

{ 
     "images": "/9j/4Vr2RXhpZgAASUkqAAgAAA....." 
}

Example Response

{
    "dataset_id": "12345",
    "img_res":
        [{"label":"person", "score": 0.958,
        "box": {"x": 131, "y": 186, "width": 128, "height": 102, "angle": 0},
        "mask":{'counts': 'PR`1h0n:0O2M5K4L4M4L6I7\\O\\NiFh1R9a0N2M3O0M301O00001O00000000000003NO01N2O0N3O2Nd0]O1N1O0O2O1N20000O100O2O0O101N3N1N2N2O1N1O1O1O1O010O0001O1O1O2N3M2ZFiNi8R2001O00001O00001O001O1O1O2N1O1O2N3M7F9I5J4M3N1O3M3L3M3N1N3M2M3MRfR3','size': [374, 500]}
         },...]
}

Status Codes

For details, see Status Codes.

Error Codes

For details, see Error Codes.