caffe python常用语句

来源:互联网 发布:大麻在淘宝黑话 编辑:程序博客网 时间:2024/05/20 09:48

添加caffe路径

import syscaffe_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

0 0