The method identifyUser(Arrays.asList("group001"), String, new HashMap<>()) is undefined for the type AipFace

在使用百度云的人脸识别sdk时遇到了这个错误,网上百度不到解决的方法,当我浏览百度云的时候发现了这个

 

于是考虑到版本可能更新,出现了新的函数代替旧的函数,于是去查文档,文档链接如下

果然出现了search函数代替identifyUser,
 1 public void sample(AipFace client) {
 2     // 传入可选参数调用接口
 3     HashMap<String, String> options = new HashMap<String, String>();
 4     options.put("quality_control", "NORMAL");
 5     options.put("liveness_control", "LOW");
 6     options.put("user_id", "233451");
 7     options.put("max_user_num", "3");
 8 
 9     String image = "取决于image_type参数,传入BASE64字符串或URL字符串或FACE_TOKEN字符串";
10     String imageType = "BASE64";
11     String groupIdList = "3,2";
12 
13     // 人脸搜索
14     JSONObject res = client.search(image, imageType, groupIdList, options);
15     System.out.println(res.toString(2));
16 
17 }

成功解决问题,果然版本更替真的是我们要关注的东西。

posted @ 2019-04-23 22:33  你的雷哥  阅读(761)  评论(0编辑  收藏  举报