日本熟妇hd丰满老熟妇,中文字幕一区二区三区在线不卡 ,亚洲成片在线观看,免费女同在线一区二区

智能標簽

智能標簽,是通過分析視頻中視覺、文字、語音、行為等信息,結合多模態信息融合及對齊技術,實現高準確率內容識別,自動輸出視頻的多維度內容標簽,將非結構化信息轉化為結構化信息,適用于媒資檢索、個性化推薦、智能廣告投放等場景。本文介紹了媒體處理Java SDK V2.0使用智能標簽的示例代碼。

版本說明

媒體處理的Java SDK版本需要在2.7.6版本及以上。如果使用Maven管理Java依賴包,您可以在工程pom.xml文件中添加如下依賴。

<dependency>
  <groupId>com.aliyun</groupId>
  <artifactId>alibabacloud-mts20140618</artifactId>
  <version>3.0.0</version>
</dependency>

前提條件

使用前請先初始化客戶端,詳細說明請參見初始化。

提交智能標簽作業

調用SubmitSmarttagJob提交智能標簽作業,接口字段和參數詳細信息請參見提交智能標簽作業,調用示例如下:

package com.aliyun.sample;

import com.aliyun.tea.*;

public class Sample {

    /**
     * <b>description</b> :
     * <p>使用AK&amp;SK初始化賬號Client</p>
     * @return Client
     *
     * @throws Exception
     */
    public static com.aliyun.mts20140618.Client createClient() throws Exception {

        com.aliyun.teaopenapi.models.Config config = new com.aliyun.teaopenapi.models.Config()
                // 必填,請確保代碼運行環境設置了環境變量 ALIBABA_CLOUD_ACCESS_KEY_ID。
                .setAccessKeyId(System.getenv("ALIBABA_CLOUD_ACCESS_KEY_ID"))
                // 必填,請確保代碼運行環境設置了環境變量 ALIBABA_CLOUD_ACCESS_KEY_SECRET。
                .setAccessKeySecret(System.getenv("ALIBABA_CLOUD_ACCESS_KEY_SECRET"));
        config.endpoint = "mts.cn-qingdao.aliyuncs.com";
        return new com.aliyun.mts20140618.Client(config);
    }

    public static void main(String[] args_) throws Exception {
        java.util.List<String> args = java.util.Arrays.asList(args_);
        com.aliyun.mts20140618.Client client = Sample.createClient();
        com.aliyun.mts20140618.models.SubmitSmarttagJobRequest submitSmarttagJobRequest = new com.aliyun.mts20140618.models.SubmitSmarttagJobRequest()
                //管道ID(必填)
                .setPipelineId("2")
                //視頻標題(必填)
                .setTitle("example-title-****")
                //需要分析的視頻或圖片文件的地址(必填)
                .setInput("oss://mybucket-****/example-****.mp4")
                //視頻內容描述
                .setContent("example content ****")
                //額外的請求參數
                .setParams("false")
                //Callback路徑
                .setNotifyUrl("https://example.com/endpoint/aliyun/ai?id=76401125000***")
                //通過回調透傳回來的信息
                .setUserData("{\"key\":\"value\"}")
                //模板ID用于指定分析算法
                .setTemplateId("39f8e0bc005e4f309379701645f4****")
                //任務在其對應管道內的優先級
                .setPriority("5");
        com.aliyun.teautil.models.RuntimeOptions runtime = new com.aliyun.teautil.models.RuntimeOptions();
        try {
            // 復制代碼運行請自行打印 API 的返回值
            client.submitSmarttagJobWithOptions(submitSmarttagJobRequest, runtime);
        } catch (TeaException error) {
            // 此處僅做打印展示,請謹慎對待異常處理,在工程項目中切勿直接忽略異常。
            // 錯誤 message
            System.out.println(error.getMessage());
            // 診斷地址
            System.out.println(error.getData().get("Recommend"));
            com.aliyun.teautil.Common.assertAsString(error.message);
        } catch (Exception _error) {
            TeaException error = new TeaException(_error.getMessage(), _error);
            // 此處僅做打印展示,請謹慎對待異常處理,在工程項目中切勿直接忽略異常。
            // 錯誤 message
            System.out.println(error.getMessage());
            // 診斷地址
            System.out.println(error.getData().get("Recommend"));
            com.aliyun.teautil.Common.assertAsString(error.message);
        }
    }
}

