zoukankan      html  css  js  c++  java
  • 完成动物识别,自行拍摄动物图片进行上传并查看结果

    猴子

    狐狸

    import com.baidu.aip.imageclassify.AipImageClassify;
    import org.json.JSONObject;
    import java.util.HashMap;
    public class Sample {
        //设置APPID/AK/SK
        public static final String APP_ID = "25053576";
        public static final String API_KEY = "LVy72lb9RiKdixRaG06iUBnz";
        public static final String SECRET_KEY = "Mcw9Ad11m4BKCM9lHI776fgmIpnA4fdv";
        public static void main(String[] args) {
            // 初始化一个AipImageClassify
            AipImageClassify client = new AipImageClassify(APP_ID, API_KEY, SECRET_KEY);

            // 可选:设置网络连接参数
            client.setConnectionTimeoutInMillis(2000);
            client.setSocketTimeoutInMillis(60000);

            // 传入可选参数调用接口
            HashMap<String, String> options = new HashMap<String, String>();
            options.put("baike_num", "5");

            // 参数为本地路径
            /*
            String image = "C:\\Users\\杜子轩\\Desktop\\安妮海瑟薇.JPG";
            JSONObject res = client.advancedGeneral(image, options);
            System.out.println(res.toString(2));*/

            //动物识别

            String image = "C:\\Users\\杜子轩\\Desktop\\monkey.png";
            JSONObject res = client.animalDetect(image, options);
            System.out.println(res.toString(2));

        }
    }

  • 相关阅读:
    洛谷 P1363 幻想迷宫
    洛谷 P2872 [USACO07DEC]道路建设Building Roads
    字符编码
    python 基础数据类型
    python基础数据类型
    Python中的流程控制
    Python的入门基础
    计算机基础
    Java Random 随机数
    Java Array二维数组使用
  • 原文地址:https://www.cnblogs.com/D10304/p/15650054.html
Copyright © 2011-2022 走看看