Compare commits
8 Commits
e23697eb87
...
ab_local_o
Author | SHA1 | Date | |
---|---|---|---|
1862dce077 | |||
420e9c97bd | |||
b3a7650d3e | |||
8d7299b482 | |||
234c8bccc3 | |||
b30e9d535a | |||
d8c95b6f0c | |||
ab31ba46a9 |
@@ -3,11 +3,11 @@ runner:
|
|||||||
general:
|
general:
|
||||||
seed: 0
|
seed: 0
|
||||||
device: cuda
|
device: cuda
|
||||||
cuda_visible_devices: "0"
|
cuda_visible_devices: "1"
|
||||||
parallel: False
|
parallel: False
|
||||||
|
|
||||||
experiment:
|
experiment:
|
||||||
name: overfit_ab_global_only
|
name: overfit_ab_local_only
|
||||||
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
|
||||||
@@ -39,7 +39,7 @@ dataset:
|
|||||||
type: train
|
type: train
|
||||||
cache: True
|
cache: True
|
||||||
ratio: 1
|
ratio: 1
|
||||||
batch_size: 80
|
batch_size: 32
|
||||||
num_workers: 16
|
num_workers: 16
|
||||||
pts_num: 8192
|
pts_num: 8192
|
||||||
load_from_preprocess: True
|
load_from_preprocess: True
|
||||||
@@ -55,7 +55,7 @@ dataset:
|
|||||||
eval_list:
|
eval_list:
|
||||||
- pose_diff
|
- pose_diff
|
||||||
ratio: 1
|
ratio: 1
|
||||||
batch_size: 80
|
batch_size: 32
|
||||||
num_workers: 12
|
num_workers: 12
|
||||||
pts_num: 8192
|
pts_num: 8192
|
||||||
load_from_preprocess: True
|
load_from_preprocess: True
|
||||||
@@ -71,7 +71,7 @@ dataset:
|
|||||||
eval_list:
|
eval_list:
|
||||||
- pose_diff
|
- pose_diff
|
||||||
ratio: 1
|
ratio: 1
|
||||||
batch_size: 80
|
batch_size: 32
|
||||||
num_workers: 12
|
num_workers: 12
|
||||||
pts_num: 8192
|
pts_num: 8192
|
||||||
load_from_preprocess: True
|
load_from_preprocess: True
|
||||||
@@ -92,16 +92,16 @@ module:
|
|||||||
|
|
||||||
pointnet_encoder:
|
pointnet_encoder:
|
||||||
in_dim: 3
|
in_dim: 3
|
||||||
out_dim: 1024
|
out_dim: 512
|
||||||
global_feat: True
|
global_feat: True
|
||||||
feature_transform: False
|
feature_transform: False
|
||||||
|
|
||||||
transformer_seq_encoder:
|
transformer_seq_encoder:
|
||||||
embed_dim: 256
|
embed_dim: 768
|
||||||
num_heads: 4
|
num_heads: 4
|
||||||
ffn_dim: 256
|
ffn_dim: 256
|
||||||
num_layers: 3
|
num_layers: 3
|
||||||
output_dim: 1024
|
output_dim: 2048
|
||||||
|
|
||||||
gf_view_finder:
|
gf_view_finder:
|
||||||
t_feat_dim: 128
|
t_feat_dim: 128
|
||||||
|
@@ -165,13 +165,8 @@ class NBVReconstructionDataset(BaseDataset):
|
|||||||
[best_to_world_6d, best_to_world_trans], axis=0
|
[best_to_world_6d, best_to_world_trans], axis=0
|
||||||
)
|
)
|
||||||
|
|
||||||
combined_scanned_views_pts = np.concatenate(scanned_views_pts, axis=0)
|
|
||||||
voxel_downsampled_combined_scanned_pts_np = PtsUtil.voxel_downsample_point_cloud(combined_scanned_views_pts, 0.002)
|
|
||||||
random_downsampled_combined_scanned_pts_np = PtsUtil.random_downsample_point_cloud(voxel_downsampled_combined_scanned_pts_np, self.pts_num)
|
|
||||||
|
|
||||||
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)
|
||||||
"combined_scanned_pts": np.asarray(random_downsampled_combined_scanned_pts_np, dtype=np.float32), # Ndarray(N x 3)
|
|
||||||
"scanned_coverage_rate": scanned_coverages_rate, # List(S): Float, range(0, 1)
|
"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)
|
"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)
|
"best_coverage_rate": nbv_coverage_rate, # Float, range(0, 1)
|
||||||
@@ -203,15 +198,13 @@ class NBVReconstructionDataset(BaseDataset):
|
|||||||
collate_data["best_to_world_pose_9d"] = torch.stack(
|
collate_data["best_to_world_pose_9d"] = torch.stack(
|
||||||
[torch.tensor(item["best_to_world_pose_9d"]) for item in batch]
|
[torch.tensor(item["best_to_world_pose_9d"]) for item in batch]
|
||||||
)
|
)
|
||||||
collate_data["combined_scanned_pts"] = torch.stack(
|
|
||||||
[torch.tensor(item["combined_scanned_pts"]) for item in batch]
|
|
||||||
)
|
|
||||||
for key in batch[0].keys():
|
for key in batch[0].keys():
|
||||||
if key not in [
|
if key not in [
|
||||||
"scanned_pts",
|
"scanned_pts",
|
||||||
|
"scanned_pts_mask",
|
||||||
"scanned_n_to_world_pose_9d",
|
"scanned_n_to_world_pose_9d",
|
||||||
"best_to_world_pose_9d",
|
"best_to_world_pose_9d",
|
||||||
"combined_scanned_pts",
|
|
||||||
]:
|
]:
|
||||||
collate_data[key] = [item[key] for item in batch]
|
collate_data[key] = [item[key] for item in batch]
|
||||||
return collate_data
|
return collate_data
|
||||||
|
@@ -29,6 +29,7 @@ class NBVReconstructionPipeline(nn.Module):
|
|||||||
|
|
||||||
|
|
||||||
self.eps = float(self.config["eps"])
|
self.eps = float(self.config["eps"])
|
||||||
|
self.enable_global_scanned_feat = self.config["global_scanned_feat"]
|
||||||
|
|
||||||
def forward(self, data):
|
def forward(self, data):
|
||||||
mode = data["mode"]
|
mode = data["mode"]
|
||||||
@@ -91,24 +92,23 @@ class NBVReconstructionPipeline(nn.Module):
|
|||||||
scanned_n_to_world_pose_9d_batch = data[
|
scanned_n_to_world_pose_9d_batch = data[
|
||||||
"scanned_n_to_world_pose_9d"
|
"scanned_n_to_world_pose_9d"
|
||||||
] # List(B): Tensor(S x 9)
|
] # List(B): Tensor(S x 9)
|
||||||
|
scanned_pts_batch = data[
|
||||||
|
"scanned_pts"
|
||||||
|
]
|
||||||
device = next(self.parameters()).device
|
device = next(self.parameters()).device
|
||||||
|
|
||||||
embedding_list_batch = []
|
embedding_list_batch = []
|
||||||
|
|
||||||
combined_scanned_pts_batch = data["combined_scanned_pts"] # Tensor(B x N x 3)
|
for scanned_n_to_world_pose_9d, scanned_pts in zip(scanned_n_to_world_pose_9d_batch, scanned_pts_batch):
|
||||||
global_scanned_feat = self.pts_encoder.encode_points(
|
|
||||||
combined_scanned_pts_batch, require_per_point_feat=False
|
|
||||||
) # global_scanned_feat: Tensor(B x Dg)
|
|
||||||
|
|
||||||
for scanned_n_to_world_pose_9d in scanned_n_to_world_pose_9d_batch:
|
|
||||||
scanned_n_to_world_pose_9d = scanned_n_to_world_pose_9d.to(device) # Tensor(S x 9)
|
scanned_n_to_world_pose_9d = scanned_n_to_world_pose_9d.to(device) # Tensor(S x 9)
|
||||||
|
scanned_pts = scanned_pts.to(device) # Tensor(S x N x 3)
|
||||||
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)
|
||||||
seq_embedding = pose_feat_seq
|
pts_feat_seq = self.pts_encoder.encode_points(scanned_pts, require_per_point_feat=False) # Tensor(S x Dl)
|
||||||
embedding_list_batch.append(seq_embedding) # List(B): Tensor(S x (Dp))
|
seq_embedding = torch.cat([pose_feat_seq, pts_feat_seq], dim=-1) # Tensor(S x (Dp+Dl))
|
||||||
|
embedding_list_batch.append(seq_embedding) # List(B): Tensor(S x (Dp+Dl))
|
||||||
|
|
||||||
seq_feat = self.seq_encoder.encode_sequence(embedding_list_batch) # Tensor(B x Ds)
|
seq_feat = self.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 = seq_feat # Tensor(B x Ds)
|
||||||
|
|
||||||
if torch.isnan(main_feat).any():
|
if torch.isnan(main_feat).any():
|
||||||
Log.error("nan in main_feat", True)
|
Log.error("nan in main_feat", True)
|
||||||
|
Reference in New Issue
Block a user