Original Paper
SplineCNN: Fast Geometric Deep Learning with Continuous B-Spline Kernels
Fey et al. (2017). CVPR 2018
Read paper →What SplineConv does
SplineConv generalizes standard image convolution to irregular graph structures:
- Interpret edge attributes as pseudo-coordinates in a continuous d-dimensional space
- Evaluate B-spline basis functions at these coordinates to get smooth filter weights
- Apply the position-dependent filter to neighbor features and aggregate
On a regular grid (image), SplineConv recovers standard 2D convolution. On irregular meshes, it adapts to the local geometry.
PyG implementation
import torch
import torch.nn.functional as F
from torch_geometric.nn import SplineConv
class SplineNet(torch.nn.Module):
def __init__(self, in_channels, hidden_channels, out_channels):
super().__init__()
self.conv1 = SplineConv(in_channels, hidden_channels,
dim=2, kernel_size=5, degree=1)
self.conv2 = SplineConv(hidden_channels, out_channels,
dim=2, kernel_size=5, degree=1)
def forward(self, x, edge_index, edge_attr):
# edge_attr: pseudo-coordinates in [0, 1]^dim
x = F.relu(self.conv1(x, edge_index, edge_attr))
x = self.conv2(x, edge_index, edge_attr)
return x
# For mesh data: edge_attr encodes relative positions
# For images: edge_attr encodes pixel offsets (normalized to [0,1])
model = SplineNet(in_channels=3, hidden_channels=64, out_channels=10)edge_attr must be in [0, 1]^dim. For mesh data, normalize relative positions. dim=2 for surfaces, dim=3 for volumetric data.
When to use SplineConv
- Mesh processing. 3D mesh classification and segmentation where edge attributes encode geometric relationships (relative positions, normals, angles).
- Manifold learning. Data on surfaces or low-dimensional manifolds where continuous spatial filters are natural.
- Image-as-graph tasks. MNIST/CIFAR on superpixel graphs where edge attributes encode spatial offsets between superpixels.
When not to use SplineConv
- Graphs without spatial edge attributes. SplineConv requires meaningful pseudo-coordinates. Social networks, citation graphs, and knowledge graphs lack these.
- Discrete edge types. B-splines are designed for continuous coordinates. For categorical edge types, use RGCNConv or GINEConv.