def preprocess(self, im_path: str, pad_value: float = 0.0):
        """
        Image preprocess: resize the image (see `apply_transform`), normalize the pixels,
        and add padding.
        """
        # HH, WW = self.im_shape
        ori_img = cv2.imread(im_path)
        ori_shape = ori_img.shape
        if ori_shape[0] > ori_shape[1]:
            img = np.rot90(ori_img, k=1)
        else:
            img = ori_img
        inputs = self.apply_transform(img)
        resize_scale = img.shape[0] / inputs.shape[0]
        pixel_mean = np.array(self.pixel_mean).reshape(1, 1, -1)
        pixel_std = np.array(self.pixel_std).reshape(1, 1, -1)
        inputs = (inputs - pixel_mean) / pixel_std
        padding_size = (
            (0, self.min_size - inputs.shape[0]),
            (0, self.max_size - inputs.shape[1]),
            (0, 0),
        )
        inputs = np.pad(inputs, padding_size, constant_values=pad_value)
        inputs = inputs[np.newaxis, :]
        return inputs.astype("float16"), ori_img, ori_shape, resize_scale

        Image preprocess: resize the image (see `apply_transform`), normalize the pixels,
        and add padding.
        
examples/02_detectron2/predictor/predictor.py