enriccorona / SMPLicit

Implementation for the paper SMPLicit: Topology-aware Generative Model for Clothed People (CVPR 2021)
http://www.iri.upc.edu/people/ecorona/smplicit/
Other
282 stars 29 forks source link

kaolin error #12

Open vvcatstar opened 3 years ago

vvcatstar commented 3 years ago
csvt32745 commented 3 years ago

You can use kaolin.ops.mesh.index_vertices_by_faces, but it returns a tensor of size (batch, faces, vertices=3, features) instead of a class in old kaolin(v0.1). Thus you need to modify other relative codes.

Also, note that in fit_SMPLicit/fit_SMPLicit.py, you may modify the part of computing unsigned distance (at line ~150), by kaolin.metrics.trianglemesh.point_to_mesh_distance.

JeremyTF commented 1 year ago
  • When I install the kaolin(v 0.9.1), then error is :

    File "/home/zhangyaowei/data/repo/SMPLicit/SMPLicit/SMPLicit.py", line 83, in reconstruct
      inference_mesh = kaolin.rep.TriangleMesh.from_tensors(unposed_smpl[0], 
    AttributeError: module 'kaolin.rep' has no attribute 'TriangleMesh'

    How to replace the TriangleMesh from tensors?

  • When I install the kaolin(v 0.1.0), the error is:
    Traceback (most recent call last):
    File "example.py", line 2, in <module>
      import SMPLicit
    File "/home/zhangyaowei/anaconda3/envs/test/lib/python3.6/site-packages/SMPLicit-0.0.1-py3.6.egg/SMPLicit/__init__.py", line 2, in <module>
      from .SMPLicit import SMPLicit
    File "/home/zhangyaowei/anaconda3/envs/test/lib/python3.6/site-packages/SMPLicit-0.0.1-py3.6.egg/SMPLicit/SMPLicit.py", line 7, in <module>
      import kaolin
    File "/home/zhangyaowei/data/repo/kaolin/kaolin/__init__.py", line 18, in <module>
      from kaolin import datasets
    File "/home/zhangyaowei/data/repo/kaolin/kaolin/datasets/__init__.py", line 1, in <module>
      from .shapenet import *
    File "/home/zhangyaowei/data/repo/kaolin/kaolin/datasets/shapenet.py", line 46, in <module>
      from .base import KaolinDataset
    File "/home/zhangyaowei/data/repo/kaolin/kaolin/datasets/base.py", line 56, in <module>
      class KaolinDataset(Dataset, metaclass=KaolinDatasetMeta):
    TypeError: metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases

Hi, I have exactly the same problem as you. Did you fix it? Can you give me a hand? Thanks so much!

NguyenTriTrinh commented 1 year ago

Since there is little difference between the kaolin v0.1 and upper versions, i solved it by comment `

inference_mesh = kaolin.rep.TriangleMesh.from_tensors(unposed_smpl[0],

                               torch.LongTensor(self.smpl_faces).cuda()) `
 ` # inference_lowerbody = kaolin.ops.mesh.index_vertices_by_faces(Astar_smpl,
                                  torch.LongTensor(self.smpl_faces).cuda())`

and replace it with inference_mesh = unposed_smpl[0] inference_lowerbody = Astar_smpl And in smplicit_core_test.py ,dont forget to replace the smpl_points = smpl_trianglemesh.vertices with smpl_points = smpl_trianglemesh

Lai-dongdong commented 1 year ago

Since there is little difference between the kaolin v0.1 and upper versions, i solved it by comment # inference_mesh = kaolin.rep.TriangleMesh.from_tensors(unposed_smpl[0], torch.LongTensor(self.smpl_faces).cuda()) # inference_lowerbody = kaolin.ops.mesh.index_vertices_by_faces(Astar_smpl, torch.LongTensor(self.smpl_faces).cuda()) and replace it with inference_mesh = unposed_smpl[0] inference_lowerbody = Astar_smpl And in smplicit_core_test.py ,dont forget to replace the smpl_points = smpl_trianglemesh.vertices with smpl_points = smpl_trianglemesh

Thanks so much!

WHU-Wangxh commented 1 year ago

You can use kaolin.ops.mesh.index_vertices_by_faces, but it returns a tensor of size (batch, faces, vertices=3, features) instead of a class in old kaolin(v0.1). Thus you need to modify other relative codes.

Also, note that in fit_SMPLicit/fit_SMPLicit.py, you may modify the part of computing unsigned distance (at line ~150), by kaolin.metrics.trianglemesh.point_to_mesh_distance.

How to use the kaolin.metrics.trianglemesh.point_to_mesh_distance in fit_SMPLicit.py? thanks

SMY19999 commented 9 months ago

You can use kaolin.ops.mesh.index_vertices_by_faces, but it returns a tensor of size (batch, faces, vertices=3, features) instead of a class in old kaolin(v0.1). Thus you need to modify other relative codes. Also, note that in fit_SMPLicit/fit_SMPLicit.py, you may modify the part of computing unsigned distance (at line ~150), by kaolin.metrics.trianglemesh.point_to_mesh_distance.

How to use the kaolin.metrics.trianglemesh.point_to_mesh_distance in fit_SMPLicit.py? thanks

For kaolin 0.15.0, you can read the code in detail, it gives the examples in kaolin.metrics.trianglemesh.point_to_mesh_distance. at around 144 smpl_mesh = kaolin.rep.SurfaceMesh(vertices = [v_inference[0].cuda()],faces=[smpl_faces.cuda()]) at around 151 ` coords_tensor = torch.FloatTensor(coords)

coords_tensor = coords_tensor.unsqueeze(0)

coords_tensor = coords_tensor.contiguous()

from kaolin.ops.mesh import index_vertices_by_faces

face_vertices = index_vertices_by_faces(v_inference.cuda(), smpl_faces.cuda())

unsigneddistance,,_ = kaolin.metrics.trianglemesh.point_to_mesh_distance(pointclouds=coords_tensor.cuda(),

face_vertices=face_vertices)

unsigned_distance = torch.abs(unsigned_distance) ` later, you may meet some data shape error, just correct the code. It is easy.