caffe web demo 搭建

版权声明:本文为博主原创文章,遵循 CC 4.0 by-sa 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/Real_Myth/article/details/52745712

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/download_model_binary.py models/bvlc_reference_caffenet
./data/ilsvrc12/get_ilsvrc_aux.sh

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

运行

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

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

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/download_model_binary.py", line 5, in <module>
    import yaml
ImportError: No module named yaml


解决:sudo apt-get install python-yaml


2 问题

python examples/web_demo/app.py
Traceback (most recent call last):
  File "examples/web_demo/app.py", 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/app.py", 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/app.py", 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/app.py", line 18, in <module>
    import caffe
ImportError: No module named caffe

解决: 

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





展开阅读全文

没有更多推荐了,返回首页