查詢智能標簽作業

調用QuerySmarttagJob查詢智能標簽作業,接口字段和參數詳細信息請參見查詢智能標簽作業,調用示例如下:

package com.aliyun.sample;

import com.aliyun.tea.*;

public class Sample {

    /**
     * <b>description</b> :
     * <p>使用AK&amp;SK初始化賬號Client</p>
     * @return Client
     *
     * @throws Exception
     */
    public static com.aliyun.mts20140618.Client createClient() throws Exception {

        com.aliyun.teaopenapi.models.Config config = new com.aliyun.teaopenapi.models.Config()
                // 必填,請確保代碼運行環境設置了環境變量 ALIBABA_CLOUD_ACCESS_KEY_ID。
                .setAccessKeyId(System.getenv("ALIBABA_CLOUD_ACCESS_KEY_ID"))
                // 必填,請確保代碼運行環境設置了環境變量 ALIBABA_CLOUD_ACCESS_KEY_SECRET。
                .setAccessKeySecret(System.getenv("ALIBABA_CLOUD_ACCESS_KEY_SECRET"));
        config.endpoint = "mts.cn-qingdao.aliyuncs.com";
        return new com.aliyun.mts20140618.Client(config);
    }

    public static void main(String[] args_) throws Exception {
        java.util.List<String> args = java.util.Arrays.asList(args_);
        com.aliyun.mts20140618.Client client = Sample.createClient();
        com.aliyun.mts20140618.models.QuerySmarttagJobRequest querySmarttagJobRequest = new com.aliyun.mts20140618.models.QuerySmarttagJobRequest()
                //需要查詢的智能標簽作業ID(必填)
                .setJobId("39f8e0bc005e4f309379701645f4****")
                //額外的請求參數
                .setParams("{\"labelResultType\":\"auto\"}");
        com.aliyun.teautil.models.RuntimeOptions runtime = new com.aliyun.teautil.models.RuntimeOptions();
        try {
            // 復制代碼運行請自行打印 API 的返回值
            client.querySmarttagJobWithOptions(querySmarttagJobRequest, runtime);
        } catch (TeaException error) {
            // 此處僅做打印展示,請謹慎對待異常處理,在工程項目中切勿直接忽略異常。
            // 錯誤 message
            System.out.println(error.getMessage());
            // 診斷地址
            System.out.println(error.getData().get("Recommend"));
            com.aliyun.teautil.Common.assertAsString(error.message);
        } catch (Exception _error) {
            TeaException error = new TeaException(_error.getMessage(), _error);
            // 此處僅做打印展示,請謹慎對待異常處理,在工程項目中切勿直接忽略異常。
            // 錯誤 message
            System.out.println(error.getMessage());
            // 診斷地址
            System.out.println(error.getData().get("Recommend"));
            com.aliyun.teautil.Common.assertAsString(error.message);
        }
    }
}

添加模板

調用AddSmarttagTemplate 添加一個模板,接口字段和參數詳細信息請參見添加模板,調用示例如下:

package com.aliyun.sample;

import com.aliyun.tea.*;

public class Sample {

    /**
     * <b>description</b> :
     * <p>使用AK&amp;SK初始化賬號Client</p>
     * @return Client
     *
     * @throws Exception
     */
    public static com.aliyun.mts20140618.Client createClient() throws Exception {

        com.aliyun.teaopenapi.models.Config config = new com.aliyun.teaopenapi.models.Config()
                // 必填,請確保代碼運行環境設置了環境變量 ALIBABA_CLOUD_ACCESS_KEY_ID。
                .setAccessKeyId(System.getenv("ALIBABA_CLOUD_ACCESS_KEY_ID"))
                // 必填,請確保代碼運行環境設置了環境變量 ALIBABA_CLOUD_ACCESS_KEY_SECRET。
                .setAccessKeySecret(System.getenv("ALIBABA_CLOUD_ACCESS_KEY_SECRET"));
        config.endpoint = "mts.cn-qingdao.aliyuncs.com";
        return new com.aliyun.mts20140618.Client(config);
    }

    public static void main(String[] args_) throws Exception {
        java.util.List<String> args = java.util.Arrays.asList(args_);
        com.aliyun.mts20140618.Client client = Sample.createClient();
        com.aliyun.mts20140618.models.AddSmarttagTemplateRequest addSmarttagTemplateRequest = new com.aliyun.mts20140618.models.AddSmarttagTemplateRequest()
                //自定義模板名稱(必填)
                .setTemplateName("template-example-****")
                //待分析文件所處行業(必填)
                .setIndustry("common")
                //待分析文件使用場景(必填)
                .setScene("search")
                //分析類型(必填)
                .setAnalyseTypes("ocr")
                //參與識別的?臉庫ID列表
                .setFaceCategoryIds("celebrity")
                //人臉算法的參數
                .setFaceCustomParamsConfig("{ \"faceDetThreshold\":0.999, \"faceRegThreshold\":0.9 }")
                //參與識別的物體庫ID列表
                .setObjectGroupIds("general,item,weapon,animal")
                //參與識別的地域庫ID列表
                .setLandmarkGroupIds("common")
                //是否設置為默認模板(設置為默認模板后,如果轉碼時不指定轉碼模板則使用默認模板進行轉碼)。取值:true(是)、false(否),默認 false。?個阿里云賬號下只能有?個默認模板,如果重復設置則會報錯。
                .setIsDefault(true)
                //標注類型
                .setLabelType("hmi")
                //指定智能標簽版本
                .setLabelVersion("1.0")
                //智能標簽2.0和2.0-custom模式下
                .setKnowledgeConfig("{ \"movie\":\"name,alias,chnl,genre\", \"music\":\"songName,artistName\", \"person\":\"name,gender\" }")
                //關鍵詞標簽配置
                .setKeywordConfig("\"type\": \"name,location,organization,other\" }");
        com.aliyun.teautil.models.RuntimeOptions runtime = new com.aliyun.teautil.models.RuntimeOptions();
        try {
            // 復制代碼運行請自行打印 API 的返回值
            client.addSmarttagTemplateWithOptions(addSmarttagTemplateRequest, runtime);
        } catch (TeaException error) {
            // 此處僅做打印展示,請謹慎對待異常處理,在工程項目中切勿直接忽略異常。
            // 錯誤 message
            System.out.println(error.getMessage());
            // 診斷地址
            System.out.println(error.getData().get("Recommend"));
            com.aliyun.teautil.Common.assertAsString(error.message);
        } catch (Exception _error) {
            TeaException error = new TeaException(_error.getMessage(), _error);
            // 此處僅做打印展示,請謹慎對待異常處理,在工程項目中切勿直接忽略異常。
            // 錯誤 message
            System.out.println(error.getMessage());
            // 診斷地址
            System.out.println(error.getData().get("Recommend"));
            com.aliyun.teautil.Common.assertAsString(error.message);
        }
    }
}

查詢模板

調用QuerySmarttagTemplateList查詢模板信息,接口字段和參數詳細信息請參見查詢模板,調用示例如下:

package com.aliyun.sample;

import com.aliyun.tea.*;

public class Sample {

    /**
     * <b>description</b> :
     * <p>使用AK&amp;SK初始化賬號Client</p>
     * @return Client
     *
     * @throws Exception
     */
    public static com.aliyun.mts20140618.Client createClient() throws Exception {

        com.aliyun.teaopenapi.models.Config config = new com.aliyun.teaopenapi.models.Config()
                // 必填,請確保代碼運行環境設置了環境變量 ALIBABA_CLOUD_ACCESS_KEY_ID。
                .setAccessKeyId(System.getenv("ALIBABA_CLOUD_ACCESS_KEY_ID"))
                // 必填,請確保代碼運行環境設置了環境變量 ALIBABA_CLOUD_ACCESS_KEY_SECRET。
                .setAccessKeySecret(System.getenv("ALIBABA_CLOUD_ACCESS_KEY_SECRET"));
        config.endpoint = "mts.cn-qingdao.aliyuncs.com";
        return new com.aliyun.mts20140618.Client(config);
    }

