          return retval
  
      # <<< DETECTION IMAGE COMPILATION METHODS >>> #
      def compile_detection_image(self, input_image,
                                  is_square=False, scale_up=False, to_rgb=False, to_grayscale=False):
          """ Compile the detection image """
          image = input_image.copy()
          if to_rgb:
              image = image[:, :, ::-1]
          elif to_grayscale:
 
</s> remove         image = self.scale_image(image, scale)
        return [image, scale]
 </s> add         image = self.scale_image(image, scale, pad_to)
        if pad_to is None:
            return [image, scale]
        pad_left = int(pad_to[0] - int(input_image.shape[1] * scale)) // 2
        pad_top = int(pad_to[1] - int(input_image.shape[0] * scale)) // 2
        return [image, scale, (pad_left, pad_top)] </s> remove         dims = (int(width * scale), int(height * scale))

        if scale < 1.0:
            logger.trace("Resizing image from %sx%s to %s.",
                         width, height, "x".join(str(i) for i in dims))
 </s> add         if scale != 1.0:
            dims = (int(width * scale), int(height * scale))
            if scale < 1.0:
                logger.verbose("Resizing image from %sx%s to %s. Scale=%s",
                               width, height, "x".join(str(i) for i in dims), scale)
            image = cv2.resize(image, dims, interpolation=interpln)
        if pad_to:
            image = Detector.pad_image(image, pad_to)
        return image </s> remove         image = cv2.resize(image, dims, interpolation=interpln)
 </s> add     @staticmethod
    def pad_image(image, target):
        height, width = image.shape[:2]
        if width < target[0] or height < target[1]:
            pad_l = (target[0] - width) // 2
            pad_r = (target[0] - width) - pad_l
            pad_t = (target[1] - height) // 2
            pad_b = (target[1] - height) - pad_t
            img = cv2.copyMakeBorder(
                image, pad_t, pad_b, pad_l, pad_r,
                cv2.BORDER_CONSTANT, (0, 0, 0)
            )
            return img </s> remove     def scale_image(image, scale):
        """ Scale the image """
 </s> add     def scale_image(image, scale, pad_to=None):
        """ Scale the image and optional pad to given size """ </s> remove         if scale == 1.0:
            return image

 </s> add 
                                is_square=False, scale_up=False, to_rgb=False,
                                to_grayscale=False, pad_to=None):
          return retval
  
      # <<< DETECTION IMAGE COMPILATION METHODS >>> #
      def compile_detection_image(self, input_image,
                                is_square=False, scale_up=False, to_rgb=False,
                                to_grayscale=False, pad_to=None):
          """ Compile the detection image """
          image = input_image.copy()
          if to_rgb:
              image = image[:, :, ::-1]
          elif to_grayscale:
keep keep keep keep replace keep keep keep keep keep
 Added s3fd-amd + minor fixes (#837) 
plugins/extract/detect/_base.py