MCPcopy Create free account
hub / github.com/ml-explore/mlx-examples / _preprocess

Method _preprocess

clip/image_processor.py:42–51  ·  view source on GitHub ↗
(self, image: Image)

Source from the content-addressed store, hash-verified

40 )
41
42 def _preprocess(self, image: Image) -> mx.array:
43 if self.do_resize:
44 image = resize(image, self.size)
45 if self.do_center_crop:
46 image = center_crop(image, (self.crop_size, self.crop_size))
47 image = mx.array(np.array(image))
48 image = rescale(image)
49 if self.do_normalize:
50 image = normalize(image, self.image_mean, self.image_std)
51 return image
52
53 @staticmethod
54 def from_pretrained(path: str):

Callers 1

__call__Method · 0.95

Calls 4

resizeFunction · 0.85
center_cropFunction · 0.85
rescaleFunction · 0.85
normalizeFunction · 0.70

Tested by

no test coverage detected