MCPcopy Index your code
hub / github.com/InternRobotics/EmbodiedScan / EmbodiedScanExplorer

Class EmbodiedScanExplorer

embodiedscan/explorer.py:18–566  ·  view source on GitHub ↗

EmbodiedScan Explorer. This class serves as the API for analyze and visualize EmbodiedScan dataset with demo data. Args: data_root (str): Path of dataset root. ann_file (str): Path of annotation file. verbose (bool): Whether to print related messages. Defaults t

Source from the content-addressed store, hash-verified

16
17
18class EmbodiedScanExplorer:
19 """EmbodiedScan Explorer.
20
21 This class serves as the API for analyze and visualize EmbodiedScan
22 dataset with demo data.
23
24 Args:
25 data_root (str): Path of dataset root.
26 ann_file (str): Path of annotation file.
27 verbose (bool): Whether to print related messages. Defaults to False.
28 color_setting (str, optional): Color settings for visualization.
29 Defaults to None.
30 Accept the path to the setting file like
31 embodiedscan/visualization/full_color_map.txt
32 thickness (float): Thickness of of the displayed box lines.
33 """
34
35 def __init__(self,
36 data_root: Union[dict, List],
37 ann_file: Union[dict, List, str],
38 verbose: bool = False,
39 color_setting: str = None,
40 thickness: float = 0.01):
41
42 if isinstance(ann_file, dict):
43 ann_file = list(ann_file.values())
44 elif isinstance(ann_file, str):
45 ann_file = [ann_file]
46 self.ann_files = ann_file
47
48 if isinstance(data_root, str):
49 data_root = [data_root]
50 if isinstance(data_root, list):
51 self.data_root = dict()
52 for dataset in DATASETS:
53 self.data_root[dataset] = None
54 for root in data_root:
55 for dataset in DATASETS:
56 if dataset.lower() in root.lower():
57 self.data_root[dataset] = root
58 break
59 if isinstance(data_root, dict):
60 self.data_root = data_root
61
62 self.verbose = verbose
63 self.thickness = thickness
64
65 if self.verbose:
66 print('Dataset root')
67 for dataset in DATASETS:
68 print(dataset, ':', self.data_root.get(dataset, None))
69
70 if self.verbose:
71 print('Loading')
72 self.metainfo = None
73 data_list = []
74 for file in self.ann_files:
75 if isinstance(file, list):

Callers 1

mainFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected