MCPcopy Create free account
hub / github.com/Meshcapade/difflocks / normalize_data_2D

Function normalize_data_2D

models/strand_codec.py:29–45  ·  view source on GitHub ↗
(strands_data, mean, std)

Source from the content-addressed store, hash-verified

27 return strands_data
28
29def normalize_data_2D(strands_data, mean, std):
30 # print("strands_data ",strands_data.shape)
31 orig_shape = strands_data.shape
32 nr_strands = strands_data.shape[0]
33 strands_data=strands_data.view(nr_strands, -1)
34 # print("strands_data ",strands_data.shape)
35 # print("mean ",mean.shape)
36 strands_data=strands_data-mean.view(1,-1)
37
38 strands_data=strands_data/(std.view(1,-1)+1e-6)
39
40 #checks which elements are zero in the std and just set them to zero because they are basically noise
41 valid=std.view(1,-1)>=1e-9
42 strands_data=strands_data*valid
43
44 strands_data=strands_data.view(orig_shape)
45 return strands_data
46
47def un_normalize_data(strands_data, mean, std):
48 orig_shape = strands_data.shape

Callers 1

normalize_gt_dataFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected