Skip to content
AI360Xpert
Beta

Group Equivariant CNNs

A normal CNN notices a pattern only where it learned it. Group equivariant CNNs notice it in every rotated or flipped pose at once, with the pose carried along as extra feature channels.

A group CNN lifts the input into orientation channels so a rotated pattern peaks in a rotated channel instead of vanishing
A group CNN lifts the input into orientation channels so a rotated pattern peaks in a rotated channel instead of vanishing

Why Does This Exist?

Rotation augmentation is a tax. Quadrupling the data with rotated copies quadruples training cost, bloats the model with four copies of every filter, and still offers no guarantee — a 3030-degree test rotation falls between the augmented angles. For aerial imagery, microscopy, and industrial inspection, where orientation is genuinely arbitrary, the tax dominates training.

Group equivariant CNNs (G-CNNs) remove it structurally. Convolution is extended from positions to positions-plus-poses, so one learned filter responds at every group element and reports where it fired. The shared principle is geometric deep learning; the continuous-angle sibling is steerable networks.

The one idea you need first. A group convolution correlates the input with transformed copies of one filter. For the p4p4 group (translations plus rotations by 00, 9090, 180180, 270270 degrees), each filter produces four orientation channels instead of one. Rotating the input permutes energy across those channels rather than destroying it, which is exactly the equivariance guarantee.

Think of It Like This

A stencil you can spin

A fixed stencil prints a star pointing up. To print it pointing right, you cut a second stencil, and a third for down. Soon the workshop wall is covered in near-identical stencils and the apprentice still cannot print a star at 4545 degrees.

A G-CNN owns one stencil on a pivot. Spin the paper or spin the stencil; the print lands rotated and the pivot angle is recorded on the job sheet. One tool, every sampled orientation, and the orientation itself becomes part of the output instead of an accident of which stencil you grabbed.

The analogy stops at sampling: the pivot clicks into four detents, not a smooth spin. Between detents, the stencil still improvises.

How It Actually Works

The first layer lifts the image: at each position, it records the filter response under all four rotations, producing feature maps indexed by (x,y,θ)(x, y, \theta). Deeper layers convolve over the group itself, combining position and orientation neighborhoods with the same kernel reused across orientations — that reuse is the parameter saving versus augmentation. A final pooling over θ\theta yields rotation invariance for classification, while keeping θ\theta yields pose-aware features for detection.

Because the kernel is shared, a corner learned upright is automatically a corner at 9090 degrees; the response simply moves to the 9090-degree channel. Rotating the input rotates the channel contents, which is the guarantee augmentation cannot give.

Worked example

Pattern P=[[1,0],[0,0]]P = [[1, 0], [0, 0]] (a dot in the top-left corner). Input X=[[0,1],[0,0]]X = [[0, 1], [0, 0]] (the same dot, rotated 9090 degrees clockwise about the patch center). Cross-correlate (no kernel flip) with each rotated copy of PP, summing elementwise products:

  • θ=0\theta = 0: P0=[[1,0],[0,0]]P_0 = [[1, 0], [0, 0]]: 0×1+1×0+0+0=00 \times 1 + 1 \times 0 + 0 + 0 = 0.
  • θ=90\theta = 90: P90=[[0,1],[0,0]]P_{90} = [[0, 1], [0, 0]]: 0×0+1×1+0+0=10 \times 0 + 1 \times 1 + 0 + 0 = 1.
  • θ=180\theta = 180: P180=[[0,0],[0,1]]P_{180} = [[0, 0], [0, 1]]: 00.
  • θ=270\theta = 270: P270=[[0,0],[1,0]]P_{270} = [[0, 0], [1, 0]]: 00.

Response across channels: [0,1,0,0][0, 1, 0, 0]. The pattern is found, and the peak sitting in channel 11 reports its pose: rotated 9090 degrees. A plain CNN with only P0P_0 would output 00 and miss it entirely.

Code

The point of this snippet is the lift: rotate one filter four ways, correlate, and watch the peak move channels as the input rotates.

def rot90(m: list) -> list:    return [list(row) for row in zip(*m[::-1])]

def correlate(x: list, k: list) -> int:    return sum(x[i][j] * k[i][j] for i in range(2) for j in range(2))

P = [[1, 0], [0, 0]]filters = [P]for _ in range(3):    filters.append(rot90(filters[-1]))  # 0, 90, 180, 270
X = [[0, 1], [0, 0]]  # P rotated 90 degreesprint([correlate(X, f) for f in filters])  # -> [0, 1, 0, 0]

Watch Out For

Forty-five degrees falls between the channels

The guarantee covers the group's four angles exactly. At 4545 degrees the response smears across channels and the peak sags, so accuracy on diagonal orientations can trail the axis-aligned numbers by a wide margin.

Sweep validation rotations continuously and read the curve, not just the fourCardinal points. When the dips matter, switch to steerable networks for continuous coverage instead of pretending four samples cover the circle.

Orientation channels quadruple the memory

Lifting multiplies feature-map memory by the group size: four orientations mean four times the activations at every layer. Deep G-CNNs can exhaust memory where a plain CNN of the same width fits comfortably.

Budget channels accordingly: narrower layers with four orientations often beat wider layers with one, and pool over θ\theta as soon as pose stops mattering downstream. Memory, not parameters, is the binding constraint.

The Quick Version

  • A G-CNN convolves over poses as well as positions, so one filter fires at every sampled rotation.
  • The worked fixture gives channel responses [0,1,0,0][0, 1, 0, 0]: found, with pose reported by the peak channel.
  • Weight sharing across orientations replaces rotation augmentation with a guarantee at the sampled angles.
  • Diagonal angles between samples still sag, so validate on a continuous rotation sweep.
  • Feature memory multiplies by the group size, so go narrower and pool over pose early.