MCPcopy Create free account
hub / github.com/OpenImagingLab/4DSloMo / easy_cmap

Function easy_cmap

utils/image_utils.py:21–28  ·  view source on GitHub ↗
(x: torch.Tensor)

Source from the content-addressed store, hash-verified

19 return 20 * torch.log10(1.0 / torch.sqrt(mse))
20
21def easy_cmap(x: torch.Tensor):
22 x_rgb = torch.zeros((3, x.shape[0], x.shape[1]), dtype=torch.float32, device=x.device)
23 x_max, x_min = x.max(), x.min()
24 x_normalize = (x - x_min) / (x_max - x_min)
25 x_rgb[0] = torch.clamp(x_normalize, 0, 1)
26 x_rgb[1] = torch.clamp(x_normalize, 0, 1)
27 x_rgb[2] = torch.clamp(x_normalize, 0, 1)
28 return x_rgb
29

Callers 1

training_reportFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected