All Products
Search
Document Center

Intelligent Media Management:Image label detection

Last Updated:Jul 29, 2025

This topic describes the scenarios and procedure for the image label detection feature.

Feature description

The image label detection feature detects content such as scenes, objects, and events in images and automatically adds labels. This feature supports thousands of labels across more than 30 categories, as shown in the following figure.

图片标签检测..jpeg

Scenarios

Scenario

Description

Content recognition

Detects items, scenes, and other information in captured or uploaded images. This feature can be used in products or features for object recognition from photos or for popular science purposes.

Smart album

Automatically classifies images based on their content to implement intelligent classification for photo albums and galleries. This helps achieve efficient and automated management.

Scene analysis

Detects various objects or scenes in images and adds content labels to different scenes. This improves the efficiency of scene analysis and reduces manual annotation costs.

Content operations

Obtains image label information for content recommendation. This feature is widely used in content platforms such as social media, news, information, and e-commerce platforms.

Limits

The following table describes the limits of the image label detection feature.

Limit

Limitations

Image format

The following image formats are supported:

  • PNG

  • JPG

  • JPEG

Image size

The following image size limits apply:

  • The image size cannot exceed 20 MB.

  • The image height or width cannot exceed 30,000 pixels (px).

  • The total number of pixels in the image cannot exceed 250 million.

Prerequisites

  • Create and obtain an AccessKey pair. For more information, see Create an AccessKey pair.

  • Activate OSS, create a bucket, and upload a file to the bucket. For more information, see Upload files.

  • Activate Intelligent Media Management (IMM). For more information, see Activate IMM.

  • Create a project in the IMM console. For more information, see Create a project.

  • The OSS bucket and the IMM project must be in the same region, such as China (Hohhot).

    Note
    • You can also call the CreateProject API operation to create a project. For more information, see CreateProject.

    • You can call the ListProjects operation to list all projects in a specified region.

Procedure

Call the DetectImageLabels operation to detect labels in an image.

Information to be detected

  • IMM project name: test-project

  • Storage address of the image: oss://test-bucket/test-object.jpg

  • Image example:

    test-object

Request example

{
    "ProjectName": "test-project",
    "SourceURI": "oss://test-bucket/test-object.jpg",
    "Threshold": 0.7
}

Response example

