def set_image(
            self,
            image: np.ndarray,
            image_format: str="RGB", ) -> None:
        """
        Calculates the image embeddings for the provided image, allowing
        masks to be predicted with the 'predict' method.

        Arguments:
          image (np.ndarray): The image for calculating masks. Expects an
            image in HWC uint8 format, with pixel values in [0, 255].
          image_format (str): The color format of the image, in ['RGB', 'BGR'].
        """
        assert image_format in [
            "RGB",
            "BGR",
        ], f"image_format must be in ['RGB', 'BGR'], is {image_format}."
        if image_format != self.model.image_format:
            image = image[..., ::-1]

        # Transform the image to the form expected by the model
        input_image = self.transform.apply_image(image)  # numpy array
        input_image_paddle = paddle.to_tensor(input_image).cast('int32')

        input_image_paddle = input_image_paddle.transpose(
            [2, 0, 1])[None, :, :, :]

        self.set_paddle_image(input_image_paddle, image.shape[:2])

        Calculates the image embeddings for the provided image, allowing
        masks to be predicted with the 'predict' method.

        Arguments:
          image (np.ndarray): The image for calculating masks. Expects an
            image in HWC uint8 format, with pixel values in [0, 255].
          image_format (str): The color format of the image, in ['RGB', 'BGR'].
        
contrib/SegmentAnything/segment_anything/predictor.py