MCPcopy Create free account
hub / github.com/ModalityDance/Omni-R1 / to_numpy_array

Function to_numpy_array

src/transformers/src/transformers/image_utils.py:211–217  ·  view source on GitHub ↗
(img)

Source from the content-addressed store, hash-verified

209
210
211def to_numpy_array(img) -> np.ndarray:
212 if not is_valid_image(img):
213 raise ValueError(f"Invalid image type: {type(img)}")
214
215 if is_vision_available() and isinstance(img, PIL.Image.Image):
216 return np.array(img)
217 return to_numpy(img)
218
219
220def infer_channel_dimension_format(

Callers 15

preprocessMethod · 0.85
preprocessMethod · 0.85
preprocessMethod · 0.85
reduce_labelMethod · 0.85
_preprocess_imageMethod · 0.85
_preprocess_imageMethod · 0.85
preprocessMethod · 0.85
__call__Method · 0.85
_preprocess_stepMethod · 0.85
__call__Method · 0.85
_preprocessMethod · 0.85

Calls 3

is_valid_imageFunction · 0.85
is_vision_availableFunction · 0.85
to_numpyFunction · 0.85

Tested by

no test coverage detected