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

Pangu-CV-ObjectDetection-N-2.1.0

Function

Finds all objects of interest in an image and determines their positions and categories. The Pangu CV Object Detection-N Model features a moderate number of parameters and is suitable for environments with limited resources. It provides a fast detection speed and reasonable precision.

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

Image interface: 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 lists the request header parameters for token-based authentication.

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 lists the request header parameters for API key authentication.

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 Parameters in the image detection request body

Parameter

Mandatory

Type

Description

images

Yes

String

Definition:

Base64-encoded image.

Constraints:

  • You are advised to use images in PNG, JPEG, BMP, JPG, or WEBP format.
  • Only one image can be used. The resolution ranges from 1 px to 10,000 px, and the aspect ratio (long side/short side) cannot exceed 5. The image size after Base64 encoding cannot exceed 10 MB.
  • RGB three-channel images are supported.

Value range:

N/A

Default value:

N/A

nms_iou_thr

Yes

Float

Definition:

Non-Maximum Suppression (NMS) IoU threshold.

Constraints:

N/A

Value range:

0.0~1.0

Default value:

N/A

agnostic_nms

Yes

Bool

Definition:

Whether to perform class-agnostic NMS. true means to perform class-agnostic NMS and false means not.

Constraints:

N/A

Value range:

true: class-agnostic NMS

Default value:

N/A

Response Parameters

Status code: 200

Table 5 Response body parameters

Parameter

Type

Description

result

List

Definition:

Object detection result A basic objective of object detection is to find a target object of interest in an input image or video, and determine their location and category. Therefore, the detection result includes object location and category.

Constraints:

N/A

Value range:

N/A

Default value:

N/A

Table 6 Response body parameters

Parameter

Type

Description

RegisterMatrix

List

Definition:

Image feature matrix. Default value: [[1, 0, 0], [0, 1, 0], [0, 0, 1]]

Constraints:

N/A

Value range:

N/A

Default value:

N/A

Label

String

Definition:

Predicted label The predicted label in object detection refers to the classification result of the input image or video.

Constraints:

N/A

Value range:

N/A

Default value:

N/A

Score

Float

Definition:

Confidence score It is used to measure the accuracy of the prediction result of a model.

Constraints:

N/A

Value range:

N/A

Default value:

N/A

Box

Dict

Definition:

Information about the detected object.

Constraints:

The format is {"x":x1,"y":y1,"width":w,"height":h,'Angle':angle}.

  • 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.

Value range:

N/A

Default value:

N/A

Status code: 400

Table 7 Response body parameters

Parameter

Type

Description

error_code

String

Error code

error_msg

String

Error message

Example Request

  • Example image detection request
    { 
      "nms_iou_thr":0.45,
      "agnostic_nms":false,
      "images": "/9j/4Vr2RXhpZgAASUkqAAgAAA....." 
    }

Example Response

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

Status Codes

For details, see Status Codes.

Error Codes

For details, see Error Codes.