MCPcopy Create free account
hub / github.com/CompVis/diff2flow / per_sample_min_max_normalization

Function per_sample_min_max_normalization

diff2flow/dataset/depth_utils.py:122–130  ·  view source on GitHub ↗

Normalize each sample in a batch independently with min-max normalization to [0, 1]

(x)

Source from the content-addressed store, hash-verified

120
121
122def per_sample_min_max_normalization(x):
123 """ Normalize each sample in a batch independently
124 with min-max normalization to [0, 1] """
125 bs, *shape = x.shape
126 x_ = einops.rearrange(x, "b ... -> b (...)")
127 min_val = einops.reduce(x_, "b ... -> b", "min")[..., None]
128 max_val = einops.reduce(x_, "b ... -> b", "max")[..., None]
129 x_ = (x_ - min_val) / (max_val - min_val)
130 return x_.reshape(bs, *shape)
131
132
133def colorize_depth_map(

Callers 1

colorize_depth_mapFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected