• 百度AI实现图像鉴别-python


    from aip import AipImageClassify
    APP_ID = 'baidu_id'
    API_KEY = 'baiodu_key'
    SECRET_KEY = 'baidu_sk'
    
    client = AipImageClassify(APP_ID, API_KEY, SECRET_KEY)
    
    def get_file_content(filePath):
        with open(filePath, 'rb') as fp:
            return fp.read()
    
    image = get_file_content('2.jpg')
    result = client.advancedGeneral(image);
    print(result) ##python3 这里会显示为中文 print str(result).decode('unicode_escape') ##python2 需要转化下,否则显示为u'u6cd5u5170' 类型字符串。
    u'name': u'u5e03u9c81u585eu5c14u683cu91ccu82acu72ac'}]}


    ###############other############################
    # 定义参数变量
    options = {}
    options["top_num"] = 5 # 输出前5个可能性预测
    # 调用动物分类器
    result=client.animalDetect(image,options)
    # 调用汽车分类器
    result=client.carDetect(image,options)
    # """ 调用菜品识别 """
    # print(client.dishDetect(image))

    # """ 调用logo商标识别 """
    # print(client.logoSearch(image))

    # """ 调用动物识别 """
    # print(client.animalDetect(image))

    # """ 调用植物识别 """
    # print(client.plantDetect(image))
    print(result)



  • 相关阅读:
    [IOI2013]Dreaming
    Lost Cows
    Mobile Service
    [POI2005]Bank notes
    [CTSC2007]动物园zoo
    [CF1093F]Vasya and Array
    [雅礼集训 2017 Day1]市场
    [APIO2014]序列分割
    [CEOI2004]锯木厂选址
    [APIO2010]特别行动队
  • 原文地址:https://www.cnblogs.com/husbandmen/p/9343063.html
Copyright © 2020-2023  润新知