caffe web demo 搭建

版权声明:本文为博主原创文章,遵循 CC 4.0 by-sa 版权协议,转载请附上原文出处链接和本声明。

Web Demo


demo 需要Python支持和一些依赖,确保已经安装依赖,运行: pip install -r examples/web_demo/requirements.txt, 并确定已经编译了Python Caffe并且包含在PYTHONPATH 中(seeinstallation instructions).

确保已经下载了 Reference CaffeNet Model 和 the ImageNet Auxiliary Data:

./scripts/ models/bvlc_reference_caffenet

NOTE: 如果运行有问题,请尝试重新下载auxiliary files.


执行 python examples/web_demo/ 将会启动demo服务, 本机访问地址http://可以开启web server的debug模式 , 或者改变端口号:

% python examples/web_demo/ -h
Usage: [options]

  -h, --help            show this help message and exit
  -d, --debug           enable debug mode
  -p PORT, --port=PORT  which port to serve content on

“maximally accurate” 结果如何产生?

In a nutshell: ImageNet predictions are made at the leaf nodes, but the organization of the project allows leaf nodes to be united via more general parent nodes, with ‘entity’ at the very top.To give “maximally accurate” results, we “back off” from maximally specific predictions to maintain a high accuracy.The bet_file that is loaded in the demo provides the graph structure and names of all relevant ImageNet nodes as well as measures of information gain between them.Please see the “Hedging your bets” paper fromCVPR 2012 for further information.



1 问题

Traceback (most recent call last):
  File "./scripts/", line 5, in <module>
    import yaml
ImportError: No module named yaml

解决:sudo apt-get install python-yaml

2 问题

python examples/web_demo/
Traceback (most recent call last):
  File "examples/web_demo/", line 6, in <module>
    import flask
ImportError: No module named flask

解决:sudo apt-get install python-flask

3 问题

Traceback (most recent call last):
  File "examples/web_demo/", line 9, in <module>
    import tornado.wsgi
ImportError: No module named tornado.wsgi

解决:sudo apt-get install python-tornado

4 问题

Traceback (most recent call last):
  File "examples/web_demo/", line 12, in <module>
    import pandas as pd
ImportError: No module named pandas

解决:sudo apt-get install python-pandas

5 问题

Traceback (most recent call last):
  File "examples/web_demo/", line 18, in <module>
    import caffe
ImportError: No module named caffe


 pls import caffe in $CAFFE/python or add the path to sys.path