hongsukchoi / Pose2Mesh_RELEASE

Official Pytorch implementation of "Pose2Mesh: Graph Convolutional Network for 3D Human Pose and Mesh Recovery from a 2D Human Pose", ECCV 2020
MIT License
677 stars 69 forks source link

Obtaining intermediate meshes #14

Closed Shubhendu-Jena closed 3 years ago

Shubhendu-Jena commented 3 years ago

Hi. Thanks for the great work! I had a rather elementary doubt. I wanted to obtain intermediate meshes obtained by mesh coarsening as you have visualized in your paper. The coarsen function takes just the input adjacency matrix as input and outputs the adjacency matrices corresponding to several coarsening levels. The input adjacency matrix is simply a matrix composed of 0s and 1s which indicate node connectivities. However, the other adjacency matrices look different i.e. are not composed of 0s and 1s, and hence I am having trouble understanding them. Could you please help me with how I should go about obtaining the intermediate meshes from the adjacency matrices corresponding to different coarsening levels?

Thanks in advance

hongsukchoi commented 3 years ago

Hi, @Shubhendu-Jena

To be clear, the figure 1 depicts the concept of Pose2Mesh. One of the figure's purposes is to visualize the coarse topologies of human mesh. Thus, Pose2Mesh does not estimate xyz coordinates of coarse meshes in inference, but utilize the coarse topologies for better learning. We tried to estimate xyz coordinates of coarse meshes and supervise them like Pixel2Mesh, but it had no positive effect.

Anyway, you can visualize the coarse topologies of human mesh like figure 1 with this code. Put xyz coordinates of original mesh into variable original_vertice.

    def test_coarsening(self, original_vertice):
        # Build graph
        output_vertice_list = []
        output_face_list = []

        # graph perm: permute order to make tree: 6890 -> 12288 -> 6144 -> ...
        graph_perm_reverse = perm_index_reverse(self.graph_perm[0])

        finest_vertice = np.zeros((self.graph_Adj[0].shape[0], 3))
        finest_vertice[graph_perm_reverse[:self.smpl.face.max()+1], :] = original_vertice[:, :]
        finest_face = perm_tri(self.smpl.face, self.graph_perm[0])

        save_obj(v=finest_vertice, f=finest_face, file_name=osp.join(cfg.output_dir, 'original.obj'))

        output_vertice_list.append(finest_vertice)
        output_face_list.append(finest_face)

        for i in range(1, len(self.graph_Adj)):
            coarse_vertice = coarsen_vertice_fast(self.graph_Adj[i].shape[0], output_vertice_list[-1])
            coarse_face = coarsening_face(output_face_list[-1])
            output_vertice_list.append(coarse_vertice)
            output_face_list.append(coarse_face)

            save_obj(v=coarse_vertice, f=coarse_face, file_name=osp.join(cfg.output_dir, f'coarse{i}.obj'))

        return output_vertice_list
Shubhendu-Jena commented 3 years ago

Hi, Thank you for the prompt response. The code as well as your comment about supervision like Pixel2Mesh would undoubtedly help me a lot with my further work. Closing the issue now :)