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

kaolin error #12

Open
vvcatstar opened this issue Oct 20, 2021 · 6 comments
Open

kaolin error #12

vvcatstar opened this issue Oct 20, 2021 · 6 comments

Comments

@vvcatstar
Copy link

  • 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
    
@csvt32745
Copy link

csvt32745 commented Nov 8, 2021

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
Copy link

JeremyTF commented Dec 7, 2022

  • 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
Copy link

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
Copy link

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
Copy link

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
Copy link

SMY19999 commented Feb 20, 2024

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())

unsigned_distance,, = 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.

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

7 participants