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)
| 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""" |
no outgoing calls
no test coverage detected