(self, img)
return imgs
Prepare an image for feeding it to a model.

        This is a standard preprocessing scheme used by feature extraction
        models.
        First, the image is scaled or resized according to :math:`scale_size`.
        Note that this step is optional.
        Next, the image is cropped to :math:`crop_size`.
        Last, the image is mean subtracted by an array :obj:`mean`.

        Args:
            img (~numpy.ndarray): An image. This is in CHW format.
                The range of its value is :math:`[0, 255]`.

        Returns:
            ~numpy.ndarray:
            A preprocessed image. This is 4D array whose batch size is
            the number of crops.
Prepare an image for feeding it to a model.
Prepare an image for feeding it to a model .
def _prepare(self, img):
        """Prepare an image for feeding it to a model.

        This is a standard preprocessing scheme used by feature extraction
        models.
        First, the image is scaled or resized according to :math:`scale_size`.
        Note that this step is optional.
        Next, the image is cropped to :math:`crop_size`.
        Last, the image is mean subtracted by an array :obj:`mean`.

        Args:
            img (~numpy.ndarray): An image. This is in CHW format.
                The range of its value is :math:`[0, 255]`.

        Returns:
            ~numpy.ndarray:
            A preprocessed image. This is 4D array whose batch size is
            the number of crops.

        """
        if self.scale_size is not None:
            if isinstance(self.scale_size, int):
                img = scale(img, size=self.scale_size)
            else:
                img = resize(img, size=self.scale_size)
        else:
            img = img.copy()

        if self.crop == '10':
            imgs = ten_crop(img, self.crop_size)
        elif self.crop == 'center':
            imgs = center_crop(img, self.crop_size)[np.newaxis]

        imgs -= self.mean[np.newaxis]

        return imgs
def _prepare ( self , img ) : if self . scale_size is not None : if isinstance ( self . scale_size , int ) : img = scale ( img , size = self . scale_size ) else : img = resize ( img , size = self . scale_size ) else : img = img . copy ( ) if self . crop == '10' : imgs = ten_crop ( img , self . crop_size ) elif self . crop == 'center' : imgs = center_crop ( img , self . crop_size ) [ np . newaxis ] imgs -= self . mean [ np . newaxis ] return imgs