pyg-team / pytorch_geometric

Graph Neural Network Library for PyTorch
https://pyg.org
MIT License
20.98k stars 3.62k forks source link

How to debug transforms? #1204

Closed evakrowarska closed 1 year ago

evakrowarska commented 4 years ago

❓ Questions & Help

Is there an intended or best practice way of debugging transforms in PyTorch Geometric? For example, if I have a graph, representing a mesh: Is there a way to validate, if my transform is working as it is supposed to?

Debugging with huge tensors and keeping an eye on edge_indices and vertex positions, while not seeing the geometry visually at all, does not feel productive and sufficient to me.

Is there an external tool or library that I can "plug-in" into my debugging process? Maybe a way, where I do not have to copy the face list and vertex positions, for example, into another tool by hand. These may introduce their own internal indexing of the data, which may lead to confusion.

rusty1s commented 4 years ago

If you are working with meshes, you can convert to_trimesh and visualize from there, and if you are working on graphs, you can convert to_networkx and visualize from there, see here and here.

evakrowarska commented 4 years ago

Is there a way of using to_trimesh if I have only edge_index given inside data? Like some EdgeToFace transform?

rusty1s commented 4 years ago

No, that does not exist.

evakrowarska commented 4 years ago

okay. But is there any possibility of displaying meshes just by using edge_index? Everything I can find uses faces, like mayavi. Or is there a way to transform the edge indices back to face easily, even if there exists no ready-to-use transform yet?

rusty1s commented 4 years ago

Well, you can always visualize them with, e.g. matplotlib, where you connect points based on edge_index. We do not provide a wrapper for this though. Note that EdgeIndexToFace is tricky, but can be implemented by finding all triangles (might be quite slow).