MCPcopy Create free account
hub / github.com/buaacxf/VIPTR / tensor2im

Function tensor2im

dataset.py:343–348  ·  view source on GitHub ↗
(image_tensor, imtype=np.uint8)

Source from the content-addressed store, hash-verified

341
342
343def tensor2im(image_tensor, imtype=np.uint8):
344 image_numpy = image_tensor.cpu().float().numpy()
345 if image_numpy.shape[0] == 1:
346 image_numpy = np.tile(image_numpy, (3, 1, 1))
347 image_numpy = (np.transpose(image_numpy, (1, 2, 0)) + 1) / 2.0 * 255.0
348 return image_numpy.astype(imtype)
349
350
351def save_image(image_numpy, image_path):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected