diff --git a/configs/local/strategy_generate_config.yaml b/configs/local/strategy_generate_config.yaml index cf444b0..8340161 100644 --- a/configs/local/strategy_generate_config.yaml +++ b/configs/local/strategy_generate_config.yaml @@ -16,14 +16,14 @@ runner: compute_with_normal: False scan_points_threshold: 10 overwrite: False - seq_num: 15 + seq_num: 10 dataset_list: - OmniObject3d datasets: OmniObject3d: - root_dir: C:\\Document\\Local Project\\nbv_rec\\nbv_reconstruction\\temp - from: 0 - to: 1 # -1 means end + root_dir: /data/hofee/nbv_rec_part2_preprocessed + from: 155 + to: 165 # ..-1 means end diff --git a/core/global_pts_n_num_pipeline.py b/core/global_pts_n_num_pipeline.py index ff6e304..b0e44ba 100644 --- a/core/global_pts_n_num_pipeline.py +++ b/core/global_pts_n_num_pipeline.py @@ -1,4 +1,5 @@ import torch +import time from torch import nn import PytorchBoot.namespace as namespace import PytorchBoot.stereotype as stereotype @@ -58,7 +59,10 @@ class NBVReconstructionGlobalPointsPipeline(nn.Module): return perturbed_x, random_t, target_score, std def forward_train(self, data): + start_time = time.time() main_feat = self.get_main_feat(data) + end_time = time.time() + print("get_main_feat time: ", end_time - start_time) """ get std """ best_to_world_pose_9d_batch = data["best_to_world_pose_9d"] perturbed_x, random_t, target_score, std = self.pertube_data( @@ -117,7 +121,7 @@ class NBVReconstructionGlobalPointsPipeline(nn.Module): for seq_idx in range(seq_len): partial_idx_in_combined_pts = scanned_mask == seq_idx # Ndarray(V), N->V idx mask partial_perpoint_feat = perpoint_scanned_feat[partial_idx_in_combined_pts] # Ndarray(V x Dl) - partial_feat = torch.mean(partial_perpoint_feat, dim=0) # Tensor(Dl) + partial_feat = torch.max(partial_perpoint_feat, dim=0) # Tensor(Dl) partial_feat_seq.append(partial_feat) scanned_target_pts_num.append(partial_perpoint_feat.shape[0]) diff --git a/runners/strategy_generator.py b/runners/strategy_generator.py index 60a5cfc..e306c32 100644 --- a/runners/strategy_generator.py +++ b/runners/strategy_generator.py @@ -86,13 +86,17 @@ class StrategyGenerator(Runner): nrm_path = os.path.join(root,scene_name, "nrm", f"{frame_idx}.npy") idx_path = os.path.join(root,scene_name, "scan_points_indices", f"{frame_idx}.npy") pts = np.load(pts_path) - if pts.shape[0] == 0: - nrm = np.zeros((0,3)) - else: - nrm = np.load(nrm_path) - indices = np.load(idx_path) + if self.compute_with_normal: + if pts.shape[0] == 0: + nrm = np.zeros((0,3)) + else: + nrm = np.load(nrm_path) + nrm_list.append(nrm) + pts_list.append(pts) - nrm_list.append(nrm) + + indices = np.load(idx_path) + scan_points_indices_list.append(indices) if pts.shape[0] > 0: non_zero_cnt += 1 diff --git a/utils/reconstruction.py b/utils/reconstruction.py index ac359aa..8530e53 100644 --- a/utils/reconstruction.py +++ b/utils/reconstruction.py @@ -75,6 +75,7 @@ class ReconstructionUtil: cnt_processed_view = 0 remaining_views.remove(init_view) curr_rec_pts_num = combined_point_cloud.shape[0] + drop_output_ratio = 0.4 import time while remaining_views: @@ -84,6 +85,8 @@ class ReconstructionUtil: best_covered_num = 0 for view_index in remaining_views: + if np.random.rand() < drop_output_ratio: + continue if point_cloud_list[view_index].shape[0] == 0: continue if selected_views: