MCPcopy
hub / github.com/magicleap/Atlas / load

Method load

atlas/tsdf.py:118–144  ·  view source on GitHub ↗

Load a tsdf from disk (stored as npz). Args: fname: path to archive voxel_types: list of strings specifying which volumes to load ex ['tsdf', 'color']. tsdf is loaded regardless. to load all volumes in archive use None (default)

(cls, fname, voxel_types=None)

Source from the content-addressed store, hash-verified

116
117 @classmethod
118 def load(cls, fname, voxel_types=None):
119 """ Load a tsdf from disk (stored as npz).
120
121 Args:
122 fname: path to archive
123 voxel_types: list of strings specifying which volumes to load
124 ex ['tsdf', 'color']. tsdf is loaded regardless.
125 to load all volumes in archive use None (default)
126
127 Returns:
128 TSDF
129 """
130
131 with np.load(fname) as data:
132 voxel_size = data['voxel_size'].item()
133 origin = torch.as_tensor(data['origin']).view(1,3)
134 tsdf_vol = torch.as_tensor(data['tsdf'])
135 attribute_vols = {}
136 attributes = {}
137 if 'color' in data and (voxel_types is None or 'color' in voxel_types):
138 attribute_vols['color'] = torch.as_tensor(data['color'])
139 if ('instance' in data and (voxel_types is None or
140 'instance' in voxel_types or
141 'semseg' in voxel_types)):
142 attribute_vols['instance'] = torch.as_tensor(data['instance'])
143 ret = cls(voxel_size, origin, tsdf_vol, attribute_vols, attributes)
144 return ret
145
146 def to(self, device):
147 """ Move tensors to a device"""

Callers 10

label_sceneFunction · 0.80
visualizeFunction · 0.80
processFunction · 0.80
build_backbone2dFunction · 0.80
eval_tsdfFunction · 0.80
load_info_jsonFunction · 0.80
map_tsdfFunction · 0.80
get_meshMethod · 0.80
prepare_scannet_sceneFunction · 0.80
prepare_rio_sceneFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected