审核图片出现download image err
尼玛么了发 发布于2018-10 浏览:2754 回复:2
0
收藏

图像质量审核的时候,图像是模糊的,判定图像质量,过滤功能,代码如下

 

   // 图像组合APIurl
        String imgCensorUrl = "https://aip.baidubce.com/api/v1/solution/direct/img_censor";
//        String filePath = "########本地图片文件#######";
        try {
            //请求参数
            Map sceneConf = new HashMap();
            Map ocrConf = new HashMap();
            ocrConf.put("recognize_granularity", "big");
            ocrConf.put("language_type", "CHN_ENG");
            ocrConf.put("detect_direction", true);
            ocrConf.put("detect_language", true);
            sceneConf.put("ocr", ocrConf);

            Map input = new HashMap();
            List scenes = new ArrayList();
            scenes.add("ocr");
            scenes.add("face");
            scenes.add("public");
            scenes.add("politician");
            scenes.add("antiporn");
            scenes.add("terror");
            scenes.add("webimage");
            scenes.add("disgust");
            scenes.add("watermark");

            byte[] imgData = Util.readFileByBytes(filePath);
            String imgStr = Base64Util.encode(imgData);
//            String imageUrl = "########网络图片地址#######";
            input.put("imgUrl", imgStr);//与image二者选一
            input.put("scenes", scenes);
            input.put("sceneConf", sceneConf);

            String params = GsonUtils.toJson(input);
            System.out.println(params);
            /**
             * 线上环境access_token有过期时间, 客户端可自行缓存,过期后重新获取。
             */
            String accessToken = getAuth(API_KEY, SECRET_KEY);
            String result = HttpUtil.post(imgCensorUrl, accessToken,"application/json", params);
            LogUtils.e("result " + result); 

打印结果

result {"log_id":15408096251078905,"error_msg":"download image error","error_code":282804}

这个是什么意思,急求解

图片如下:

收藏
点赞
0
个赞
共2条回复 最后由信仰_VIPok回复于2019-08
#3信仰_VIPok回复于2019-08

我也遇到的这个问题 ,您解决了吗?我今天遇到的 到现在还没有解决

1
#2尼玛么了发回复于2018-10

图片下载错误,是你们百度的原因么

1
TOP
切换版块