ablation study
This commit is contained in:
@@ -135,7 +135,7 @@ class NBVReconstructionDataset(BaseDataset):
|
||||
scanned_coverages_rate,
|
||||
scanned_n_to_world_pose,
|
||||
) = ([], [], [])
|
||||
start_time = time.time()
|
||||
#start_time = time.time()
|
||||
start_indices = [0]
|
||||
total_points = 0
|
||||
for view in scanned_views:
|
||||
@@ -163,7 +163,7 @@ class NBVReconstructionDataset(BaseDataset):
|
||||
start_indices.append(total_points)
|
||||
|
||||
|
||||
end_time = time.time()
|
||||
#end_time = time.time()
|
||||
#Log.info(f"load data time: {end_time - start_time}")
|
||||
nbv_idx, nbv_coverage_rate = nbv[0], nbv[1]
|
||||
nbv_path = DataLoadUtil.get_path(self.root_dir, scene_name, nbv_idx)
|
||||
@@ -182,22 +182,22 @@ class NBVReconstructionDataset(BaseDataset):
|
||||
voxel_downsampled_combined_scanned_pts_np, inverse = self.voxel_downsample_with_mapping(combined_scanned_views_pts, 0.003)
|
||||
random_downsampled_combined_scanned_pts_np, random_downsample_idx = PtsUtil.random_downsample_point_cloud(voxel_downsampled_combined_scanned_pts_np, self.pts_num, require_idx=True)
|
||||
|
||||
all_idx_unique = np.arange(len(voxel_downsampled_combined_scanned_pts_np))
|
||||
all_random_downsample_idx = all_idx_unique[random_downsample_idx]
|
||||
scanned_pts_mask = []
|
||||
for idx, start_idx in enumerate(start_indices):
|
||||
if idx == len(start_indices) - 1:
|
||||
break
|
||||
end_idx = start_indices[idx+1]
|
||||
view_inverse = inverse[start_idx:end_idx]
|
||||
view_unique_downsampled_idx = np.unique(view_inverse)
|
||||
view_unique_downsampled_idx_set = set(view_unique_downsampled_idx)
|
||||
mask = np.array([idx in view_unique_downsampled_idx_set for idx in all_random_downsample_idx])
|
||||
scanned_pts_mask.append(mask)
|
||||
# all_idx_unique = np.arange(len(voxel_downsampled_combined_scanned_pts_np))
|
||||
# all_random_downsample_idx = all_idx_unique[random_downsample_idx]
|
||||
# scanned_pts_mask = []
|
||||
# for idx, start_idx in enumerate(start_indices):
|
||||
# if idx == len(start_indices) - 1:
|
||||
# break
|
||||
# end_idx = start_indices[idx+1]
|
||||
# view_inverse = inverse[start_idx:end_idx]
|
||||
# view_unique_downsampled_idx = np.unique(view_inverse)
|
||||
# view_unique_downsampled_idx_set = set(view_unique_downsampled_idx)
|
||||
# mask = np.array([idx in view_unique_downsampled_idx_set for idx in all_random_downsample_idx])
|
||||
# #scanned_pts_mask.append(mask)
|
||||
data_item = {
|
||||
"scanned_pts": np.asarray(scanned_views_pts, dtype=np.float32), # Ndarray(S x Nv x 3)
|
||||
"combined_scanned_pts": np.asarray(random_downsampled_combined_scanned_pts_np, dtype=np.float32), # Ndarray(N x 3)
|
||||
"scanned_pts_mask": np.asarray(scanned_pts_mask, dtype=np.bool), # Ndarray(N)
|
||||
#"scanned_pts_mask": np.asarray(scanned_pts_mask, dtype=np.bool), # Ndarray(N)
|
||||
"scanned_coverage_rate": scanned_coverages_rate, # List(S): Float, range(0, 1)
|
||||
"scanned_n_to_world_pose_9d": np.asarray(scanned_n_to_world_pose, dtype=np.float32), # Ndarray(S x 9)
|
||||
"best_coverage_rate": nbv_coverage_rate, # Float, range(0, 1)
|
||||
@@ -223,9 +223,9 @@ class NBVReconstructionDataset(BaseDataset):
|
||||
collate_data["scanned_n_to_world_pose_9d"] = [
|
||||
torch.tensor(item["scanned_n_to_world_pose_9d"]) for item in batch
|
||||
]
|
||||
collate_data["scanned_pts_mask"] = [
|
||||
torch.tensor(item["scanned_pts_mask"]) for item in batch
|
||||
]
|
||||
# collate_data["scanned_pts_mask"] = [
|
||||
# torch.tensor(item["scanned_pts_mask"]) for item in batch
|
||||
# ]
|
||||
''' ------ Fixed Length ------ '''
|
||||
|
||||
collate_data["best_to_world_pose_9d"] = torch.stack(
|
||||
|
Reference in New Issue
Block a user