MCPcopy
hub / github.com/ali-vilab/VACE / convert_to_numpy

Function convert_to_numpy

vace/annotators/utils.py:42–51  ·  view source on GitHub ↗
(image)

Source from the content-addressed store, hash-verified

40 return [left, top, right, bottom]
41
42def convert_to_numpy(image):
43 if isinstance(image, Image.Image):
44 image = np.array(image)
45 elif isinstance(image, torch.Tensor):
46 image = image.detach().cpu().numpy()
47 elif isinstance(image, np.ndarray):
48 image = image.copy()
49 else:
50 raise f'Unsurpport datatype{type(image)}, only surpport np.ndarray, torch.Tensor, Pillow Image.'
51 return image
52
53def convert_to_pil(image):
54 if isinstance(image, Image.Image):

Callers 15

forwardMethod · 0.85
forwardMethod · 0.85
forwardMethod · 0.85
forwardMethod · 0.85
forwardMethod · 0.85
forwardMethod · 0.85
forwardMethod · 0.85
forwardMethod · 0.85
forwardMethod · 0.85
forwardMethod · 0.85
forwardMethod · 0.85
forwardMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected