PeizhuoLi / neural-blend-shapes

An end-to-end library for automatic character rigging, skinning, and blend shapes generation, as well as a visualization tool [SIGGRAPH 2021]
Other
637 stars 92 forks source link

Error: ZeroDivisionError: division by zero when importing custom mesh #11

Closed codesavory closed 3 years ago

codesavory commented 3 years ago
(neural-blend-shapes) D:\CG_Source\NeRFs\3D_Avatar_Pipeline\neural-blend-shapes>python demo.py --pose_file=.\eval_constant\sequences\greeting.npy --obj_path=.\eval_constant\meshes\test_remesh.obj --animated_bvh=1 --obj_output=0 --normalize=1
Traceback (most recent call last):
  File "demo.py", line 150, in <module>
    main()
  File "demo.py", line 132, in main
    env_model, res_model = load_model(device, model_args, topo_loader, args.model_path)
  File "demo.py", line 59, in load_model
    geo, att, gen = create_envelope_model(device, model_args, topo_loader, is_train=False, parents=parent_smpl)
  File "D:\CG_Source\NeRFs\3D_Avatar_Pipeline\neural-blend-shapes\architecture\__init__.py", line 34, in create_envelope_model
    save_freq=args.save_freq)
  File "D:\CG_Source\NeRFs\3D_Avatar_Pipeline\neural-blend-shapes\models\networks.py", line 54, in __init__
    topo_loader, requires_recorder, is_cont, save_freq)
  File "D:\CG_Source\NeRFs\3D_Avatar_Pipeline\neural-blend-shapes\models\meshcnn_base.py", line 56, in __init__
    val.extend([1 / len(neighbors)] * len(neighbors))
ZeroDivisionError: division by zero

I get this error, everytime I try your model with custom meshes. I checked to make sure they are triangulated and called with normalize=1 but this happens for all the meshes I have. Is there some MeshLab filter that I can apply/script which could parse my custom mesh before sending it to your model or a simple fix for this issue. Thank you for your amazing work!

PeizhuoLi commented 3 years ago

Hi, it seems that there are isolated vertices in your mesh (i.e., vertex with no neighbors). I'm not very familiar with MeshLab filter, but I guess it won't be difficult to find a solution online.

codesavory commented 3 years ago

Thank you for the response and it currently runs for custom meshes. I used the filter from trimesh and it works well.