Updated on 2026-01-07 GMT+08:00

Pangu-CV-ObjectDetection-S-3.1.0

Function

The Pangu CV Object Detection Model can find all the objects of interest in an image and determine their locations and labels.

Service API calling method:

  • Image inference is supported.
  • Image inference services can be deployed as real-time services or edge services.

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.

Table 1 Path parameters of the inference API

Parameter

Mandatory

Type

Description

project_id

Yes

String

Definition:

Project ID. For details about how to obtain a project ID, see Obtaining the Project ID.

Constraints:

N/A

Value range:

N/A

Default value:

N/A

deployment_id

Yes

String

Definition:

Model deployment ID. For details about how to obtain the deployment ID, see Obtaining the Model Deployment ID.

Constraints:

N/A

Value range:

N/A

Default value:

N/A

Request Parameters

Table 2 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 3 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 4 Request body parameters

Parameter

Mandatory

Type

Description

images

Yes

String

Definition:

Base64-encoded image. The image size cannot exceed 2 KB. By default, only the RGB three-channel images are supported.

Constraints:

  • The maximum size of an image is 2 KB.
  • You are advised to use images in JPG, PNG, JPEG, or BMP format.
  • By default, only the RGB three-channel images are supported.

Value range:

N/A

Default value:

N/A

threshold

No

String

Definition:

Bounding box confidence threshold.

Enabling logic:

1. If ENABLE_ALL_OUTPUTS is set to true, all results are output, and the input threshold and default optimal threshold are not used.

2. If threshold is passed, and ENABLE_ALL_OUTPUTS is set to false, the passed threshold is preferentially used for result filtering.

3. If threshold is not passed or threshold is set to -1, and ENABLE_ALL_OUTPUTS is set to false, the default optimal threshold is used for inference.

Constraints:

N/A

Value range:

The value ranges from 0.0 to 1.0.

Default value:

-1

Response Parameters

Table 5 Response body

Parameter

Type

Description

result

List

Definition:

Object detection result

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 6 Structure of result

Parameter

Type

Description

RegisterMatrix

List

Definition:

Image feature matrix.

Definition:

Confidence score

Constraints:

N/A

Value range:

N/A

Default value:

The default value is [[1, 0, 0], [0, 1, 0], [0, 0, 1]].

Label

String

Definition:

Prediction label, which is related to the label name in the training data.

Constraints:

N/A

Value range:

N/A

Default value:

N/A

Score

Float

Definition:

Confidence score

Constraints:

N/A

Value range:

0~1

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

Example Request

There are three invocation modes:

The invoking modes are as follows:

1. form-data mode

{ 
    "file":"xxx(base64 encode image data)"
}

2. Base64 JSON mode

{    
    "Files":
      [{"ImageData":"xxx(base64 encode image data)"}]
}

3. Base64 JSON mode (with optional threshold)

{    
     "images":"xxx(base64 encode image data)",
     "threshold":"0.4"
}

Example Response

{ 
    "dataset_id": "12345",
    "result": [ 
         { 
             "RegisterMatrix": [ 
                 [ 
                      1, 
                      0, 
                      0 
                 ], 
                 [ 
                      0, 
                      1, 
                      0 
                 ], 
                 [ 
                      0, 
                      0, 
                      1 
                 ] 
             ] 
         }, 
         { 
             "Box": { 
                 "X": 0, 
                 "Y": 0, 
                 "Width": 100, 
                 "Height": 100, 
                 "Angle": 0 
             }, 
             "Score": 0.9, 
             "label": "person" 
         } 
    ] 
}

Status Codes

For details, see Status Codes.

Error Codes

For details, see Error Codes.