    public static void main(String[] args_) throws Exception {
        java.util.List<String> args = java.util.Arrays.asList(args_);
        com.aliyun.mts20140618.Client client = Sample.createClient();
        com.aliyun.mts20140618.models.QuerySmarttagTemplateListRequest querySmarttagTemplateListRequest = new com.aliyun.mts20140618.models.QuerySmarttagTemplateListRequest()
                //模板ID
                .setTemplateId("05de22f255284c7a8d2aab535dde****");
        com.aliyun.teautil.models.RuntimeOptions runtime = new com.aliyun.teautil.models.RuntimeOptions();
        try {
            // 復制代碼運行請自行打印 API 的返回值
            client.querySmarttagTemplateListWithOptions(querySmarttagTemplateListRequest, runtime);
        } catch (TeaException error) {
            // 此處僅做打印展示,請謹慎對待異常處理,在工程項目中切勿直接忽略異常。
            // 錯誤 message
            System.out.println(error.getMessage());
            // 診斷地址
            System.out.println(error.getData().get("Recommend"));
            com.aliyun.teautil.Common.assertAsString(error.message);
        } catch (Exception _error) {
            TeaException error = new TeaException(_error.getMessage(), _error);
            // 此處僅做打印展示,請謹慎對待異常處理,在工程項目中切勿直接忽略異常。
            // 錯誤 message
            System.out.println(error.getMessage());
            // 診斷地址
            System.out.println(error.getData().get("Recommend"));
            com.aliyun.teautil.Common.assertAsString(error.message);
        }
    }
}

更新模板

調用UpdateSmarttagTemplate更新模板信息,接口字段和參數詳細信息請參見更新模板,調用示例如下:

package com.aliyun.sample;

import com.aliyun.tea.*;

public class Sample {

    /**
     * <b>description</b> :
     * <p>使用AK&amp;SK初始化賬號Client</p>
     * @return Client
     *
     * @throws Exception
     */
    public static com.aliyun.mts20140618.Client createClient() throws Exception {

        com.aliyun.teaopenapi.models.Config config = new com.aliyun.teaopenapi.models.Config()
                // 必填,請確保代碼運行環境設置了環境變量 ALIBABA_CLOUD_ACCESS_KEY_ID。
                .setAccessKeyId(System.getenv("ALIBABA_CLOUD_ACCESS_KEY_ID"))
                // 必填,請確保代碼運行環境設置了環境變量 ALIBABA_CLOUD_ACCESS_KEY_SECRET。
                .setAccessKeySecret(System.getenv("ALIBABA_CLOUD_ACCESS_KEY_SECRET"));
        config.endpoint = "mts.cn-qingdao.aliyuncs.com";
        return new com.aliyun.mts20140618.Client(config);
    }

