rusty1s / deep-graph-matching-consensus

Implementation of "Deep Graph Matching Consensus" in PyTorch
https://openreview.net/forum?id=HyeJf1HKvS
MIT License
256 stars 47 forks source link

FaceToEdge Transform for 3D data #18

Closed lmanan closed 2 years ago

lmanan commented 2 years ago

Hello Matthias @rusty1s,

Thanks for a very nice code base. I wanted to use the Delaunay and FaceToEdge Transform for building a graph with edges out of my 3D point cloud data data (size N x 3, each row is the x y z coordinates).

While composing a transform like the following:

transform = T.Compose([
    T.Delaunay(),
    T.FaceToEdge(),
    T.Cartesian(),
])

I see an output message like below:

File "/mnt/Softwares/miniconda3/envs/dgmcEnv/lib/python3.7/site-packages/torch_geometric/transforms/face_to_edge.py", line 21, in __call__
    edge_index = torch.cat([face[:2], face[1:], face[::2]], dim=1)
RuntimeError: Sizes of tensors must match except in dimension 1. Expected size 2 but got size 3 for tensor number 1 in the list.

This error message goes away if I were to use a point cloud arising from just the x y coordinates. Would you have an intuition on why this message appears and how I can make my 3D point cloud data work with the Delaunay and FaceToEdge transforms?

Thank you very much!

rusty1s commented 2 years ago

Thanks for reporting. Do you have the shape of edge_index for the example that's failing? This would be very helpful!

lmanan commented 2 years ago

Thanks for reporting. Do you have the shape of edge_index for the example that's failing? This would be very helpful!

So I saw that after applying the delaunay transform, data_s looks like this:

Data(x=[61, 1], y=[61], pos=[61, 3], face=[4, 177])

I am guessing that when it goes next through FaceToEdge, then face[:2] has shape 2 x 177, while face[1:] has shape 3 x 177, which makes concatenating not possible (?), this is probably why edge_index is not created. Let me know in case I misunderstood your question. Thanks!

rusty1s commented 2 years ago

I'm afraid FaceToEdge only works for triangular faces :(

lmanan commented 2 years ago

Okay, I will close this issue for now. Thank you!

rusty1s commented 2 years ago

Sure, we can also try fixing this if you have any interest in contributing. Just let me know :)