solve merge

This commit is contained in:
hofee 2024-10-29 08:14:43 +00:00
commit b13e45bafc
5 changed files with 33 additions and 37 deletions

View File

@ -84,7 +84,7 @@ module:
gf_view_finder: gf_view_finder:
t_feat_dim: 128 t_feat_dim: 128
pose_feat_dim: 256 pose_feat_dim: 256
main_feat_dim: 2048 main_feat_dim: 3072
regression_head: Rx_Ry_and_T regression_head: Rx_Ry_and_T
pose_mode: rot_matrix pose_mode: rot_matrix
per_point_feature: False per_point_feature: False

View File

@ -7,7 +7,11 @@ runner:
parallel: False parallel: False
experiment: experiment:
<<<<<<< HEAD
name: test_new_pipeline_train_overfit name: test_new_pipeline_train_overfit
=======
name: debug
>>>>>>> 63a246c0c87d42f04076a459adcfdc88c954b09c
root_dir: "experiments" root_dir: "experiments"
use_checkpoint: False use_checkpoint: False
epoch: -1 # -1 stands for last epoch epoch: -1 # -1 stands for last epoch
@ -32,10 +36,10 @@ runner:
dataset: dataset:
OmniObject3d_train: OmniObject3d_train:
root_dir: "/data/hofee/data/packed_preprocessed_data" root_dir: "/home/data/hofee/project/nbv_rec/data/sample_for_training_new"
model_dir: "../data/scaled_object_meshes" model_dir: "../data/scaled_object_meshes"
source: nbv_reconstruction_dataset source: nbv_reconstruction_dataset
split_file: "/data/hofee/data/OmniObject3d_train_overfit.txt" split_file: "/home/data/hofee/project/nbv_rec/data/sample.txt"
type: train type: train
cache: True cache: True
ratio: 1 ratio: 1
@ -44,27 +48,27 @@ dataset:
pts_num: 4096 pts_num: 4096
load_from_preprocess: True load_from_preprocess: True
# OmniObject3d_test: OmniObject3d_test:
# root_dir: "/data/hofee/data/packed_preprocessed_data" root_dir: "/home/data/hofee/project/nbv_rec/data/sample_for_training_new"
# model_dir: "../data/scaled_object_meshes"
# source: nbv_reconstruction_dataset
# split_file: "/data/hofee/data/OmniObject3d_test.txt"
# type: test
# cache: True
# filter_degree: 75
# eval_list:
# - pose_diff
# ratio: 0.05
# batch_size: 160
# num_workers: 12
# pts_num: 4096
# load_from_preprocess: True
OmniObject3d_val:
root_dir: "/data/hofee/data/packed_preprocessed_data"
model_dir: "../data/scaled_object_meshes" model_dir: "../data/scaled_object_meshes"
source: nbv_reconstruction_dataset source: nbv_reconstruction_dataset
split_file: "/data/hofee/data/OmniObject3d_train_overfit.txt" split_file: "/home/data/hofee/project/nbv_rec/data/sample.txt"
type: test
cache: True
filter_degree: 75
eval_list:
- pose_diff
ratio: 0.05
batch_size: 160
num_workers: 12
pts_num: 4096
load_from_preprocess: True
OmniObject3d_val:
root_dir: "/home/data/hofee/project/nbv_rec/data/sample_for_training_new"
model_dir: "../data/scaled_object_meshes"
source: nbv_reconstruction_dataset
split_file: "/home/data/hofee/project/nbv_rec/data/sample.txt"
type: test type: test
cache: True cache: True
filter_degree: 75 filter_degree: 75

View File

