MCPcopy Create free account
hub / github.com/BVLC/caffe / preprocess

Method preprocess

examples/pycaffe/tools.py:27–39  ·  view source on GitHub ↗

preprocess() emulate the pre-processing occurring in the vgg16 caffe prototxt.

(self, im)

Source from the content-addressed store, hash-verified

25 self.scale = scale
26
27 def preprocess(self, im):
28 """
29 preprocess() emulate the pre-processing occurring in the vgg16 caffe
30 prototxt.
31 """
32
33 im = np.float32(im)
34 im = im[:, :, ::-1] # change to BGR
35 im -= self.mean
36 im *= self.scale
37 im = im.transpose((2, 0, 1))
38
39 return im
40
41 def deprocess(self, im):
42 """

Callers 1

load_next_imageMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected