MCPcopy
hub / github.com/cvg/Hierarchical-Localization / get_descriptors

Function get_descriptors

hloc/pairs_from_retrieval.py:36–45  ·  view source on GitHub ↗
(names, path, name2idx=None, key='global_descriptor')

Source from the content-addressed store, hash-verified

34
35
36def get_descriptors(names, path, name2idx=None, key='global_descriptor'):
37 if name2idx is None:
38 with h5py.File(str(path), 'r', libver='latest') as fd:
39 desc = [fd[n][key].__array__() for n in names]
40 else:
41 desc = []
42 for n in names:
43 with h5py.File(str(path[name2idx[n]]), 'r', libver='latest') as fd:
44 desc.append(fd[n][key].__array__())
45 return torch.from_numpy(np.stack(desc, 0)).float()
46
47
48def pairs_from_score_matrix(scores: torch.Tensor,

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected