MCPcopy Index your code
hub / github.com/OpenGVLab/DragGAN / to_image

Function to_image

draggan/deprecated/web.py:52–57  ·  view source on GitHub ↗
(tensor)

Source from the content-addressed store, hash-verified

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

Callers 8

on_dragFunction · 0.70
on_resetFunction · 0.70
on_undoFunction · 0.70
on_change_modelFunction · 0.70
on_new_imageFunction · 0.70
on_image_changeFunction · 0.70
on_select_mask_tabFunction · 0.70
mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected