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

Function normalize_data_3D

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

Source from the content-addressed store, hash-verified

9
10
11def normalize_data_3D(strands_data, mean, std):
12 # print("strands_data ",strands_data.shape)
13 orig_shape = strands_data.shape
14 nr_strands = strands_data.shape[0]
15 nr_elements_spatial_dim = strands_data.shape[1]
16 strands_data=strands_data.view(nr_strands, nr_elements_spatial_dim, -1)
17 # print("strands_data ",strands_data.shape)
18 # print("mean ",mean.shape)
19 strands_data=strands_data-mean.view(1,1,-1)
20 strands_data=strands_data/(std.view(1,1,-1)+1e-6)
21
22 #checks which elements are zero in the std and just set them to zero because they are basically noise
23 valid=std.view(1,1,-1)>=1e-9
24 strands_data=strands_data*valid
25
26 strands_data=strands_data.view(orig_shape)
27 return strands_data
28
29def normalize_data_2D(strands_data, mean, std):
30 # print("strands_data ",strands_data.shape)

Callers 1

normalize_gt_dataFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected