def __init__(self, deploy, weights, mean=(0, 0, 0), shapes=None, placeholder=False):
self.deploy = deploy
self.weights = weights
self.mean = np.float32(mean).reshape((3, 1, 1))
self.bgr = True
self.shapes = shapes
self.last_layer = None
if shapes:
self.last_layer = list(shapes)[-1]
if not placeholder:
import caffe
self.net = caffe.Net(self.deploy, 1, weights=self.weights)
self.data = LayerIndexer(self.net, 'data')
self.diff = LayerIndexer(self.net, 'diff')
self.contents = []
self.styles = []
self.img = None
self._arr_pool = ArrayPool()
评论列表
文章目录