src/transformers/image_utils.py/ImageFeatureExtractionMixin/_ensure_format_supported
class ImageFeatureExtractionMixin:    def _ensure_format_supported(self, image):
        if not isinstance(image, (PIL.Image.Image, np.ndarray)) and not is_torch_tensor(image):
            raise ValueError(
                f"Got type {type(image)} which is not supported, only `PIL.Image.Image`, `np.array` and "
                "`torch.Tensor` are."
            )