V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
answer42
V2EX  ›  Python

写了一个使用 cloud Sight 提供的 API 获取图像识别结果的脚本

  •  2
     
  •   answer42 · 2015-03-02 01:28:19 +08:00 · 3484 次点击
    这是一个创建于 3333 天前的主题,其中的信息可能已经有所发展或是发生改变。

    代码托管地址 np-csu/pyCloudSightAPI

    运行样例:
    bash
    $ python cloudSightAPI.py 'http://img.taopic.com/uploads/allimg/130522/240439-1305221639269.jpg'
    recognizing...
    recognizing...
    RESULT:
    image url: http://img.taopic.com/uploads/allimg/130522/240439-1305221639269.jpg
    image name: 美国国旗

    example image

    思路:
    1. 使用chrome浏览器提供的Developer tools
    2. 得到evil-say知乎专栏的启发

    第 1 条附言  ·  2015-03-02 23:16:23 +08:00
    需要requests库
    9 条回复    2015-03-30 19:33:36 +08:00
    yanchao7511461
        1
    yanchao7511461  
       2015-03-02 09:27:21 +08:00
    D:\pyCloudSightAPI-master>cloudSightAPI.py "http://preview.quanjing.com/fodrm012
    /fod-408062.jpg"
    Traceback (most recent call last):
    File "D:\pyCloudSightAPI-master\cloudSightAPI.py", line 80, in <module>
    main()
    File "D:\pyCloudSightAPI-master\cloudSightAPI.py", line 77, in main
    makeRequest(imageUrl)
    File "D:\pyCloudSightAPI-master\cloudSightAPI.py", line 32, in makeRequest
    token = response.json()['token']
    KeyError: 'token'

    这是什么情况.... 里面的key我换过了
    tolerious
        2
    tolerious  
       2015-03-02 09:46:49 +08:00 via iPhone
    楼主的这个要不要训练的?
    neilp
        3
    neilp  
       2015-03-02 20:43:00 +08:00
    能不能问一下, 楼主比zhihu上那个版本 改了什么?
    answer42
        4
    answer42  
    OP
       2015-03-02 21:24:37 +08:00
    @neilp 处理了服务器返回的错误信息。例如:当服务器不能从输入的url读取到图像时。
    answer42
        5
    answer42  
    OP
       2015-03-02 21:25:22 +08:00
    @tolerious 这个是cloud sight的api。我想它们应该是有很大的数据量拿来训练的。
    answer42
        6
    answer42  
    OP
       2015-03-02 21:25:44 +08:00
    @yanchao7511461 已修正这个错误。详见代码。
    tolerious
        7
    tolerious  
       2015-03-03 10:40:06 +08:00
    @answer42 我用过Face++的API觉得不是十分准确
    hayao650
        8
    hayao650  
       2015-03-30 14:34:05 +08:00
    只能识别是什么吗?可以识别一张照片中有多少人么?
    answer42
        9
    answer42  
    OP
       2015-03-30 19:33:36 +08:00
    @hayao650 这个恐怕得您自己想办法来实现。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   6058 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 06:13 · PVG 14:13 · LAX 23:13 · JFK 02:13
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.