parameters: (self)
return_statement: return self.transformer.preprocess(im), multilabel
docstring: Load the next image in a batch.
docstring_summary: Load the next image in a batch.
docstring_tokens: Load the next image in a batch .
function: def load_next_image(self):
          """
          Load the next image in a batch.
          """
          # Did we finish an epoch?
          if self._cur == len(self.indexlist):
              self._cur = 0
              shuffle(self.indexlist)
  
          # Load an image
          index = self.indexlist[self._cur]  # Get the image index
          image_file_name = index + '.jpg'
          im = np.asarray(Image.open(
              osp.join(self.pascal_root, 'JPEGImages', image_file_name)))
          im = scipy.misc.imresize(im, self.im_shape)  # resize
  
          # do a simple horizontal flip as data augmentation
          flip = np.random.choice(2)*2-1
          im = im[:, ::flip, :]
  
          # Load and prepare ground truth
          multilabel = np.zeros(20).astype(np.float32)
          anns = load_pascal_annotation(index, self.pascal_root)
          for label in anns['gt_classes']:
              # in the multilabel problem we don't care how MANY instances
              # there are of each class. Only if they are present.
              # The "-1" is b/c we are not interested in the background
              # class.
              multilabel[label - 1] = 1
  
          self._cur += 1
          return self.transformer.preprocess(im), multilabel
function_tokens: def load_next_image ( self ) : # Did we finish an epoch? if self . _cur == len ( self . indexlist ) : self . _cur = 0 shuffle ( self . indexlist ) # Load an image index = self . indexlist [ self . _cur ] # Get the image index image_file_name = index + '.jpg' im = np . asarray ( Image . open ( osp . join ( self . pascal_root , 'JPEGImages' , image_file_name ) ) ) im = scipy . misc . imresize ( im , self . im_shape ) # resize # do a simple horizontal flip as data augmentation flip = np . random . choice ( 2 ) * 2 - 1 im = im [ : , : : flip , : ] # Load and prepare ground truth multilabel = np . zeros ( 20 ) . astype ( np . float32 ) anns = load_pascal_annotation ( index , self . pascal_root ) for label in anns [ 'gt_classes' ] : # in the multilabel problem we don't care how MANY instances # there are of each class. Only if they are present. # The "-1" is b/c we are not interested in the background # class. multilabel [ label - 1 ] = 1 self . _cur += 1 return self . transformer . preprocess ( im ) , multilabel