docstr: 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'].
docstr_tok: ["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","'","]","."]
code: 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])
  
file_path: PaddleSeg/contrib/SegmentAnything/segment_anything/predictor.py
imports: import numpy
  from typing import Optional, Tuple
  import paddle
  from .modeling import Sam
  from .utils.transforms import ResizeLongestSide
label_desc: Use image node_id 2 for calling the SamPredictor obj's underlying member method code with example usage: obj.set_image(image, image_format) without return types