    public static void main(String[] args_) throws Exception {
        java.util.List<String> args = java.util.Arrays.asList(args_);
        com.aliyun.mts20140618.Client client = Sample.createClient();
        com.aliyun.mts20140618.models.UpdateSmarttagTemplateRequest updateSmarttagTemplateRequest = new com.aliyun.mts20140618.models.UpdateSmarttagTemplateRequest()
                //模板ID(必填)
                .setTemplateId("05de22f255284c7a8d2aab535dde****")
                //自定義模板名稱
                .setTemplateName("template-example-****")
                //待分析文件所處行業
                .setIndustry("common")
                //使用場景
                .setScene("search")
                //分析類型
                .setAnalyseTypes("ocr,asr")
                //參與識別的?臉庫ID列表
                .setFaceCategoryIds("celebrity")
                //人臉算法的參數
                .setFaceCustomParamsConfig("{ \"faceDetThreshold\":0.999, \"faceRegThreshold\":0.9 }")
                //參與識別的物體庫ID列表
                .setObjectGroupIds("general,item,weapon,animal")
                //參與識別的地域庫ID列表
                .setLandmarkGroupIds("common")
                //是否默認模板
                .setIsDefault(true)
                //標注類型
                .setLabelType("hmi")
                //指定智能標簽版本
                .setLabelVersion("1.0")
                //智能標簽2.0和2.0-custom模式下
                .setKnowledgeConfig("{ \"movie\":\"name,alias,chnl,genre\", \"music\":\"songName,artistName\", \"person\":\"name,gender\" }")
                //關鍵詞標簽配置
                .setKeywordConfig("{ \"type\": \"name,location,organization,other\" }");
        com.aliyun.teautil.models.RuntimeOptions runtime = new com.aliyun.teautil.models.RuntimeOptions();
        try {
            // 復制代碼運行請自行打印 API 的返回值
            client.updateSmarttagTemplateWithOptions(updateSmarttagTemplateRequest, runtime);
        } catch (TeaException error) {
            // 此處僅做打印展示,請謹慎對待異常處理,在工程項目中切勿直接忽略異常。
            // 錯誤 message
            System.out.println(error.getMessage());
            // 診斷地址
            System.out.println(error.getData().get("Recommend"));
            com.aliyun.teautil.Common.assertAsString(error.message);
        } catch (Exception _error) {
            TeaException error = new TeaException(_error.getMessage(), _error);
            // 此處僅做打印展示,請謹慎對待異常處理,在工程項目中切勿直接忽略異常。
            // 錯誤 message
            System.out.println(error.getMessage());
            // 診斷地址
            System.out.println(error.getData().get("Recommend"));
            com.aliyun.teautil.Common.assertAsString(error.message);
        }
    }
}

刪除模板

調用DeleteSmarttagTemplate刪除模板,接口字段和參數詳細信息請參見刪除模板,調用示例如下:

package com.aliyun.sample;

import com.aliyun.tea.*;

public class Sample {

    /**
     * <b>description</b> :
     * <p>使用AK&amp;SK初始化賬號Client</p>
     * @return Client
     *
     * @throws Exception
     */
    public static com.aliyun.mts20140618.Client createClient() throws Exception {

        com.aliyun.teaopenapi.models.Config config = new com.aliyun.teaopenapi.models.Config()
                // 必填,請確保代碼運行環境設置了環境變量 ALIBABA_CLOUD_ACCESS_KEY_ID。
                .setAccessKeyId(System.getenv("ALIBABA_CLOUD_ACCESS_KEY_ID"))
                // 必填,請確保代碼運行環境設置了環境變量 ALIBABA_CLOUD_ACCESS_KEY_SECRET。
                .setAccessKeySecret(System.getenv("ALIBABA_CLOUD_ACCESS_KEY_SECRET"));
        config.endpoint = "mts.cn-qingdao.aliyuncs.com";
        return new com.aliyun.mts20140618.Client(config);
    }

    public static void main(String[] args_) throws Exception {
        java.util.List<String> args = java.util.Arrays.asList(args_);
        com.aliyun.mts20140618.Client client = Sample.createClient();
        com.aliyun.mts20140618.models.DeleteSmarttagTemplateRequest deleteSmarttagTemplateRequest = new com.aliyun.mts20140618.models.DeleteSmarttagTemplateRequest()
                //需要刪除的模板ID
                .setTemplateId("05de22f255284c7a8d2aab535dde****");
        com.aliyun.teautil.models.RuntimeOptions runtime = new com.aliyun.teautil.models.RuntimeOptions();
        try {
            // 復制代碼運行請自行打印 API 的返回值
            client.deleteSmarttagTemplateWithOptions(deleteSmarttagTemplateRequest, runtime);
        } catch (TeaException error) {
            // 此處僅做打印展示,請謹慎對待異常處理,在工程項目中切勿直接忽略異常。
            // 錯誤 message
            System.out.println(error.getMessage());
            // 診斷地址
            System.out.println(error.getData().get("Recommend"));
            com.aliyun.teautil.Common.assertAsString(error.message);
        } catch (Exception _error) {
            TeaException error = new TeaException(_error.getMessage(), _error);
            // 此處僅做打印展示,請謹慎對待異常處理,在工程項目中切勿直接忽略異常。
            // 錯誤 message
            System.out.println(error.getMessage());
            // 診斷地址
            System.out.println(error.getData().get("Recommend"));
            com.aliyun.teautil.Common.assertAsString(error.message);
        }
    }
}

