(self, image)
return image
Preprocess an image for feature extraction.

        1. padded by mean pixel defined in feature extractor.
        2. scaled to [-1.0, 1.0]

        After resizing the image, the image is subtracted by a mean image value
        :obj:`self.mean`.

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

        Returns:
            ~numpy.ndarray:
            A preprocessed image.
Preprocess an image for feature extraction.
Preprocess an image for feature extraction .
def prepare(self, image):
        """Preprocess an image for feature extraction.

        1. padded by mean pixel defined in feature extractor.
        2. scaled to [-1.0, 1.0]

        After resizing the image, the image is subtracted by a mean image value
        :obj:`self.mean`.

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

        Returns:
            ~numpy.ndarray:
            A preprocessed image.

        """

        _, H, W = image.shape

        # Pad image and label to have dimensions >= min_input_size
        h = max(self.min_input_size[0], H)
        w = max(self.min_input_size[1], W)

        # Pad image with mean pixel value.
        mean = self.feature_extractor.mean
        bg = np.zeros((3, h, w), dtype=np.float32) + mean
        bg[:, :H, :W] = image
        image = bg

        # scale to [-1.0, 1.0]
        image = image / 127.5 - 1.0

        return image
def prepare ( self , image ) : _ , H , W = image . shape # Pad image and label to have dimensions >= min_input_size h = max ( self . min_input_size [ 0 ] , H ) w = max ( self . min_input_size [ 1 ] , W ) # Pad image with mean pixel value. mean = self . feature_extractor . mean bg = np . zeros ( ( 3 , h , w ) , dtype = np . float32 ) + mean bg [ : , : H , : W ] = image image = bg # scale to [-1.0, 1.0] image = image / 127.5 - 1.0 return image