MCPcopy Create free account
hub / github.com/Robotics-STAR-Lab/H2-Mapping / Decoder

Class Decoder

mapping/src/functions/parallel_hash_net.py:6–91  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4
5
6class Decoder(nn.Module):
7 def __init__(self,
8 bound=None,
9 voxel_size=None,
10 L=None,
11 F_entry=None,
12 log2_T=None,
13 b=None,
14 **kwargs):
15 super().__init__()
16
17 self.bound = torch.FloatTensor(bound)
18 self.bound_dis = self.bound[:, 1] - self.bound[:, 0]
19 self.max_dis = torch.ceil(torch.max(self.bound_dis))
20 N_min = int(self.max_dis / voxel_size)
21 self.hash_sdf_out = \
22 tcnn.NetworkWithInputEncoding(
23 n_input_dims=3, n_output_dims=1,
24 encoding_config={
25 "otype": "Grid",
26 "type": "Hash",
27 "n_levels": L,
28 "n_features_per_level": F_entry,
29 "log2_hashmap_size": log2_T,
30 "base_resolution": N_min, # 1/base_resolution is the grid_size
31 "per_level_scale": b,
32 "interpolation": "Linear"
33 },
34 network_config={
35 "otype": "FullyFusedMLP",
36 "activation": "ReLU",
37 "output_activation": "None",
38 "n_neurons": 64,
39 "n_hidden_la2yers": 1,
40 }
41 )
42
43 self.hash_color_out = \
44 tcnn.NetworkWithInputEncoding(
45 n_input_dims=3, n_output_dims=3,
46 encoding_config={
47 "otype": "Grid",
48 "type": "Hash",
49 "n_levels": L,
50 "n_features_per_level": F_entry,
51 "log2_hashmap_size": log2_T,
52 "base_resolution": N_min, # 1/base_resolution is the grid_size
53 "per_level_scale": b,
54 "interpolation": "Linear"
55 },
56 network_config={
57 "otype": "FullyFusedMLP",
58 "activation": "ReLU",
59 "output_activation": "Sigmoid",
60 "n_neurons": 64,
61 "n_hidden_layers": 2,
62 }
63 )

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected