MCPcopy Create free account
hub / github.com/Ropedia/SpatialBench / __init__

Method __init__

benchmark/models/zipmap/zipmap/models/ZipMap.py:14–105  ·  view source on GitHub ↗
(self, img_size=518, patch_size=14, embed_dim=1024,
                 enable_camera=True,
                 enable_camera_svd=False,
                 enable_local_point=True,
                 enable_depth=True,
                 enable_nvs=False,
                 ttt_config=None,
                 nvs_config=None,
                 other_config=None,
                 )

Source from the content-addressed store, hash-verified

12
13class ZipMap(nn.Module, PyTorchModelHubMixin):
14 def __init__(self, img_size=518, patch_size=14, embed_dim=1024,
15 enable_camera=True,
16 enable_camera_svd=False,
17 enable_local_point=True,
18 enable_depth=True,
19 enable_nvs=False,
20 ttt_config=None,
21 nvs_config=None,
22 other_config=None,
23 ):
24 super().__init__()
25 self.ttt_config = ttt_config
26 self.other_config = other_config
27 self.nvs_config = nvs_config
28 if self.other_config is None:
29 self.other_config = {}
30
31 affine_invariant = self.other_config.get("affine_invariant", False)
32 mixed_image_tokenization = self.other_config.get("mixed_image_tokenization", False)
33
34 other_config_for_aggregator = {
35 "affine_invariant": affine_invariant,
36 "mixed_image_tokenization": mixed_image_tokenization,
37 }
38
39 self.aggregator = Aggregator(img_size=img_size, patch_size=patch_size, embed_dim=embed_dim, ttt_config=ttt_config, other_config=other_config_for_aggregator, nvs_config=nvs_config)
40
41 if enable_camera:
42 self.camera_head = CameraHead(dim_in=2 * embed_dim)
43 else:
44 self.camera_head = None
45
46 if enable_camera_svd:
47 # output is c2w 3 for translation, 9 for SVD rotation, 2 for FoV
48 self.camera_svd_head = CameraHead(dim_in=2 * embed_dim, pose_encoding_type='absT_svdR_FoV')
49 else:
50 self.camera_svd_head = None
51
52 if enable_local_point:
53 use_gradient_checkpointing_local_point = self.other_config.get("use_gradient_checkpointing_local_point", False)
54 self.local_point_head = DPTHead(
55 dim_in=2 * embed_dim,
56 output_dim=3,
57 activation="xy_exp",
58 conf_activation="none", # no confidence for local points
59 use_gradient_checkpointing=use_gradient_checkpointing_local_point,
60 # ! vggt set this to True but you should manually check set it to be False otherwise dpt residual block will have bugs
61 use_inplace=False
62 )
63 else:
64 self.local_point_head = None
65 if enable_depth:
66 use_gradient_checkpointing_depth = self.other_config.get("use_gradient_checkpointing_depth", False)
67 self.depth_head = DPTHead(
68 dim_in=2 * embed_dim,
69 output_dim=2,
70 activation="exp",
71 conf_activation="expp1",

Callers

nothing calls this directly

Calls 4

AggregatorClass · 0.90
CameraHeadClass · 0.90
DPTHeadClass · 0.90
getMethod · 0.45

Tested by

no test coverage detected