parameters: (self, in_, data)
return_statement: return caffe_in
docstring: Format input for Caffe:
          - convert to single
          - resize to input dimensions (preserving number of channels)
          - transpose dimensions to K x H x W
          - reorder channels (for instance color to BGR)
          - scale raw input (e.g. from [0, 1] to [0, 255] for ImageNet models)
          - subtract mean
          - scale feature
  
          Parameters
          ----------
          in_ : name of input blob to preprocess for
          data : (H' x W' x K) ndarray
  
          Returns
          -------
          caffe_in : (K x H x W) ndarray for input to a Net
docstring_summary: Format input for Caffe:
          - convert to single
          - resize to input dimensions (preserving number of channels)
          - transpose dimensions to K x H x W
          - reorder channels (for instance color to BGR)
          - scale raw input (e.g. from [0, 1] to [0, 255] for ImageNet models)
          - subtract mean
          - scale feature
docstring_tokens: Format input for Caffe : - convert to single - resize to input dimensions ( preserving number of channels ) - transpose dimensions to K x H x W - reorder channels ( for instance color to BGR ) - scale raw input ( e . g . from [ 0 1 ] to [ 0 255 ] for ImageNet models ) - subtract mean - scale feature
function: def preprocess(self, in_, data):
          """
          Format input for Caffe:
          - convert to single
          - resize to input dimensions (preserving number of channels)
          - transpose dimensions to K x H x W
          - reorder channels (for instance color to BGR)
          - scale raw input (e.g. from [0, 1] to [0, 255] for ImageNet models)
          - subtract mean
          - scale feature
  
          Parameters
          ----------
          in_ : name of input blob to preprocess for
          data : (H' x W' x K) ndarray
  
          Returns
          -------
          caffe_in : (K x H x W) ndarray for input to a Net
          """
          self.__check_input(in_)
          caffe_in = data.astype(np.float32, copy=False)
          transpose = self.transpose.get(in_)
          channel_swap = self.channel_swap.get(in_)
          raw_scale = self.raw_scale.get(in_)
          mean = self.mean.get(in_)
          input_scale = self.input_scale.get(in_)
          in_dims = self.inputs[in_][2:]
          if caffe_in.shape[:2] != in_dims:
              caffe_in = resize_image(caffe_in, in_dims)
          if transpose is not None:
              caffe_in = caffe_in.transpose(transpose)
          if channel_swap is not None:
              caffe_in = caffe_in[channel_swap, :, :]
          if raw_scale is not None:
              caffe_in *= raw_scale
          if mean is not None:
              caffe_in -= mean
          if input_scale is not None:
              caffe_in *= input_scale
          return caffe_in
function_tokens: def preprocess ( self , in_ , data ) : self . __check_input ( in_ ) caffe_in = data . astype ( np . float32 , copy = False ) transpose = self . transpose . get ( in_ ) channel_swap = self . channel_swap . get ( in_ ) raw_scale = self . raw_scale . get ( in_ ) mean = self . mean . get ( in_ ) input_scale = self . input_scale . get ( in_ ) in_dims = self . inputs [ in_ ] [ 2 : ] if caffe_in . shape [ : 2 ] != in_dims : caffe_in = resize_image ( caffe_in , in_dims ) if transpose is not None : caffe_in = caffe_in . transpose ( transpose ) if channel_swap is not None : caffe_in = caffe_in [ channel_swap , : , : ] if raw_scale is not None : caffe_in *= raw_scale if mean is not None : caffe_in -= mean if input_scale is not None : caffe_in *= input_scale return caffe_in