This topic describes how to use Intelligent Media Management (IMM) to process documents, images, and data sent from smart home devices.
This topic is no longer updated. We recommend that you use the new IMM version.
For a comparison between the new IMM version and the old one, see Overview of the new and old IMM versions.
For more information about how to use the features of the new IMM version, see User Guide.
Prerequisites
A RAM user is created, and the AliyunIMMFullAccess policy is attached to the RAM user. For more information, see Configure permissions.
An AccessKey pair is created for the RAM user. For more information, see Create an AccessKey pair.
NoteAn AccessKey pair consists of an AccessKey ID and an AccessKey secret.
IMM is activated. For more information, see Activate IMM.
An Object Storage Service (OSS) bucket is created and corresponding objects are uploaded to the bucket. For more information, see Activate OSS.
Document management
The document format conversion feature allows you to convert 48 document formats into JPG, PNG, PDF, TXT, and VECTOR. You can convert documents into the format that best suits your application. To use the document format conversion feature, perform the following steps:
Create a project.
You can create a project in the IMM console. For more information, see Create a project.
Convert the document format by using a synchronous or asynchronous request.
A synchronous request converts the format within 5 seconds. If a synchronous request fails, switch to an asynchronous request.
After the conversion is successful, you can access the output object in the specified OSS directory.
Synchronous request
Call the ConvertOfficeFormat operation.
Asynchronous request
Call the CreateOfficeConversionTask operation.
After the format conversion task is created, you can call the GetOfficeConversionTask operation to query information about the task, or receive a notification of the conversion result from Simple Message Queue (SMQ).
IMM provides two versions of document preview: document preview V1 and document preview V2.
If the origin of the preview service differs from the origin of the OSS bucket, you must configure cross-origin resource sharing (CORS) for the bucket to allow access from the preview service. For more information, see CORS.
Document preview V1: enables easy-to-use, powerful, and customized document preview by using the frontend rendering engine of IMM. Documents are first converted into VECTOR files. For more information, see Quick start.
NoteThe VECTOR format provides benefits such as text copy, undistorted zooming, and custom advertising.
Document preview V2: provides quick document preview based on a preview URL and access token. You do not need to manually specify an iframe element. JavaScript code automatically creates an iframe element below a custom block element, and uses the access token to implement document preview. For more information, see Quick start.
To use document preview V1, perform the following steps:
Create a project.
You can create a project in the IMM console. For more information, see Create a project.
Initiate an asynchronous request to convert the document format.
Call the CreateOfficeConversionTask operation to convert the format.
After the format conversion task is created, you can call the GetOfficeConversionTask operation to query information about the task or receive a notification of the conversion result from SMQ.
Pass the output OSS object to the rendering engine for preview.
To use document preview V2, perform the following steps:
Create a project.
You can create a project in the IMM console. For more information, see Create a project.
Encapsulate the GetOfficePreviewURL and RefreshOfficePreviewToken operations on the server side to obtain preview URLs and access tokens.
You do not need to manually specify an iframe element. JavaScript code automatically creates an iframe element below a custom block element, and uses access tokens to implement document preview.
Image analysis
Many image analysis capabilities of IMM are based on artificial intelligence (AI). You can call the DetectImageTags operation to detect labels in images, or call the DetectImageFaces operation to detect faces in images, then index metadata collected based on AI. This way, you can easily add label-based image retrieval capabilities to your applications. For example, you can allow your users to search for images that contain specific content, such as a cat. To use image retrieval, perform the following steps:
Create a project.
You can create a project in the IMM console. For more information, see Create a project.
Call the CreateSet operation to create a dataset.
Call the IndexImage operation to index images into the dataset.
To index multiple images, you can call the operation multiple times.
Call the ListSetTags operation to query labels in the dataset.
Call the FindImages operation to retrieve images that contain the specified label.
Data storage for smart home devices
Many scenarios in this category require AI-driven face capabilities. For example, you can capture frames from home surveillance videos and use face clustering to recognize family members. To use the face clustering feature, perform the following steps:
Create a project.
You can create a project in the IMM console. For more information, see Create a project.
Call the CreateSet operation to create a dataset.
Call the IndexImage operation to index images into the dataset.
To index multiple images, you can call the operation multiple times.
Call the CreateGroupFacesJob operation to cluster faces in a dataset.
After you call the CreateGroupFacesJob operation, call the IndexImage operation to index faces in images into the dataset and call the CreateGroupFacesJob operation to cluster incremental images.
Call the ListFaceGroups operation to query face clusters in the dataset.