注冊自定義人臉

調用RegisterCustomFace注冊自定義人臉,接口字段和詳細參數信息請參見注冊?定義?臉,調用示例如下:

package com.aliyun.sample;

import com.aliyun.tea.*;

public class Sample {

    /**
     * <b>description</b> :
     * <p>使用AK&amp;SK初始化賬號Client</p>
     * @return Client
     *
     * @throws Exception
     */
    public static com.aliyun.mts20140618.Client createClient() throws Exception {

        com.aliyun.teaopenapi.models.Config config = new com.aliyun.teaopenapi.models.Config()
                // 必填,請確保代碼運行環境設置了環境變量 ALIBABA_CLOUD_ACCESS_KEY_ID。
                .setAccessKeyId(System.getenv("ALIBABA_CLOUD_ACCESS_KEY_ID"))
                // 必填,請確保代碼運行環境設置了環境變量 ALIBABA_CLOUD_ACCESS_KEY_SECRET。
                .setAccessKeySecret(System.getenv("ALIBABA_CLOUD_ACCESS_KEY_SECRET"));
        config.endpoint = "mts.cn-qingdao.aliyuncs.com";
        return new com.aliyun.mts20140618.Client(config);
    }

    public static void main(String[] args_) throws Exception {
        java.util.List<String> args = java.util.Arrays.asList(args_);
        com.aliyun.mts20140618.Client client = Sample.createClient();
        com.aliyun.mts20140618.models.RegisterCustomFaceRequest registerCustomFaceRequest = new com.aliyun.mts20140618.models.RegisterCustomFaceRequest()
                //?物庫ID(必填)
                .setCategoryId("CategoryId001-****")
                //?物ID(必填)
                .setPersonId("PersonId001-****")
                //需要注冊的?臉圖?公網地址(必填)
                .setImageUrl("http://example-****.jpeg");
        com.aliyun.teautil.models.RuntimeOptions runtime = new com.aliyun.teautil.models.RuntimeOptions();
        try {
            // 復制代碼運行請自行打印 API 的返回值
            client.registerCustomFaceWithOptions(registerCustomFaceRequest, runtime);
        } catch (TeaException error) {
            // 此處僅做打印展示,請謹慎對待異常處理,在工程項目中切勿直接忽略異常。
            // 錯誤 message
            System.out.println(error.getMessage());
            // 診斷地址
            System.out.println(error.getData().get("Recommend"));
            com.aliyun.teautil.Common.assertAsString(error.message);
        } catch (Exception _error) {
            TeaException error = new TeaException(_error.getMessage(), _error);
            // 此處僅做打印展示,請謹慎對待異常處理,在工程項目中切勿直接忽略異常。
            // 錯誤 message
            System.out.println(error.getMessage());
            // 診斷地址
            System.out.println(error.getData().get("Recommend"));
            com.aliyun.teautil.Common.assertAsString(error.message);
        }
    }
}

注銷自定義人臉

調用UnregisterCustomFace注銷自定義人臉,接口字段和參數詳細說明請參見注銷?定義?臉,調用示例如下:

package com.aliyun.sample;

import com.aliyun.tea.*;

public class Sample {

    /**
     * <b>description</b> :
     * <p>使用AK&amp;SK初始化賬號Client</p>
     * @return Client
     *
     * @throws Exception
     */
    public static com.aliyun.mts20140618.Client createClient() throws Exception {

        com.aliyun.teaopenapi.models.Config config = new com.aliyun.teaopenapi.models.Config()
                // 必填,請確保代碼運行環境設置了環境變量 ALIBABA_CLOUD_ACCESS_KEY_ID。
                .setAccessKeyId(System.getenv("ALIBABA_CLOUD_ACCESS_KEY_ID"))
                // 必填,請確保代碼運行環境設置了環境變量 ALIBABA_CLOUD_ACCESS_KEY_SECRET。
                .setAccessKeySecret(System.getenv("ALIBABA_CLOUD_ACCESS_KEY_SECRET"));
        config.endpoint = "mts.cn-qingdao.aliyuncs.com";
        return new com.aliyun.mts20140618.Client(config);
    }

    public static void main(String[] args_) throws Exception {
        java.util.List<String> args = java.util.Arrays.asList(args_);
        com.aliyun.mts20140618.Client client = Sample.createClient();
        com.aliyun.mts20140618.models.UnregisterCustomFaceRequest unregisterCustomFaceRequest = new com.aliyun.mts20140618.models.UnregisterCustomFaceRequest()
                //?物庫ID(必填)
                .setCategoryId("CategoryId001-****")
                //?物ID(必填)
                .setPersonId("PersonId001-****")
                //人臉ID(必填)
                .setFaceId("15****");
        com.aliyun.teautil.models.RuntimeOptions runtime = new com.aliyun.teautil.models.RuntimeOptions();
        try {
            // 復制代碼運行請自行打印 API 的返回值
            client.unregisterCustomFaceWithOptions(unregisterCustomFaceRequest, runtime);
        } catch (TeaException error) {
            // 此處僅做打印展示,請謹慎對待異常處理,在工程項目中切勿直接忽略異常。
            // 錯誤 message
            System.out.println(error.getMessage());
            // 診斷地址
            System.out.println(error.getData().get("Recommend"));
            com.aliyun.teautil.Common.assertAsString(error.message);
        } catch (Exception _error) {
            TeaException error = new TeaException(_error.getMessage(), _error);
            // 此處僅做打印展示,請謹慎對待異常處理,在工程項目中切勿直接忽略異常。
            // 錯誤 message
            System.out.println(error.getMessage());
            // 診斷地址
            System.out.println(error.getData().get("Recommend"));
            com.aliyun.teautil.Common.assertAsString(error.message);
        }
    }
}

添加自定義人物庫或人物標簽

調用TagCustomPerson添加自定義人物庫或人物標簽,接口字段和參數詳細信息請參見添加自定義人物庫或人物標簽,調用示例如下:

package com.aliyun.sample;

import com.aliyun.tea.*;

public class Sample {

    /**
     * <b>description</b> :
     * <p>使用AK&amp;SK初始化賬號Client</p>
     * @return Client
     *
     * @throws Exception
     */
    public static com.aliyun.mts20140618.Client createClient() throws Exception {

        com.aliyun.teaopenapi.models.Config config = new com.aliyun.teaopenapi.models.Config()
                // 必填,請確保代碼運行環境設置了環境變量 ALIBABA_CLOUD_ACCESS_KEY_ID。
                .setAccessKeyId(System.getenv("ALIBABA_CLOUD_ACCESS_KEY_ID"))
                // 必填,請確保代碼運行環境設置了環境變量 ALIBABA_CLOUD_ACCESS_KEY_SECRET。
                .setAccessKeySecret(System.getenv("ALIBABA_CLOUD_ACCESS_KEY_SECRET"));
        config.endpoint = "mts.cn-qingdao.aliyuncs.com";
        return new com.aliyun.mts20140618.Client(config);
    }

