OSS uses Intelligent Media Management (IMM) to support various data analysis and processing operations such as document previews, document format conversion, face recognition, image analysis, and QR code recognition. This topic describes how to use IMM through the OSS console.

Prerequisites

  • To use IMM through the OSS console, you must activate IMM and grant IMM access permissions on OSS resources. For more information about how to activate and authorize IMM, see the Activate IMM topic and the "Prerequisite-authorize access to cloud resources" section in the Create projects topic in IMM Quick Start.
  • If you are using a RAM user to perform the operations described in this topic, you must obtain the access permissions on the target bucket and the AliyunIMMFullAccess permissions.
  • Creating IMM projects and using IMM functions will incur fees. If you no longer need IMM, we recommend that you unbind IMM in a timely manner. For more information, see the Billing methods topic in IMM documentation.
Note IMM is available in the China (Beijing), China (Hangzhou), China (Shanghai), China (Shenzhen), China (Zhangjiakou-Beijing Winter Olympics), and Singapore regions. This feature will be available in other regions.

Bind IMM

To process objects in a bucket by using IMM, you must bind IMM to the bucket.

  1. Log on to the OSS console.
  2. Click the target bucket and find the Intelligent Media Management (IMM) tab.
    • New console
      1. Click Buckets, and then click the name of the target bucket.
      2. Choose Data Processing > Intelligent Media Management (IMM).
    • Old console
      1. In the left-side navigation pane, click the name of the target bucket.
      2. Click the Intelligent Media Management (IMM) tab.
  3. Find an IMM function that you need and click Bind in the Actions column corresponding to the function.
    IMM provides the following functions:
    • Document Transform: After binding this function to a bucket, you can preview objects in various formats, such as PPT, XLS, DOC, and PDF.
    • Face Detection: After binding this function to a bucket, you can analyze images in a bucket and identify the bounding box and facial attributes for each face detected in an image.
    • Image Recognize: After binding this function to a bucket, you can analyze images within a bucket and identify the labels and confidence levels.
  4. In the Bind IMM Project dialog box that appears, configure IMM Settings. There are two available options:
    • Create Default Project: Set the project name. The system automatically creates the corresponding IMM project in the region where the bucket is located and binds the IMM project to the current bucket.
    • Bind to Existing Project: Select the IMM project to bind from the drop-down list.
      Note This option appears in the Bind IMM Project dialog box only after you have created an IMM project in the region where the bucket is located.

    You can also click Create Projects on the Intelligent Media Management (IMM) tab. In the Project Settings dialog box that appears, set Bind Project to bind multiple IMM functions.

    You can use this method to bind IMM functions to automatically created IMM projects rather than existing IMM projects. If the name of a specified project already exists, the corresponding IMM function cannot be bound to the project.

  5. Click OK.

Use IMM through the OSS console

After binding IMM, you can use IMM through the OSS console.

  1. Log on to the OSS console.
  2. Click the target bucket.
    • New console: Click Buckets, and then click the name of the target bucket.
    • Old console: In the left-side navigation pane, click the name of the target bucket.
  3. Click the Files tab.
  4. Click the name of the image or document to process. In the View Details dialog box that appears, you can use the functions of IMM.
    Alternatively, click View Details in the Actions column corresponding to the target image or document. The View Details dialog box appears.

Use IMM through SDKs

You can use the OSS SDKs to call IMM functions to analyze and process data in OSS. The sample code is as follows:

public class OssProcessPreview{
    public static void main(String[] args) {
        String ak = "";
        String sk = "";
        String bucketName = "imm-user-zzh";
        String objectKey = "test.jpg";
        URL url = getUrl("imm/detectface", ak, sk, bucketName, objectKey);
        System.out.println(url.toString());
        bucketName = "imm-user-zzh";
        objectKey = "a.xlsx";
        url = getUrl("imm/previewdoc", ak , sk ,bucketName, objectKey);
        System.out.println(url.toString());
    }
    private static URL getUrl(String process, String ak, String sk, String bucketName, String objectKey) {
        OSSClient client = new OSSClient(ak, sk);
        client.setEndpoint("oss-cn-shanghai.aliyuncs.com");
        GetObjectRequest getObjectRequest = new GetObjectRequest(bucketName, objectKey);
        getObjectRequest.setProcess(process);
        GeneratePresignedUrlRequest request = new GeneratePresignedUrlRequest(bucketName, objectKey);
        request.setProcess(process);
        request.setExpiration(new Date(new Date().getTime() + 3600 * 1000));
        return client.generatePresignedUrl(request);
    }
}

Unbind IMM

If you no longer need IMM, we recommend that you unbind IMM from the bucket to avoid additional fees.

  1. Log on to the OSS console.
  2. Click the target bucket and find the Intelligent Media Management (IMM) tab.
    • New console
      1. Click Buckets, and then click the name of the target bucket.
      2. Choose Data Processing > Intelligent Media Management (IMM).
    • Old console
      1. In the left-side navigation pane, click the name of the target bucket.
      2. Click the Intelligent Media Management (IMM) tab.
  3. Click Configure in the Actions column corresponding to the IMM function that you want to unbind.
  4. In the Project Settings dialog box that appears, select Unbind.
  5. Click OK.