caffe python wrapper

来源:互联网 发布:获取电话号码的软件 编辑:程序博客网 时间:2024/05/09 13:42

caffe python wrapper

  • caffe python wrapper

Load some useful libraries:

import osimport numpy as npimport matplotlib.pyplot as plt%matplotlib inline

List the system path

import syssys.path

Import caffe package

import caffe

Then, set the computation mode CPU or GPU

caffe.set_mode_cpu()#or#caffe.set_device(0)#caffe.set_mode_gpu()

Create a network and load weights

net_model_file='./test.prototxt'net_weights='./snapshot/train_iter_106000.caffemodel'#load the modelnet = caffe.Net(net_model_file,net_weights,caffe.TEST)

The net.params are a list of [weight biases]

#weight in the conv1 layernet.params['conv1'][0].data#biases in the conv1 layernet.params['conv1'][1].data
0 0