The starting point of ResNeXt's idea is a single neuron in a fully connected or convolutional layer. A neuron computes a weighted sum of a D-channel input x=[x1,…,xD] (Eq. 1 of the paper).
i=1∑Dwixi
The paper reinterprets this computation as the following three steps.
- Split: the input x is split into one-dimensional parts xi.
- Transform: each is transformed into wixi (here, a scalar multiplication).
- Aggregate: everything is summed.
ResNeXt replaces the "transform" in step 2 with a small network Ti (Eq. 2).
F(x)=i=1∑CTi(x)
C is the cardinality, the number of transformations summed. It sits in the same position as D in Eq. 1, but need not equal D and can be chosen freely. The paper gives all Ti the same shape (the same bottleneck as ResNet: a 1×1 convolution reduces to a low dimension, a 3×3 is applied, and a 1×1 restores the dimension). Using this as the residual function, the block's output is as follows (Eq. 3).
y=x+i=1∑CTi(x)
Three equivalent forms
As shown on the right of the figure at the top of the article, this block can be written in the following three ways, which compute exactly the same thing when BN and ReLU are placed correctly (Figure 3 of the paper).
- (a) Summing paths: a 256-channel input passes through 32 paths (1×1 to 4 channels, 3×3 to 4 channels, 1×1 to 256 channels), and the outputs are summed.
- (b) Early concatenation: the outputs of the 32 3×3s (4 channels each, 128 channels in total) are concatenated and then restored to 256 channels with a single 1×1 convolution. Summing the last 1×1 convolutions and applying one convolution after concatenation are the same computation.
- (c) Group convolution: further, the first 1×1 convolutions of the 32 paths are merged into one 1×1 (128 channels), and the 3×3 becomes a group convolution with 32 groups.
The paper's implementation uses form (c). All three trained to the same results, and (c) was the most concise and the fastest. Form (c) is almost the same as ResNet's bottleneck; the only difference is that "the 3×3 layer is wider and split into groups with sparse connections".
Group convolution was originally a device that AlexNet used to split the model across two GPUs. According to the ResNeXt paper, there had been almost no use of group convolution to improve accuracy before. The special case where the number of groups equals the number of channels is channel-wise convolution (the first half of a depthwise separable convolution).
Difference from Inception
The modules of GoogLeNet (Inception) also follow a "split, transform, aggregate" form, but the filter sizes and counts are hand-crafted for each branch, and the modules are tuned stage by stage. ResNeXt gives all paths the same shape, so the number of paths can be studied as a single number, and fewer hyperparameters need tuning for new data.