parameters: (self, inputs, oversample=True)
return_statement: return predictions
docstring: Predict classification probabilities of inputs.
  
          Parameters
          ----------
          inputs : iterable of (H x W x K) input ndarrays.
          oversample : boolean
              average predictions across center, corners, and mirrors
              when True (default). Center-only prediction when False.
  
          Returns
          -------
          predictions: (N x C) ndarray of class probabilities for N images and C
              classes.
docstring_summary: Predict classification probabilities of inputs.
docstring_tokens: Predict classification probabilities of inputs .
function: def predict(self, inputs, oversample=True):
          """
          Predict classification probabilities of inputs.
  
          Parameters
          ----------
          inputs : iterable of (H x W x K) input ndarrays.
          oversample : boolean
              average predictions across center, corners, and mirrors
              when True (default). Center-only prediction when False.
  
          Returns
          -------
          predictions: (N x C) ndarray of class probabilities for N images and C
              classes.
          """
          # Scale to standardize input dimensions.
          input_ = np.zeros((len(inputs),
                             self.image_dims[0],
                             self.image_dims[1],
                             inputs[0].shape[2]),
                            dtype=np.float32)
          for ix, in_ in enumerate(inputs):
              input_[ix] = caffe.io.resize_image(in_, self.image_dims)
  
          if oversample:
              # Generate center, corner, and mirrored crops.
              input_ = caffe.io.oversample(input_, self.crop_dims)
          else:
              # Take center crop.
              center = np.array(self.image_dims) / 2.0
              crop = np.tile(center, (1, 2))[0] + np.concatenate([
                  -self.crop_dims / 2.0,
                  self.crop_dims / 2.0
              ])
              crop = crop.astype(int)
              input_ = input_[:, crop[0]:crop[2], crop[1]:crop[3], :]
  
          # Classify
          caffe_in = np.zeros(np.array(input_.shape)[[0, 3, 1, 2]],
                              dtype=np.float32)
          for ix, in_ in enumerate(input_):
              caffe_in[ix] = self.transformer.preprocess(self.inputs[0], in_)
          out = self.forward_all(**{self.inputs[0]: caffe_in})
          predictions = out[self.outputs[0]]
  
          # For oversampling, average predictions across crops.
          if oversample:
              predictions = predictions.reshape((len(predictions) / 10, 10, -1))
              predictions = predictions.mean(1)
  
          return predictions
function_tokens: def predict ( self , inputs , oversample = True ) : # Scale to standardize input dimensions. input_ = np . zeros ( ( len ( inputs ) , self . image_dims [ 0 ] , self . image_dims [ 1 ] , inputs [ 0 ] . shape [ 2 ] ) , dtype = np . float32 ) for ix , in_ in enumerate ( inputs ) : input_ [ ix ] = caffe . io . resize_image ( in_ , self . image_dims ) if oversample : # Generate center, corner, and mirrored crops. input_ = caffe . io . oversample ( input_ , self . crop_dims ) else : # Take center crop. center = np . array ( self . image_dims ) / 2.0 crop = np . tile ( center , ( 1 , 2 ) ) [ 0 ] + np . concatenate ( [ - self . crop_dims / 2.0 , self . crop_dims / 2.0 ] ) crop = crop . astype ( int ) input_ = input_ [ : , crop [ 0 ] : crop [ 2 ] , crop [ 1 ] : crop [ 3 ] , : ] # Classify caffe_in = np . zeros ( np . array ( input_ . shape ) [ [ 0 , 3 , 1 , 2 ] ] , dtype = np . float32 ) for ix , in_ in enumerate ( input_ ) : caffe_in [ ix ] = self . transformer . preprocess ( self . inputs [ 0 ] , in_ ) out = self . forward_all ( * * { self . inputs [ 0 ] : caffe_in } ) predictions = out [ self . outputs [ 0 ] ] # For oversampling, average predictions across crops. if oversample : predictions = predictions . reshape ( ( len ( predictions ) / 10 , 10 , - 1 ) ) predictions = predictions . mean ( 1 ) return predictions