102 def __init__(self, data_dir, stage):
103 super().__init__(
None,
None,
None,
None)
108 self.
coverage_maps = IOUtils.load_tensor(f
"{data_dir}/{stage}/coverage_maps.pt")
112 DataLoaderUtils.load_actions(f
"{data_dir}/{stage}")
115 f
"{data_dir}/{stage}"
118 h_vals = torch.linspace(1.0, -1.0, self.
coverage_maps.shape[-2] + 1)
119 h_vals = (h_vals[1:] + h_vals[:-1]) / 2
120 w_vals = torch.linspace(-1.0, 1.0, self.
coverage_maps.shape[-1] + 1)
121 w_vals = (w_vals[1:] + w_vals[:-1]) / 2
123 torch.stack([h_vals] * self.
coverage_maps.shape[-1], axis=1) / 100
126 torch.stack([w_vals] * self.
coverage_maps.shape[-2], axis=0) / 100
130 print(f
"Dataset: {self.stage} | Size: {self.dataset_size}")
132 f
"Coverage Maps: {self.coverage_maps.shape} | Device: {self.coverage_maps.device}"
134 print(f
"Targets: {self.targets.shape} | Device: {self.targets.device}")
136 f
"Robot Positions: {self.robot_positions.shape} | Device: {self.robot_positions.device}"
138 print(f
"Heatmap X: {self.heatmap_x.shape} | Device: {self.heatmap_x.device}")
139 print(f
"Heatmap Y: {self.heatmap_y.shape} | Device: {self.heatmap_y.device}")
150 heatmap_x = torch.stack([self.
heatmap_x] * coverage_maps.shape[0])
151 heatmap_y = torch.stack([self.
heatmap_y] * coverage_maps.shape[0])
153 [coverage_maps[:, 0], coverage_maps[:, 1], heatmap_x, heatmap_y], dim=1
157 edge_weights = CoverageEnvUtils.RobotPositionsToEdgeWeights(
160 data = DataLoaderUtils.to_torch_geometric_data(maps, edge_weights)
172 def __init__(self, data_dir, stage, use_comm_map, world_size):
173 super().__init__(
None,
None,
None,
None)
177 self.
maps = DataLoaderUtils.load_maps(f
"{data_dir}/{stage}", use_comm_map)
181 DataLoaderUtils.load_actions(f
"{data_dir}/{stage}")
183 self.
edge_weights = DataLoaderUtils.load_edge_weights(f
"{data_dir}/{stage}")
186 f
"{data_dir}/{stage}"
191 print(f
"Dataset: {self.stage} | Size: {self.dataset_size}")
192 print(f
"Maps: {self.maps.shape} | Device: {self.maps.device}")
193 print(f
"Targets: {self.targets.shape} | Device: {self.targets.device}")
195 f
"Edge Weights: {self.edge_weights.shape} | Device: {self.edge_weights.device}"
197 print(f
"Targets: {self.targets.shape} | Device: {self.targets.device}")
199 f
"Robot Positions: {self.robot_positions.shape} | Device: {self.robot_positions.device}"
206 data = DataLoaderUtils.to_torch_geometric_data(
213 targets = targets.view(-1, targets.shape[-1])
224 def __init__(self, data_dir, stage, output_dim):
225 super().__init__(
None,
None,
None,
None)
230 self.
features = DataLoaderUtils.load_features(f
"{data_dir}/{stage}", output_dim)
233 DataLoaderUtils.load_actions(f
"{data_dir}/{stage}")
235 self.
edge_weights = DataLoaderUtils.load_edge_weights(f
"{data_dir}/{stage}")
241 data = DataLoaderUtils.to_torch_geometric_data(