def __init__(self, model_path,
weights_path,
mean_path=None,
image_scale=255.0,
batch_size=1,
input_shape=(227, 227)):
self.net = caffe.Net(model_path, # defines the structure of the model
weights_path, # contains the trained weights
caffe.TEST) # use test mode (e.g., don't perform dropout)
self.net.blobs['data'].reshape(batch_size, 3, input_shape[0], input_shape[1])
self.net.blobs['prob'].reshape(batch_size, )
self.mean_path = mean_path
self.image_scale = image_scale
self.batch_size = batch_size
self.transformer = self.set_transformer()
评论列表
文章目录