lzhengning / SubdivNet

Subdivision-based Mesh Convolutional Networks.
MIT License
251 stars 34 forks source link

question about visualization #21

Closed flyKite1998 closed 2 years ago

flyKite1998 commented 3 years ago

hi, thanks for your work. Can MeshTensor be visualized ? How can i get the model after pooling or convolution like Fig.1 in your paper?

lzhengning commented 3 years ago

Sure. MeshTensor has an attribute faces that stores the index of vertices in M0 (the mesh that is not pooled). So you can use the vertices of M0 and some_mesh_tensor.faces to visualize a mesh.

The python code may be like

batch_vertices, batch_faces = load_mesh_func(...)
... # calculate features and pack them to MeshTensor
pooled_mesh = net(mesh)
pooled_faces = pooled_mesh.faces[0, :pooled_mesh.Fs[0]]
pooled_faces = pooled_faces.data # Jittor Var to Numpy array
vertices = batch_vertices[0]
trimesh.Trimesh(vertices, faces).export('my_mesh.obj')
flyKite1998 commented 2 years ago

I understand,thanks a lot.