def make_net(mean=None, net_dir='VGG_S_rgb'):
# net_dir specifies a root directory containing a *.caffemodel file
# Options in our setup are: VGG_S_[rgb / lbp / cyclic_lbp / cyclic_lbp_5 / cyclic_lbp_10]
# This should hopefully already be in your system path, but just to be sure:
caffe_root = '/home/Users/Dan/Development/caffe/'
sys.path.insert(0, caffe_root + 'python')
# Configure matplotlib
plt.rcParams['figure.figsize'] = (10, 10)
plt.rcParams['image.interpolation'] = 'nearest'
plt.rcParams['image.cmap'] = 'gray'
# Generate paths to the various model files
net_root = 'models'
net_pretrained = os.path.join(net_root, net_dir, 'EmotiW_VGG_S.caffemodel')
net_model_file = os.path.join(net_root, net_dir, 'deploy.prototxt')
# Construct Caffe network object
VGG_S_Net = caffe.Classifier(net_model_file, net_pretrained,
mean=mean,
channel_swap=(2,1,0),
raw_scale=255,
image_dims=(256, 256))
return VGG_S_Net
# Load a minibatch of images
# Inputs: List of image filenames,
# Color boolean (true if images are in color),
# List of labels corresponding to each image,
# Index of first image to load
# Number of images to load
# Output: List of image numpy arrays of size Num x (W x H x 3)
# List of labels for just the images in the batch
评论列表
文章目录