sima_utils.transformer.vision_preprocessorο
Attributesο
Classesο
Image processor for CLIP and SigLIP vision model. |
Module Contentsο
- sima_utils.transformer.vision_preprocessor.PILImageResamplingο
- sima_utils.transformer.vision_preprocessor.IMAGE_RGB_STATSο
- class sima_utils.transformer.vision_preprocessor.ImageProcessor(model_type: str, target_size: int)ο
Image processor for CLIP and SigLIP vision model.
- model_typeο
The type of vision model, βclipβ or βsiglipβ.
- image_sizeο
The target image size for the vision model.
- keep_aspectο
If true, keep aspect ratio by squaring before resize.
- image_meanο
The mean of RGB images used in model training.
- image_stdο
The std-dev of RGB images used in model training.
- resampleο
The method of resampling used to resize an image.
- model_type: strο
- image_size: tuple[int, int]ο
- keep_aspect: boolο
- image_mean: list[float]ο
- image_std: list[float]ο
- resample: PILImageResamplingο
- load_image_from_file(image_files: list[str])ο
- expand2square(pil_img: PIL.Image.Image)ο
- preprocess(images: list[PIL.Image.Image], channel_first: bool = True) list[numpy.ndarray] ο
Preprocess a list of images as input to a vision model.
- Parameters:
images β A list of RGB images.
channel_first β A flag to output CHW if true, or HWC if false.
- Returns:
A list of processed images as numpy arrays.
- sima_utils.transformer.vision_preprocessor.vm_typeο