{
  "RequestId": "91C92EBA-5E51-50C8-B51B-8C3BDC66EB86",
  "Labels": [
    {
      "CentricScore": 0.797,
      "Language": "zh-Hans",
      "LabelConfidence": 1,
      "LabelName": "Clothing",
      "LabelLevel": 2,
      "ParentLabelName": "Clothes"
    },
    {
      "CentricScore": 0.695,
      "Language": "zh-Hans",
      "LabelConfidence": 1,
      "LabelName": "Carnivore",
      "LabelLevel": 2,
      "ParentLabelName": "Wild Animal"
    },
    {
      "CentricScore": 0.723,
      "Language": "zh-Hans",
      "LabelConfidence": 0.987,
      "LabelName": "Tent",
      "LabelLevel": 2,
      "ParentLabelName": "Other Scenes"
    },
    {
      "CentricScore": 0.759,
      "Language": "zh-Hans",
      "LabelConfidence": 0.963,
      "LabelName": "Building",
      "LabelLevel": 3,
      "ParentLabelName": "Landmark"
    },
    {
      "CentricScore": 0.695,
      "Language": "zh-Hans",
      "LabelConfidence": 0.949,
      "LabelName": "Pet",
      "LabelLevel": 1,
      "ParentLabelName": ""
    },
    {
      "CentricScore": 0.787,
      "Language": "zh-Hans",
      "LabelConfidence": 0.944,
      "LabelName": "Portrait",
      "LabelLevel": 2,
      "ParentLabelName": "Face"
    },
    {
      "CentricScore": 0.695,
      "Language": "zh-Hans",
      "LabelConfidence": 0.939,
      "LabelName": "Dog",
      "LabelLevel": 3,
      "ParentLabelName": "Pet Dog"
    },
    {
      "CentricScore": 0.803,
      "Language": "zh-Hans",
      "LabelConfidence": 0.924,
      "LabelName": "Person",
      "LabelLevel": 2,
      "ParentLabelName": "Face"
    },
    {
      "CentricScore": 0.687,
      "Language": "zh-Hans",
      "LabelConfidence": 0.895,
      "LabelName": "Golden Retriever",
      "LabelLevel": 3,
      "ParentLabelName": "Pet Dog"
    },
    {
      "CentricScore": 0.689,
      "Language": "zh-Hans",
      "LabelConfidence": 0.885,
      "LabelName": "Camping",
      "LabelLevel": 2,
      "ParentLabelName": "Entertainment"
    },
    {
      "CentricScore": 0.76,
      "Language": "zh-Hans",
      "LabelConfidence": 0.883,
      "LabelName": "Furniture",
      "LabelLevel": 1,
      "ParentLabelName": ""
    },
    {
      "CentricScore": 0.802,
      "Language": "zh-Hans",
      "LabelConfidence": 0.878,
      "LabelName": "Male",
      "LabelLevel": 2,
      "ParentLabelName": "Face"
    },
    {
      "CentricScore": 0.792,
      "Language": "zh-Hans",
      "LabelConfidence": 0.85,
      "LabelName": "Female",
      "LabelLevel": 2,
      "ParentLabelName": "Face"
    },
    {
      "CentricScore": 0.722,
      "Language": "zh-Hans",
      "LabelConfidence": 0.849,
      "LabelName": "Plant",
      "LabelLevel": 1,
      "ParentLabelName": ""
    },
    {
      "CentricScore": 0.729,
      "Language": "zh-Hans",
      "LabelConfidence": 0.84,
      "LabelName": "Lawn",
      "LabelLevel": 3,
      "ParentLabelName": "Natural Landscape"
    },
    {
      "CentricScore": 0.695,
      "Language": "zh-Hans",
      "LabelConfidence": 0.818,
      "LabelName": "Animal",
      "LabelLevel": 2,
      "ParentLabelName": "Wild Animal"
    },
    {
      "CentricScore": 0.782,
      "Language": "zh-Hans",
      "LabelConfidence": 0.816,
      "LabelName": "T-shirt",
      "LabelLevel": 2,
      "ParentLabelName": "Clothes"
    },
    {
      "CentricScore": 0.749,
      "Language": "zh-Hans",
      "LabelConfidence": 0.813,
      "LabelName": "Shoe",
      "LabelLevel": 2,
      "ParentLabelName": "Clothes"
    },
    {
      "CentricScore": 0.826,
      "Language": "zh-Hans",
      "LabelConfidence": 0.813,
      "LabelName": "Footwear",
      "LabelLevel": 2,
      "ParentLabelName": "Clothes"
    },
    {
      "CentricScore": 0.685,
      "Language": "zh-Hans",
      "LabelConfidence": 0.775,
      "LabelName": "Labrador Retriever",
      "LabelLevel": 3,
      "ParentLabelName": "Pet Dog"
    },
    {
      "CentricScore": 0.76,
      "Language": "zh-Hans",
      "LabelConfidence": 0.746,
      "LabelName": "Chair",
      "LabelLevel": 2,
      "ParentLabelName": "Furniture"
    },
    {
      "CentricScore": 0.757,
      "Language": "zh-Hans",
      "LabelConfidence": 0.742,
      "LabelName": "Girl",
      "LabelLevel": 2,
      "ParentLabelName": "Face"
    },
    {
      "CentricScore": 0.776,
      "Language": "zh-Hans",
      "LabelConfidence": 0.726,
      "LabelName": "Smile",
      "LabelLevel": 2,
      "ParentLabelName": "Appearance Feature"
    },
    {
      "CentricScore": 0.695,
      "Language": "zh-Hans",
      "LabelConfidence": 0.722,
      "LabelName": "Dog Sport",
      "LabelLevel": 2,
      "ParentLabelName": "Sports"
    },
    {
      "CentricScore": 0.685,
      "Language": "zh-Hans",
      "LabelConfidence": 0.664,
      "LabelName": "Golden Retriever",
      "LabelLevel": 3,
      "ParentLabelName": "Pet Dog"
    },
    {
      "CentricScore": 0.826,
      "Language": "zh-Hans",
      "LabelConfidence": 1,
      "LabelName": "Clothes",
      "LabelLevel": 1,
      "ParentLabelName": ""
    },
    {
      "CentricScore": 0.695,
      "Language": "zh-Hans",
      "LabelConfidence": 1,
      "LabelName": "Wild Animal",
      "LabelLevel": 1,
      "ParentLabelName": ""
    },
    {
      "CentricScore": 0.723,
      "Language": "zh-Hans",
      "LabelConfidence": 0.987,
      "LabelName": "Other Scenes",
      "LabelLevel": 1,
      "ParentLabelName": ""
    },
    {
      "CentricScore": 0.759,
      "Language": "zh-Hans",
      "LabelConfidence": 0.963,
      "LabelName": "Landmark",
      "LabelLevel": 2,
      "ParentLabelName": "Travel & Geography"
    },
    {
      "CentricScore": 0.803,
      "Language": "zh-Hans",
      "LabelConfidence": 0.944,
      "LabelName": "Face",
      "LabelLevel": 1,
      "ParentLabelName": ""
    },
    {
      "CentricScore": 0.695,
      "Language": "zh-Hans",
      "LabelConfidence": 0.939,
      "LabelName": "Pet Dog",
      "LabelLevel": 2,
      "ParentLabelName": "Pet"
    },
    {
      "CentricScore": 0.689,
      "Language": "zh-Hans",
      "LabelConfidence": 0.885,
      "LabelName": "Entertainment",
      "LabelLevel": 1,
      "ParentLabelName": ""
    },
    {
      "CentricScore": 0.729,
      "Language": "zh-Hans",
      "LabelConfidence": 0.84,
      "LabelName": "Natural Landscape",
      "LabelLevel": 2,
      "ParentLabelName": "Travel & Geography"
    },
    {
      "CentricScore": 0.776,
      "Language": "zh-Hans",
      "LabelConfidence": 0.726,
      "LabelName": "Appearance Feature",
      "LabelLevel": 1,
      "ParentLabelName": ""
    },
    {
      "CentricScore": 0.695,
      "Language": "zh-Hans",
      "LabelConfidence": 0.722,
      "LabelName": "Sports",
      "LabelLevel": 1,
      "ParentLabelName": ""
    },
    {
      "CentricScore": 0.759,
      "Language": "zh-Hans",
      "LabelConfidence": 0.963,
      "LabelName": "Travel & Geography",
      "LabelLevel": 1,
      "ParentLabelName": ""
    }
  ]
}
Note

