(self, image: Image)
| 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): |
no test coverage detected