Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to obtain aligned 3D object mesh #17

Closed
dqj5182 opened this issue May 22, 2024 · 1 comment
Closed

How to obtain aligned 3D object mesh #17

dqj5182 opened this issue May 22, 2024 · 1 comment

Comments

@dqj5182
Copy link

dqj5182 commented May 22, 2024

I am trying to re-implement the calculation of Object Chamfer Distance (CDo).

However, I am having a hard time finding the exact part of the code that aligns 3D object mesh with optimized hand mesh scale and translation. More specifically, I am referring to the writings in the paper "Following [11, 26], we first use the optimized hand scale and translation to transform the reconstructed object mesh".

In the code, it seems that only 3D hand is aligned to 3D GT hand with icp.

# Alignment on predictions
    trans = np.array([0, 0, 0])
    scale = np.array([1])
    if not is_hand:
        return verts, faces, trans, scale, pred_mesh
    else:
        if cfg.TEST.chamfer_optim:
            # Load GT mesh
            if cfg.DATASET.testset == 'ObMan':
                gt_mesh = trimesh.load(os.path.join(cfg.data_dir, cfg.DATASET.testset_hand_source, ply_filename_out.split('_')[0] + '.obj'), process=False)
            elif cfg.DATASET.testset == 'DexYCB':
                gt_mesh = trimesh.load(os.path.join(cfg.data_dir, cfg.DATASET.testset_hand_source, '_'.join(ply_filename_out.split('_')[:-1]) + '.obj'), process=False)

            # ICP algorithm for pred_mesh to gt_mesh
            icp_solver = icp_ts(pred_mesh, gt_mesh)
            icp_solver.sample_mesh(30000, 'both')
            icp_solver.run_icp_f(max_iter = 100)
            pred_mesh = icp_solver.get_source_mesh()
            trans, scale = icp_solver.get_trans_scale()
            return verts, faces, trans, scale, pred_mesh
        else:
            return verts, faces, trans, scale, pred_mesh

Where in the code aligns 3D object with the trans and scale obtained from the icp of hand?

@zerchen
Copy link
Owner

zerchen commented Jun 20, 2024

Hi,

Sorry for a late reply. Indeed, I only align the predicted 3D hand with the ground-truth 3D hand and apply the transformation (trans, scale obtained during optimization on the hand) on the object. The logic is that in the quality of the object mesh and the translation between the object and the hand are both important in the 3D hand and object reconstruction, which is also used in [11, 26]. Optionally, you can also apply ICP solely on the object to evaluate the quality of the object mesh.

Best,
Zerui

@dqj5182 dqj5182 closed this as completed Sep 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants