MCPcopy Create free account
hub / github.com/OpenGVLab/DragGAN / to_image

Function to_image

draggan/web.py:48–53  ·  view source on GitHub ↗
(tensor)

Source from the content-addressed store, hash-verified

46
47
48def to_image(tensor):
49 tensor = tensor.squeeze(0).permute(1, 2, 0)
50 arr = tensor.detach().cpu().numpy()
51 arr = (arr - arr.min()) / (arr.max() - arr.min())
52 arr = arr * 255
53 return arr.astype('uint8')
54
55
56def add_points_to_image(image, points, size=5):

Callers 2

on_image_changeFunction · 0.70
on_select_mask_tabFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected