阿里云智能视觉开放平台人脸人体API测试Demo

Step By Step

1、API介绍
2、Open API Exployer快速校验测试
3、Java SDK测试


1、API介绍
  • 功能描述
厨师帽检测可以检测明厨亮灶场景中厨师帽佩戴情况。
  • 应用场景
名厨亮灶工程:识别餐饮企业厨房中厨师是否在工作中佩戴好厨师帽。

API说明厨师帽检测

2、Open API Exployer快速校验测试

API Exployer快速测试地址

阿里云智能视觉开放平台人脸人体API测试Demo

3、Java SDK测试
  • 3.1 pom.xml
       <dependency>
            <groupId>com.aliyun</groupId>
            <artifactId>facebody20191230</artifactId>
            <version>1.0.15</version>
        </dependency>
        <dependency>
            <groupId>com.aliyun</groupId>
            <artifactId>tea-openapi</artifactId>
            <version>0.1.1</version>
        </dependency>
        <dependency>
            <groupId>com.aliyun</groupId>
            <artifactId>tea-console</artifactId>
            <version>0.0.1</version>
        </dependency>
        <dependency>
            <groupId>com.aliyun</groupId>
            <artifactId>tea-util</artifactId>
            <version>0.2.13</version>
        </dependency>
        <dependency>
            <groupId>com.aliyun</groupId>
            <artifactId>tea</artifactId>
            <version>[1.1.13, 2.0.0)</version>
        </dependency>
  • 3.2 CodeSample
import com.aliyun.facebody20191230.models.DetectChefCapRequest;
import com.aliyun.facebody20191230.models.DetectChefCapResponse;
import com.aliyun.teaopenapi.models.*;

public class Sample {

    /**
     * 使用AK&SK初始化账号Client
     * @param accessKeyId
     * @param accessKeySecret
     * @return Client
     * @throws Exception
     */
    public static com.aliyun.facebody20191230.Client createClient(String accessKeyId, String accessKeySecret) throws Exception {
        Config config = new Config()
                // 您的AccessKey ID
                .setAccessKeyId(accessKeyId)
                // 您的AccessKey Secret
                .setAccessKeySecret(accessKeySecret);
        // 访问的域名
        config.endpoint = "facebody.cn-shanghai.aliyuncs.com";
        return new com.aliyun.facebody20191230.Client(config);
    }

    public static void main(String[] args_) throws Exception {
        java.util.List<String> args = java.util.Arrays.asList(args_);
        com.aliyun.facebody20191230.Client client = Sample.createClient("LT********", "R2DO**********");
        DetectChefCapRequest detectChefCapRequest = new DetectChefCapRequest()
                .setImageURL("https://viapi-test.oss-cn-shanghai.aliyuncs.com/test-team/xuhan/facebody/DetectChefCap/ChefCap1.png");
        // 复制代码运行请自行打印 API 的返回值
          DetectChefCapResponse detectChefCapResponse = client.detectChefCap(detectChefCapRequest);
        System.out.println("confidence:" + detectChefCapResponse.getBody().getData().getElements().iterator().next().confidence);
        System.out.println("category:" + detectChefCapResponse.getBody().getData().getElements().iterator().next().category);
    }
}
  • 3.3 测试结果
confidence:0.68170947
category:chefcap

更多参考

阿里云视觉智能开放平台--人脸识别使用教程

上一篇:MySQL配置文件my.ini参数注释说明


下一篇:阿里云智能推荐服务端PHP SDK Quick Start