This commit is contained in:
2024-12-31 02:51:42 +08:00
parent 47624f12cf
commit 2dfb6c57ce
9 changed files with 58 additions and 22 deletions

View File

@@ -146,7 +146,21 @@ class Inferencer(Runner):
pred_pose[:3,:3] = PoseUtil.rotation_6d_to_matrix_tensor_batch(pred_pose_9d[:,:6])[0]
pred_pose[:3,3] = pred_pose_9d[0,6:]
# ----- Debug -----
from utils.vis import visualizeUtil
import ipdb; ipdb.set_trace()
all_directions = []
np.savetxt("input_pts.txt", input_data["combined_scanned_pts"].cpu().numpy()[0])
for i in range(50):
output = self.pipeline(input_data)
pred_pose_9d = output["pred_pose_9d"]
cam_pos, sample_points = visualizeUtil.get_cam_pose_and_cam_axis(pred_pose_9d.cpu().numpy()[0], is_6d_pose=True)
all_directions.append(sample_points)
all_directions = np.array(all_directions)
reshape_all_directions = all_directions.reshape(-1, 3)
np.savetxt("all_directions.txt", reshape_all_directions)
# ----- ----- -----
try:
new_target_pts, new_target_normals, new_scan_points_indices = RenderUtil.render_pts(pred_pose, scene_path, self.script_path, scan_points, voxel_threshold=voxel_threshold, filter_degree=filter_degree, nO_to_nL_pose=O_to_L_pose)
#import ipdb; ipdb.set_trace()
@@ -157,11 +171,11 @@ class Inferencer(Runner):
downsampled_new_target_pts = PtsUtil.voxel_downsample_point_cloud(new_target_pts, voxel_threshold)
overlap, _ = ReconstructionUtil.check_overlap(downsampled_new_target_pts, voxel_downsampled_combined_scanned_pts_np, overlap_area_threshold = curr_overlap_area_threshold, voxel_size=voxel_threshold, require_new_added_pts_num = True)
if not overlap:
Log.yellow("no overlap!")
retry += 1
retry_overlap_pose.append(pred_pose.cpu().numpy().tolist())
continue
# if not overlap:
# Log.yellow("no overlap!")
# retry += 1
# retry_overlap_pose.append(pred_pose.cpu().numpy().tolist())
# continue
history_indices.append(new_scan_points_indices)
except Exception as e: