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.

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:
|
Image size | The following image size limits apply:
|
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).
NoteYou 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:

Request example
{
"ProjectName": "test-project",
"SourceURI": "oss://test-bucket/test-object.jpg",
"Threshold": 0.7
}Response example
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.
ImportantStarting 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
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.
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.