このページは、お客様の言語ではご利用いただけません。Huawei Cloudは、より多くの言語バージョンを追加するために懸命に取り組んでいます。ご協力ありがとうございました。

Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Situation Awareness
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
Software Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive

Image Tagging (v2.0)

Updated on 2022-08-08 GMT+08:00

Function

Image Tagging can accurately identify hundreds of scenes, thousands of common objects, and dozens of tag types in natural images. It makes intelligent album management, photo retrieval and classification, and scene- or object-based advertising more intuitive. After you upload an image, Image Tagging returns the tags, tag types, and confidence scores of the image to you. Image Tagging also returns the location information of common objects in the image.

NOTE:

Compared with v1.0, v2.0 refines tag types and provides more return information. For example, v2.0 can return location information of common objects. In addition, v2.0 uses an upgraded model that provides higher recognition accuracy. Therefore, v2.0 is recommended.

Prerequisites

URI

URI format

POST /v2/{project_id}/image/tagging

Table 1 Description

Parameter

Mandatory

Description

project_id

Yes

Indicates the project ID.

Request Message

Table 2 describes the request parameters.
Table 2 Parameter description

Parameter

Mandatory

Type

Description

image

false

String

Configure either this parameter or url.

Indicates the Base64 character string converted from the image. The size cannot exceed 10 MB. The image resolution of the narrow sides must be greater than 15 pixels, and that of the wide sides cannot exceed 4096 pixels. The supported image formats include JPG, PNG, and BMP.

url

false

String

Configure either this parameter or image.

Indicates the URL of an image. The options are as follows:

  • HTTP/HTTPS URLs on the public network
  • OBS URLs. To use OBS data, authorization is required, including service authorization, temporary authorization, and anonymous public authorization.
NOTE:
  • The API response time depends on the image download time. If the image download takes a long time, the API call will fail.
  • Ensure that the storage service where the images to be detected reside is stable and reliable. OBS is recommended for storing image data.
  • The region of OBS must be consistent with that of Image Recognition.

language

false

String

zh: indicates that the language of the returned tag is Chinese.

en: indicates that the language of the returned tag is English.

The default value is zh.

limit

false

Integer

Indicates the maximum number of tags that can be returned. The default value is 50.

threshold

false

Float

Indicates the confidence threshold. The value ranges from 0 to 100. The default value is 60.

Response Message

Table 3 describes the response parameters.
Table 3 Parameter description

Parameter

Type

Description

result

JSON

Indicates the content of the image tag when the API is successfully called.

This parameter is not included when the API fails to be called.

tags

List

Indicates the list of tags.

confidence

String

Indicates the tag confidence. The float value is converted into a string and returned. The float value ranges from 0 to 100.

tag

String

Indicates the tag name in the selected language (currently, only Chinese and English are supported).

type

String

Indicates the tag type in the selected language (currently, only Chinese and English are supported).

i18n_tag

JSON

Indicates the internationalization field of the tag. (i18n is only an internationalization flag and has no special meaning.)

  • zh: Chinese
  • en: English

i18n_type

JSON

Indicates the internationalization field of the tag type. (i18n is only an internationalization flag and has no special meaning.)

  • zh: Chinese
  • en: English

instances

List

If this parameter is empty, there is no object bounding box.

If this parameter is not empty, it has the following fields:
  • bounding_box: location of the object bounding box
    • width: width of the bounding box, which is in float format
    • height: height of the bounding box, which is in float format
    • top_left_y: distance from the upper left corner of the bounding box to the vertical axis, which is in float format
    • top_left_x: distance from the upper left corner of the bounding box to the horizontal axis, which is in float format
  • confidence: tag confidence. The float value is converted into a string and returned. The float value ranges from 0 to 100.

error_code

String

Indicates the error code of a failed API call. For details, see Error Codes.

This parameter is not included when the API is successfully called.

error_msg

String

Indicates the error message of a failed API call.

This parameter is not included when the API is successfully called.