The detection result indicates that the image contains the following labels:

  • Parent labels: Clothes, Wild Animal, Landmark, Face, Pet Dog, and more.

  • Labels: Clothing, Carnivore, Tent, Building, Pet, Face, Dog, and more.

Sample code

The following sample code shows how to use the Python SDK to detect image labels.

# -*- coding: utf-8 -*-
# This file is auto-generated, don't edit it. Thanks.
import sys
import os
from typing import List

from alibabacloud_imm20200930.client import Client as imm20200930Client
from alibabacloud_tea_openapi import models as open_api_models
from alibabacloud_imm20200930 import models as imm_20200930_models
from alibabacloud_tea_util import models as util_models
from alibabacloud_tea_util.client import Client as UtilClient


class Sample:
    def __init__(self):
        pass

    @staticmethod
    def create_client(
        access_key_id: str,
        access_key_secret: str,
    ) -> imm20200930Client:
        """
        Use the AccessKey ID and AccessKey secret to initialize the client.
        @param access_key_id:
        @param access_key_secret:
        @return: Client
        @throws Exception
        """
        config = open_api_models.Config(
            access_key_id=access_key_id,
            access_key_secret=access_key_secret
        )
        # Specify the endpoint of IMM.
        config.endpoint = f'imm.cn-beijing.aliyuncs.com'
        return imm20200930Client(config)

    @staticmethod
    def main(
        args: List[str],
    ) -> None:
        # An Alibaba Cloud account has full permissions on all API operations. We recommend that you use a RAM user to call API operations or perform O&M.
        # We recommend that you do not save the AccessKey ID and AccessKey secret in your project code. Otherwise, the AccessKey pair may be leaked and the security of all resources in your account may be compromised.
        # In this example, the AccessKey pair is obtained from environment variables to verify the identity of the API caller.
        imm_access_key_id = os.getenv("ALIBABA_CLOUD_ACCESS_KEY_ID")
        imm_access_key_secret = os.getenv("ALIBABA_CLOUD_ACCESS_KEY_SECRET")
        # Initialize the client.
        client = Sample.create_client(imm_access_key_id, imm_access_key_secret)
        detect_image_labels_request = imm_20200930_models.DetectImageLabelsRequest(
            project_name='test-project',
            source_uri='oss://test-bucket/test-object.jpg',
            threshold=0.7
        )
        runtime = util_models.RuntimeOptions()
        try:
            # If you copy the code to run it, print the return value of the API operation.
            client.detect_image_labels_with_options(detect_image_labels_request, runtime)
        except Exception as error:
            # If an error occurs, print the error message.
            UtilClient.assert_as_string(error.message)

    @staticmethod
    async def main_async(
        args: List[str],
    ) -> None:
        # An Alibaba Cloud account has full permissions on all API operations. We recommend that you use a RAM user to call API operations or perform O&M.
        # We recommend that you do not save the AccessKey ID and AccessKey secret in your project code. Otherwise, the AccessKey pair may be leaked and the security of all resources in your account may be compromised.
        # In this example, the AccessKey pair is obtained from environment variables to verify the identity of the API caller.
        imm_access_key_id = os.getenv("ALIBABA_CLOUD_ACCESS_KEY_ID")
        imm_access_key_secret = os.getenv("ALIBABA_CLOUD_ACCESS_KEY_SECRET")
        # Initialize the client.
        client = Sample.create_client(imm_access_key_id, imm_access_key_secret)
        detect_image_labels_request = imm_20200930_models.DetectImageLabelsRequest(
            project_name='test-project',
            source_uri='oss://test-bucket/test-object.jpg',
            threshold=0.7
        )
        runtime = util_models.RuntimeOptions()
        try:
            # If you copy the code to run it, print the return value of the API operation.
            await client.detect_image_labels_with_options_async(detect_image_labels_request, runtime)
        except Exception as error:
            # If an error occurs, print the error message.
            UtilClient.assert_as_string(error.message)


