MCPcopy Create free account
hub / github.com/YesianRohn/TextSSR / is_valid_image_imagelist

Function is_valid_image_imagelist

diffusers/src/diffusers/image_processor.py:45–57  ·  view source on GitHub ↗
(images)

Source from the content-addressed store, hash-verified

43
44
45def is_valid_image_imagelist(images):
46 # check if the image input is one of the supported formats for image and image list:
47 # it can be either one of below 3
48 # (1) a 4d pytorch tensor or numpy array,
49 # (2) a valid image: PIL.Image.Image, 2-d np.ndarray or torch.Tensor (grayscale image), 3-d np.ndarray or torch.Tensor
50 # (3) a list of valid image
51 if isinstance(images, (np.ndarray, torch.Tensor)) and images.ndim == 4:
52 return True
53 elif is_valid_image(images):
54 return True
55 elif isinstance(images, list):
56 return all(is_valid_image(image) for image in images)
57 return False
58
59
60class VaeImageProcessor(ConfigMixin):

Callers 2

preprocess_videoMethod · 0.85
preprocessMethod · 0.85

Calls 1

is_valid_imageFunction · 0.85

Tested by

no test coverage detected