    public static void main(String[] args_) throws Exception {
        java.util.List<String> args = java.util.Arrays.asList(args_);
        com.aliyun.mts20140618.Client client = Sample.createClient();
        com.aliyun.mts20140618.models.TagCustomPersonRequest tagCustomPersonRequest = new com.aliyun.mts20140618.models.TagCustomPersonRequest()
                //?物庫ID
                .setCategoryId("CategoryId001-****")
                //?物庫名稱
                .setCategoryName("CategoryNametest-****")
                //?物庫描述
                .setCategoryDescription("CategoryDescription001-****")
                //?物ID
                .setPersonId("PersonId001-****")
                //?物名稱
                .setPersonName("PersonNametest-****")
                //?物描述
                .setPersonDescription("PersonDescriptiontest-****");
        com.aliyun.teautil.models.RuntimeOptions runtime = new com.aliyun.teautil.models.RuntimeOptions();
        try {
            // 復制代碼運行請自行打印 API 的返回值
            client.tagCustomPersonWithOptions(tagCustomPersonRequest, runtime);
        } catch (TeaException error) {
            // 此處僅做打印展示,請謹慎對待異常處理,在工程項目中切勿直接忽略異常。
            // 錯誤 message
            System.out.println(error.getMessage());
            // 診斷地址
            System.out.println(error.getData().get("Recommend"));
            com.aliyun.teautil.Common.assertAsString(error.message);
        } catch (Exception _error) {
            TeaException error = new TeaException(_error.getMessage(), _error);
            // 此處僅做打印展示,請謹慎對待異常處理,在工程項目中切勿直接忽略異常。
            // 錯誤 message
            System.out.println(error.getMessage());
            // 診斷地址
            System.out.println(error.getData().get("Recommend"));
            com.aliyun.teautil.Common.assertAsString(error.message);
        }
    }
}

列出人物庫所有人物和人臉信息

調用ListCustomPersons列出人物庫所有人物和人臉信息,接口字段和參數詳細說明請參見列出?物庫所有?物和?臉信息,調用示例如下:

package com.aliyun.sample;

import com.aliyun.tea.*;

public class Sample {

    /**
     * <b>description</b> :
     * <p>使用AK&amp;SK初始化賬號Client</p>
     * @return Client
     *
     * @throws Exception
     */
    public static com.aliyun.mts20140618.Client createClient() throws Exception {

        com.aliyun.teaopenapi.models.Config config = new com.aliyun.teaopenapi.models.Config()
                // 必填,請確保代碼運行環境設置了環境變量 ALIBABA_CLOUD_ACCESS_KEY_ID。
                .setAccessKeyId(System.getenv("ALIBABA_CLOUD_ACCESS_KEY_ID"))
                // 必填,請確保代碼運行環境設置了環境變量 ALIBABA_CLOUD_ACCESS_KEY_SECRET。
                .setAccessKeySecret(System.getenv("ALIBABA_CLOUD_ACCESS_KEY_SECRET"));
        config.endpoint = "mts.cn-qingdao.aliyuncs.com";
        return new com.aliyun.mts20140618.Client(config);
    }

    public static void main(String[] args_) throws Exception {
        java.util.List<String> args = java.util.Arrays.asList(args_);
        com.aliyun.mts20140618.Client client = Sample.createClient();
        com.aliyun.mts20140618.models.ListCustomPersonsRequest listCustomPersonsRequest = new com.aliyun.mts20140618.models.ListCustomPersonsRequest()
                //?物庫ID
                .setCategoryId("CategoryId-****")
                //?物ID
                .setPersonId("PersonId-****");
        com.aliyun.teautil.models.RuntimeOptions runtime = new com.aliyun.teautil.models.RuntimeOptions();
        try {
            // 復制代碼運行請自行打印 API 的返回值
            client.listCustomPersonsWithOptions(listCustomPersonsRequest, runtime);
        } catch (TeaException error) {
            // 此處僅做打印展示,請謹慎對待異常處理,在工程項目中切勿直接忽略異常。
            // 錯誤 message
            System.out.println(error.getMessage());
            // 診斷地址
            System.out.println(error.getData().get("Recommend"));
            com.aliyun.teautil.Common.assertAsString(error.message);
        } catch (Exception _error) {
            TeaException error = new TeaException(_error.getMessage(), _error);
            // 此處僅做打印展示,請謹慎對待異常處理,在工程項目中切勿直接忽略異常。
            // 錯誤 message
            System.out.println(error.getMessage());
            // 診斷地址
            System.out.println(error.getData().get("Recommend"));
            com.aliyun.teautil.Common.assertAsString(error.message);
        }
    }
}