deepmind-research icon indicating copy to clipboard operation
deepmind-research copied to clipboard

Questions about the collision detection of meshgraphnets

Open yangyangliu1 opened this issue 2 years ago • 3 comments

To somebody who may care about this: I would like to re-implement the code with the dataset of sphere_simple, shall I add any collision detection code or just add world edges E^w as the author said in their paper based on the code they provided here? Thanks in advance!

yangyangliu1 avatar Jul 18 '22 03:07 yangyangliu1

I have added the world edge E^w as the authors said in the paper, but in the graph building step, I got the error which reminded me the sizes of tensors must match except in dimension 0. I want to know when the authors said "that is, given a fixed-radius rW on the order of the smallest mesh edge lengths, we add a world edge between nodes i and j if |xi − xj | < rW , excluding node pairs already connected in the mesh." is the "world edge" mentioned here all ready smaller than rW before we build the graph? If not, how can I avoid the error: "Sizes of tensors must match except in dimension 0. Got 9924 and 10112" when I build the graph?

yangyangliu1 avatar Jul 24 '22 03:07 yangyangliu1

@tobiaspfaff

alvarosg avatar Aug 04 '22 17:08 alvarosg

Adding world edges is in a sense a simple form of (learned) collision detection, which just takes into account distance between nodes. One way to implement this is running a NN query (e.g. scipy.spatial.KDTree.query_ball_point with r=r_W in a numpy_function) during data loading and rollout, and creating an edge between add found node pairs (and from those pairs, remove those which are already mesh edges). See e.g. this code which does something similar https://github.com/deepmind/deepmind-research/blob/master/learning_to_simulate/connectivity_utils.py

The size mismatch could be a number of issues, likely around how you compute your world edges; it's a bit hard to answer this without context, and unfortunately I won't have the capacity to help debugging this kind of issues.

Of course you can think about incorporating other types of collision detection-- but it will need some research on how to featurize & include this information into the input graph.

tobiaspfaff avatar Aug 05 '22 10:08 tobiaspfaff