Examples

  • Example request (Method 1: Use a Base64-encoded image.)
    POST https://{{Endpoint of Image Recognition}}/v2/{project_id}/image/tagging
    
    Request Header:   
    Content-Type:application/json 
    X-Auth-Token: MIINRwYJKoZIhvcNAQcCoIINODCCDTQCAQExDTALBglghkgBZQMEAgEwgguVBgkqhkiG...    
    
    Request Body: 
    { 
     "image":"/9j/4AAQSkZJRgABAgEASABIAAD/4RFZRXhpZgAATU0AKgAAAAgABwESAAMAAAABAAEAAAEaAAUAAAABAAAAYgEbAAUAAAABAAAAagEoAAMAAAABAAIAAAExAAIAAAAcAAAAcgEyAAIAAAAUAAAAjodpAAQAAAABAAAApAAAANAACvyAAAAnEAAK/IAAACcQQWRvYmUgUGhvdG9zaG9wIENTMyBXaW5kb3dzADIwMTc6MTA6MjAgMTA6NDU6MzYAAAAAA6ABAAMAAAAB//8AAKACAAQAAAABAAALIKADAAQAAAABAAAGQAAAAAAAAAAGAQMAAwAAAAEABgAAARoABQAAAAEAAAEeARsABQAAAAEAAAEmASgAAwAAAAEAAgAAAgEABAAAAAEAAAEuAgIABAAAAAEAABAj...", 
      "threshold": 60 
    }  
  • Example request (Method 2: Use the URL redirecting to an image file.)
    POST https://{{Endpoint of Image Recognition}}/v2/{project_id}/image/tagging
       
    Request Header:  
    Content-Type:application/json
    X-Auth-Token: MIINRwYJKoZIhvcNAQcCoIINODCCDTQCAQExDTALBglghkgBZQMEAgEwgguVBgkqhkiG...   
    
    Request Body:
    {
      "image":"",
      "url":"https://{{OBS path for storing images}}",
      "threshold": 60.0
    } 
  • Example successful response
    {
        "result":
        {
            "tags":
            [
                {
                    "confidence": "92.38",
                    "instances":
                    [
                        {
                            "bounding_box":
                            {
                                "height": 133.32496056189905,
                                "top_left_x": 53.134917332575874,
                                "top_left_y": 254.21347984900842,
                                "width": 117.5866567171537
                            },
                            "confidence": "92.38"
                        },
                        {
                            "bounding_box":
                            {
                                "height": 133.32496056189905,
                                "top_left_x": 53.134917332575874,
                                "top_left_y": 254.21347984900842,
                                "width": 117.5866567171537
                            },
                            "confidence": "90.38"
                        }
                    ],
                    "tag": "Person",
                    "i18n_tag":
                    {
                        "en": "Person",
                        "zh": "Chinese character for person"
                    },
                    "type": "Human",
                    "i18n_type":
                    {
                        "en": "Human",
                        "zh": "Chinese characters for human"
                    }
                },
                {
                    "confidence": "94.38",
                    "instances":
                    [],
                    "tag": "Book",
                    "i18n_tag":
                    {
                        "en": "Book",
                        "zh": "Chinese characters for book"
                    },
                    "type": "Education",
                    "i18n_type":
                    {
                        "en": "Education",
                        "zh": "Chinese characters for education"
                    }
                },
                {
                    "confidence": "92.38",
                    "instances":
                    [
                        {
                            "bounding_box":
                            {
                                "height": 133.32496056189905,
                                "top_left_x": 53.134917332575874,
                                "top_left_y": 254.21347984900842,
                                "width": 117.5866567171537
                            },
                            "confidence": "92.38"
                        }
                    ],
                    "tag": "Bed",
                    "i18n_tag":
                    {
                        "en": "Bed",
                        "zh": "Chinese character for bed"
                    },
                    "type": "Home category",
                    "i18n_type":
                    {
                        "en": "Home category",
                        "zh": "Chinese characters for home category"
                    }
                }
            ]
        }
    }
  • Example failed response
    {
        "error_code": "AIS.0014",
        "error_msg": "The JSON format of the input data is incorrect."
    }

Return Value

  • Normal

    200

  • Abnormal

    Return Value

    Description

    400

    • The request cannot be understood by the server due to malformed syntax. The client should not repeat the request without modifications.
    • The request parameter is incorrect.

    401

    The request requires user authentication.

    403

    No operation permission.

    404

    The server has not found anything matching the Request-URI.

    500

    The server encountered an unexpected condition which prevented it from fulfilling the request.

Error Codes

For details about error codes, see Error Codes.

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback