ranahanocka / MeshCNN

Convolutional Neural Network for 3D meshes in PyTorch
MIT License
1.57k stars 315 forks source link

Verification on other Data Sets #3

Open h00shi opened 5 years ago

h00shi commented 5 years ago

This is more a question rather than an issue, so apologies if it is not the right place to ask it.

Have you also tried the network on the de facto ModelNet50 (classification) and ShapeNet Core (segmentation) datasets?

ranahanocka commented 5 years ago

Hi, great question - thanks :)

So ModelNet40 / ShapeNet is not manifold. Meshes that are not manifold do not have at most 2 incident faces - which breaks our fixed-size convolution neighborhood assumption (illustration)

I did start playing with this code which makes meshes manifold, and noticed it works pretty well. I will try to find some time soon to write some scripts to clean it up and add it to the repo. Will update this issue accordingly

mrmoss commented 4 years ago

It might be worth using something like pymesh or trimesh to load and save meshes (nice built-in functionality to detect/fix non-manifold meshes).

This would also make importing datasets of different formats easier as well, as loading a mesh would be something like mesh=module.load('file.ext') and accessing edges, faces, and vertices is simply mesh.edges, mesh.faces, and mesh.vertices.

The function fill_from_file() in mesh_prepare.py could be something really simple like:

import trimesh #pip3 install trimesh
mesh=trimesh.load(fpath) #loads ascii and binary stls, objs, etc...
mesh.rezero() #move to [0,0,0]
if not mesh.is_watertight or not mesh.is_volume:
    raise Exception('"%s" is not manifold'%fpath)
return mesh.vertices,mesh.faces

The above code is completely untested...

h00shi commented 4 years ago

@mrmoss I think the neural network would need a mesh with a single (or only a few) components. What pymesh and trimesh do for making the mesh manifold is breaking it into multiple components. So, they might not work that easily (I am not sure).

mrmoss commented 4 years ago

I was thinking more detection and warning/erroring rather than repairing.

As far as I can gather from both mentioned modules, other than face normals, files are parsed without any attempt to repair or fix them.

For repairing, trimesh's fill_holes() might be worth a try?

Edit: Edited for overall clarity and length.

ranahanocka commented 4 years ago

It might be worth using something like pymesh or trimesh to load and save meshes (nice built-in functionality to detect/fix non-manifold meshes).

I tried these non-manifold fixes, and they do not work for shapenet.

This would also make importing datasets of different formats easier as well, as loading a mesh would be something like mesh=module.load('file.ext') and accessing edges, faces, and vertices is simply mesh.edges, mesh.faces, and mesh.vertices. The function fill_from_file() in mesh_prepare.py could be something really simple like:

I do hear what you are saying, but I prefer to keep the code independent of external packages, and just have people convert to .obj format. This can be done pretty easily with Meshlab scripts. And maybe it's just me, but I think when things are written explicitly, it helps make it really clear how simple meshes really are :)

h00shi commented 4 years ago

These guys seem to have processed all the ShapeNet. Github page repaired shapenet

KS-MA commented 4 years ago

Has anyone by now tried the network on the ModelNet50/ModelNet10 (classification) dataset?

Licolas commented 1 month ago

There is a dataset Manifold40, all shapes are manifold.