@ -121,19 +121,20 @@ class NBVReconstructionGlobalPointsPipeline(nn.Module):
for seq_idx in range(seq_len): for seq_idx in range(seq_len):
partial_idx_in_combined_pts = scanned_mask == seq_idx # Ndarray(V), N->V idx mask 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_perpoint_feat = perpoint_scanned_feat[partial_idx_in_combined_pts] # Ndarray(V x Dl)
partial_feat = torch.max(partial_perpoint_feat, dim=0) # Tensor(Dl) partial_feat = torch.mean(partial_perpoint_feat, dim=0) # Tensor(Dl)
partial_feat_seq.append(partial_feat) partial_feat_seq.append(partial_feat)
scanned_target_pts_num.append(partial_perpoint_feat.shape[0]) scanned_target_pts_num.append(partial_perpoint_feat.shape[0])
scanned_target_pts_num = torch.tensor(scanned_target_pts_num, dtype=torch.float32).to(device).unsqueeze(-1) # Tensor(S)
scanned_n_to_world_pose_9d = scanned_n_to_world_pose_9d.to(device) # Tensor(S x 9)
scanned_target_pts_num = torch.tensor(scanned_target_pts_num, dtype=torch.float32).unsqueeze(-1).to(device) # Tensor(S x 1)
scanned_n_to_world_pose_9d = scanned_n_to_world_pose_9d.to(device) # Tensor(S x 9)
pose_feat_seq = self.pose_encoder.encode_pose(scanned_n_to_world_pose_9d) # Tensor(S x Dp) pose_feat_seq = self.pose_encoder.encode_pose(scanned_n_to_world_pose_9d) # Tensor(S x Dp)
pts_num_feat_seq = self.pts_num_encoder.encode_pts_num(scanned_target_pts_num) # Tensor(S x Dn) pts_num_feat_seq = self.pts_num_encoder.encode_pts_num(scanned_target_pts_num) # Tensor(S x Dn)
partial_feat_seq = torch.stack(partial_feat_seq) # Tensor(S x Dl) partial_feat_seq = torch.stack(partial_feat_seq) # Tensor(S x Dl)
seq_embedding = torch.cat([pose_feat_seq, pts_num_feat_seq, partial_feat_seq], dim=-1) # Tensor(S x (Dp+Dn+Dl)) seq_embedding = torch.cat([pose_feat_seq, pts_num_feat_seq, partial_feat_seq], dim=-1) # Tensor(S x (Dp+Dn+Dl))
embedding_list_batch.append(seq_embedding) # List(B): Tensor(S x (Dp+Dn+Dl)) embedding_list_batch.append(seq_embedding) # List(B): Tensor(S x (Dp+Dn+Dl))
seq_feat = self.transformer_seq_encoder.encode_sequence(embedding_list_batch) # Tensor(B x Ds) seq_feat = self.transformer_seq_encoder.encode_sequence(embedding_list_batch) # Tensor(B x Ds)
main_feat = torch.cat([seq_feat, global_scanned_feat], dim=-1) # Tensor(B x (Ds+Dg)) main_feat = torch.cat([seq_feat, global_scanned_feat], dim=-1) # Tensor(B x (Ds+Dg))

View File

@ -34,7 +34,7 @@ class NBVReconstructionDataset(BaseDataset):
#self.model_dir = config["model_dir"] #self.model_dir = config["model_dir"]
self.filter_degree = config["filter_degree"] self.filter_degree = config["filter_degree"]
if self.type == namespace.Mode.TRAIN: if self.type == namespace.Mode.TRAIN:
scale_ratio = 1 scale_ratio = 100
self.datalist = self.datalist*scale_ratio self.datalist = self.datalist*scale_ratio
if self.cache: if self.cache:
expr_root = ConfigManager.get("runner", "experiment", "root_dir") expr_root = ConfigManager.get("runner", "experiment", "root_dir")
@ -174,6 +174,7 @@ class NBVReconstructionDataset(BaseDataset):
combined_scanned_views_pts_mask[start_idx:end_idx] = i combined_scanned_views_pts_mask[start_idx:end_idx] = i
start_idx = end_idx start_idx = end_idx
fps_downsampled_combined_scanned_pts_mask = combined_scanned_views_pts_mask[fps_idx] fps_downsampled_combined_scanned_pts_mask = combined_scanned_views_pts_mask[fps_idx]
data_item = { data_item = {
"scanned_pts": np.asarray(scanned_views_pts, dtype=np.float32), # Ndarray(S x Nv x 3) "scanned_pts": np.asarray(scanned_views_pts, dtype=np.float32), # Ndarray(S x Nv x 3)
"scanned_pts_mask": np.asarray(fps_downsampled_combined_scanned_pts_mask,dtype=np.uint8), # Ndarray(N), range(0, S) "scanned_pts_mask": np.asarray(fps_downsampled_combined_scanned_pts_mask,dtype=np.uint8), # Ndarray(N), range(0, S)

View File

@ -93,18 +93,8 @@ class StrategyGenerator(Runner):
else: else:
nrm = np.load(nrm_path) nrm = np.load(nrm_path)
nrm_list.append(nrm) nrm_list.append(nrm)
<<<<<<< HEAD
pts_list.append(pts) pts_list.append(pts)
indices = np.load(idx_path) indices = np.load(idx_path)
=======
indices = np.load(idx_path)
pts_list.append(pts)
>>>>>>> a883a31968b668a26545f2e8766179365308b0e2
scan_points_indices_list.append(indices) scan_points_indices_list.append(indices)
if pts.shape[0] > 0: if pts.shape[0] > 0:
non_zero_cnt += 1 non_zero_cnt += 1