MS-TCN takes the per-frame features x1:T of a video and outputs the class c1:T of each frame (T is the video length). The whole model stacks four single-stage models (SS-TCN) of the same form (figure at the top of this article).
The single-stage model (SS-TCN)
A single stage consists only of the following layers (right side of the figure at the top of this article). It uses no pooling, which would reduce the number of time steps, and no fully connected layers, which would fix the input length.
- 1×1 convolution: Maps the input feature dimension to the network's channel count D (64 in the paper).
- 10 dilated residual layers: Each layer applies a dilated convolution with kernel size 3, ReLU, and a 1×1 convolution, and adds the result to the layer input (residual connection). The dilation doubles at each layer: 1, 2, 4, …, 512. Unlike WaveNet, the convolution is non-causal and also looks at future frames.
- Output: A 1×1 convolution maps to the number of classes C, and a softmax gives the class probabilities for each frame.
Layer l computes the following (∗ is convolution, W1 the dilated convolution weights, and W2 the 1×1 convolution weights).
H^l=ReLU(W1∗Hl−1+b1),Hl=Hl−1+W2∗H^l+b2
With kernel size 3, the receptive field up to layer l is as follows, doubling with each added layer.
ReceptiveField(l)=2l+1−1
With 10 layers this is 2047 frames, or about 136 seconds at 15 frames per second. Because the receptive field grows exponentially just by adding layers, the model can see long time spans without adding parameters, which the paper says also helps prevent overfitting to the training data.
Stacking stages (Multi-Stage)
The first stage takes the features, and from the second stage on, each stage receives only the per-frame probabilities produced by the previous stage.
Y0=x1:T,Ys=F(Ys−1)
F is the single-stage model and Ys is the output of stage s. This brings the idea of stacking predictions over multiple stages, used in human pose estimation, to action segmentation.
Loss function
The loss of each stage is the sum of a classification loss and a smoothing loss.
- Classification loss: Frame-wise cross-entropy. yt,c is the predicted probability of class c at time t.
- Smoothing loss (T-MSE): The difference Δt,c between the log probabilities of adjacent frames is capped at τ, and the mean of the squares is taken (a truncated mean squared error).
- Total: The per-stage losses Ls are summed over all stages.
Lcls=T1t∑−logyt,c,LT-MSE=TC1t,c∑Δ~t,c2
Δ~t,c=min(Δt,c,τ),Δt,c=∣logyt,c−logyt−1,c∣
Ls=Lcls+λLT-MSE,L=s∑Ls
Gradients are computed only with respect to yt,c; the previous frame's yt−1,c is treated as a constant. The paper uses τ=4 and λ=0.15.
Training settings (Section 3.4 of the paper)
- 4 stages, 10 dilated residual layers per stage, 64 filters in every layer, kernel size 3
- Dropout after each layer
- Adam, learning rate 0.0005
- Input: I3D features (not fine-tuned), 15 frames per second