pyg-team / pytorch_geometric

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

A small problem about visualizing graphs #659

Closed WMF1997 closed 2 years ago

WMF1997 commented 5 years ago

❓ Questions & Help

A small problem about visualizing graphs

hello @rusty1s

I want to ask about PyG data's visualization. (especially visualization about point clouds)

visualizing 2d graph is okay to me

First, I have known how to use networkx and pygsp to visualize a 2D graph. (in fact, I wrote a simple example of pygsp <--> networkx, but the code is too simple and too ugly... (however, it shows that to_pygsp and from_pygsp (mentioned in issue #466) works.)

i wonder how to visualize a 3D graph (especially point clouds)

visualizing 3D graph in Microsoft Windows.

image this is a .ply file, opened in Microsoft Windows 10's 3D Viewer. (Sorry, I use Windows at most of time)

my thought of visualizing 3D graphs

First, I loaded ModelNet10, and then I picked up one point cloud. After Face2Edge, I get the edge_index representation of a point cloud. Then, to_networkx is used to convert. However, pos is lost during the conversion. (It should be like that, since nx.Graph has no bindings of the pos, i.e. you have to assign that). and use .numpy in PyTorch is really easy. then all the requirements of 3D plotting in networkx + mayavi is fine.

sorry... the graph given next is not using networkx and mayavi, I use matplotlib to show it. .(I use fps(Farthest Point Sampling) method to get a point cloud, (modelnet10[0])) and it works.

image

how to plot the 3D graph in your paper?

and, in your spline conv paper's figure 1 (b) (the mesh of a man's face) and figure 7 (c) (the FAUST dataset, the body of a man), visualizing of 3D Point Clouds is really cool~ I wonder how you generate figures like that? (i.e. how can I plot a 3D mesh? My thoughts of visualizing 3D point clouds (with or without other properties) is using python's matplotlib or mayavi)

if you use some other software, (for example, AutoCAD or SolidWorks, ...), is it convinent for you to tell me?

a small thought about torch_geometric.io

Finally, I have a small thought that, in PyG 1.3.1, torch_geometric.read is in support, with reading nearly all kinds of files (for example, .off, .ply, .npz) we may meet in geometric learning. "In symmertric", writing them may be an idea. Then, torch_geometric.io can be established, just like that in torchvision, although torchvision's io only has the io of video...

yours sincerely @wmf1997

rusty1s commented 5 years ago

I heard only good about Open3d for point cloud visualisation. For visualisation of meshes in the SplineCNN paper, we used Blender and manually rendered the 3D models. I do not have much experience with anything else, sorry!

torch_geometric.io sounds like a great idea!

WMF1997 commented 5 years ago

thank you very much~!

rcox771 commented 5 years ago

@WMF1997 You might like https://github.com/K3D-tools/K3D-jupyter for visualizing point clouds if your workflow is notebook-based.

WMF1997 commented 5 years ago

@rcox771 thank you very much~!