添加caffe路径
import sys
caffe_root = '/home/lcy/caffe-master/'
sys.path.insert(0, caffe_root + 'python')
import caffe
设置CPU|GPU
CPU:
caffe.set_mode_cpu()
GPU:
caffe.set_mode_gpu()
加载模型model
model_def = 'deploy.prototxt'
model_weights = 'caffenet.caffemodel'
net = caffe.Net(model_def, # defines the structure of the model
model_weights, # contains the trained weights
caffe.TEST) # use test mode (e.g., don't perform dropout)
设置关闭log
os.environ['GLOG_minloglevel'] = '2'
The levels are:
0 - debug
1 - info (still a LOT of outputs)
2 - warnings
3 - errors