消息关闭
    暂无新消息!

java人脸识别 错误

问题作者 : 武藤溯2017-07-16发布

public static void main(String[] args) throws Exception{

StringBuffer sb=new StringBuffer();

            try{
                /**
                 * 具体方法可以对照着看API 都有详细讲解
                 * 这里只是简单的测试人脸识别 获取一些attribute信息 (比如:年龄 性别 人种..)
                 * @author Folger
                 */
                HttpRequests hs  = new HttpRequests("_XNC1iOEW4jAQb9tUlkfF7mrFBGneIYA", "2MNwIMeuzQvjoHbxOga0uJIp0Sgy66H- ", true, false);
                PostParameters pps=new PostParameters();
                JSONObject result = hs.detectionDetect(pps.setImg(new File("D://timg.jpg")));
                int age = result.getJSONObject("age").getInt("value");
                int agerange=result.getJSONObject("age").getInt("range");
                String sex=result.getJSONObject("gender").getString("value");
                Double sexconfidence=result.getJSONObject("gender").getDouble("confidence");
                String race=result.getJSONObject("race").getString("value");
                Double raceconfidence=result.getJSONObject("race").getDouble("confidence");
                Double smilingfidence=result.getJSONObject("smiling").getDouble("value");

                //System.out.println(result);

             sb.append(" "+"\n");
             sb.append("年龄"+age+"岁左右"+" ");
             sb.append("误差范围在"+agerange+"岁上下"+"\n");
             sb.append("性别为"+sex+" "+"正确率:"+sexconfidence+"%\n");
             sb.append("种族为"+race+" "+"正确率:"+raceconfidence+"%\n");
             sb.append("正在笑的概率:"+smilingfidence+"%");
            }catch(Exception e ){
                e.printStackTrace();
            } 
        }

com.facepp.error.FaceppParseException: error :com.facepp.error.FaceppParseException: API error. code=1003, message=AUTHORIZATION_ERROR, responseCode=403
at com.facepp.http.HttpRequests.request(HttpRequests.java:337)
at com.facepp.http.HttpRequests.detectionDetect(HttpRequests.java:448)
at FaceTest.main(FaceTest.java:41)


     

0个回答

暂无回答!