if __name__ == '__main__':
    Sample.main(sys.argv[1:])

Billing

During image label detection, billable items are generated for OSS and IMM:

  • OSS: For more information about pricing, see OSS Pricing.

    API

    Billable item

    Description

    GetObject

    GET requests

    Requests are billed based on the number of successful requests.

    IA data retrieval capacity

    If you retrieve Infrequent Access (IA) data, fees for IA data retrieval capacity are generated. You are charged based on the volume of retrieved data.

    Archive real-time access data retrieval capacity

    If you read an Archive object from a bucket for which real-time access of Archive objects is enabled, fees for Archive real-time access data retrieval capacity are generated. You are charged based on the size of the retrieved data.

    Transfer acceleration

    If you enable transfer acceleration and use an acceleration endpoint to access your bucket, transfer acceleration fees are generated. You are charged based on the data size.

    HeadObject

    GET requests

    Requests are billed based on the number of successful requests.

  • IMM: For more information about pricing, see IMM billable items.

    Important

    Starting at 11:00 on July 28, 2025 (UTC+8), the billable item for the IMM image tagging service will change from ImageClassification to ImageLabel. For more information, see Notice on IMM Billing Adjustment.

    API

    Billable item

    Description

    DetectImageLabels

    ImageLabel

    The fees for image label detection are calculated based on the number of successful requests.

FAQ

  1. Does image label detection support detecting text, dates, and locations in images and converting them into labels?

    No, it does not. You can use image semantic search to extract text from images. You can then determine dates and organization names based on the text. To obtain the location, if your image contains Exchangeable Image File Format (EXIF) information, you can call an API operation for image information to retrieve the GPS data of where the photo was taken.

Note

For images that contain violent, pornographic, or other sensitive content, automatic detection may not be sufficiently sensitive or accurate. In some cases, manual review is required.