What kind of features does each node have as an input graph to a graph neural network? For example, we want to do image classification with GNN, what are the features of each pixel? Or if anyone could send me a link to implementing GNN on an example I would greatly appreciate it.
1 Answer
Applying GNNs to images can be realized in different ways. If you only substitute a visual ConvNet by a GNN, then the pixel values would be the same as what goes into a ConvNet. The only difference will be the input format. Whereas a ConvNet gets inputs of shape [batch, height, width, channels]
, a GNN would receive a list of pixels [batch, n_pixels, channels]
together with an adjacency list that contains the structural information (Each pixel may have 8 neighbors and a selfloop except for the pixels at the boarders).
So basically the features doesn't change, what changes is the format of the data. For a clean library of GNNs you can checkout DeepGraphLibrary, they have tutorials on how to use their library. If you want to see a simplified standalone implementation, you can checkout this code. His repository also contains more nice implementations.