V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
推荐学习书目
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 · Mar 2, 2015 · 4456 views
    This topic created in 4075 days ago, the information mentioned may be changed or developed.

    代码托管地址 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知乎专栏的启发

    Supplement 1  ·  Mar 2, 2015
    需要requests库
    9 replies    2015-03-30 19:33:36 +08:00
    yanchao7511461
        1
    yanchao7511461  
       Mar 2, 2015
    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  
       Mar 2, 2015 via iPhone
    楼主的这个要不要训练的?
    neilp
        3
    neilp  
       Mar 2, 2015
    能不能问一下, 楼主比zhihu上那个版本 改了什么?
    answer42
        4
    answer42  
    OP
       Mar 2, 2015
    @neilp 处理了服务器返回的错误信息。例如:当服务器不能从输入的url读取到图像时。
    answer42
        5
    answer42  
    OP
       Mar 2, 2015
    @tolerious 这个是cloud sight的api。我想它们应该是有很大的数据量拿来训练的。
    answer42
        6
    answer42  
    OP
       Mar 2, 2015
    @yanchao7511461 已修正这个错误。详见代码。
    tolerious
        7
    tolerious  
       Mar 3, 2015
    @answer42 我用过Face++的API觉得不是十分准确
    hayao650
        8
    hayao650  
       Mar 30, 2015
    只能识别是什么吗?可以识别一张照片中有多少人么?
    answer42
        9
    answer42  
    OP
       Mar 30, 2015
    @hayao650 这个恐怕得您自己想办法来实现。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   6017 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 43ms · UTC 02:02 · PVG 10:02 · LAX 19:02 · JFK 22:02
    ♥ Do have faith in what you're doing.