Frame Flexible Network

Yitian Zhang, Yue Bai, Chang Liu, Huan Wang, Sheng Li, Yun Fu · DOI

Abstract

Existing video recognition algorithms always conduct different training pipelines for inputs with different frame numbers, which requires repetitive training operations and multiplying storage costs. If we evaluate the model using other frames which are not used in training, we observe the performance will drop significantly, which is summarized as Temporal Frequency Deviation phenomenon. To fix this issue, we propose a general framework, named Frame Flexible Network (FFN), which not only enables the model to be evaluated at different frames to adjust its computation, but also reduces the memory costs of storing multiple models significantly. Concretely, FFN integrates several sets of training sequences, involves Multi-Frequency Alignment (MFAL) to learn temporal frequency invariant representations, and leverages Multi-Frequency Adaptation (MFAD) to further strengthen the representation abilities. Comprehensive empirical validations using various architectures and popular benchmarks solidly demonstrate the effectiveness and generalization of FFN (e.g., 7.08/5.15/2.17% performance gain at Frame 4/8/16 on Something-Something V1 dataset over Uniformer).

Introduction

Video recognition models are typically optimized for a fixed number of input frames. When a model trained on a high frame count is deployed on a low-power device using fewer frames, its performance degrades significantly. This phenomenon, termed Temporal Frequency Deviation, necessitates training separate models for different hardware constraints, leading to high storage and training costs.

Temporal Frequency Deviation: Performance drops significantly when inference frame counts differ from training frame counts.

As illustrated in Figure 6, models trained on a specific frame count (e.g., 8 or 12 frames) fail to generalize to other temporal resolutions, often performing significantly worse than models specifically trained for those counts (Separated Training).

The Cause: Batch Normalization Shift

The researchers identified that the primary driver of this performance drop is a shift in internal feature statistics. Specifically, Batch Normalization (BN) layers, which track running means and variances during training, become misaligned when the input temporal frequency changes.

Analysis of feature statistics (mean and variance) across network layers for different frame counts.

Figure 4 demonstrates that the mean (μ) and variance (σ²) of features vary considerably between 4-frame and 16-frame inputs, particularly in the earlier layers of the network. This statistical discrepancy is a core reason why standard models fail to be frame-flexible.

Proposed Method: Frame Flexible Network (FFN)

To overcome these challenges, the Frame Flexible Network (FFN) introduces a unified framework for multi-frequency video recognition. FFN consists of two core components:

  1. Multi-Frequency Alignment (MFAL): This module employs weight sharing across all frame counts. To ensure the model learns frequency-invariant representations, it uses Temporal Distillation. During training, a high-frame "teacher" model guides lower-frame "student" models via KL divergence loss, transferring rich temporal information.
  2. Multi-Frequency Adaptation (MFAD): Recognizing the impact of BN shift, FFN utilizes Private Normalization layers tailored to specific frame counts. Additionally, lightweight Alter blocks (depth-wise convolutions) are inserted to slightly adjust shared weights for different temporal rhythms, adding minimal parameter overhead (<1%).

Experimental Results

FFN was evaluated on major benchmarks including Something-Something V1 & V2, Kinetics400, and HMDB51. The results demonstrate that FFN not only matches but often exceeds the performance of specialized "Separated Training" (ST) models while using a single set of weights.

  • Accuracy Gains: On Something-Something V1, FFN achieved a 7.08% gain at 4 frames and a 2.17% gain at 16 frames over the Uniformer baseline.
  • Architecture Agnostic: The framework proved effective across various backbones, including 2D CNNs (TSM), 3D CNNs (SlowFast), and Transformers (Uniformer).
  • Zero-Shot Flexibility: FFN can even generalize to "unseen" frame counts during inference (e.g., evaluating on 6 frames after training on 4 and 8), showcasing true temporal flexibility.

Conclusion

The Frame Flexible Network offers a practical solution for deploying video recognition models across diverse hardware. By addressing the Temporal Frequency Deviation through alignment and adaptation, FFN provides a single, robust model that balances efficiency and accuracy. Future research will aim to optimize the training-time memory overhead required for multi-frequency distillation.

Summary updated

BibTeX
@inproceedings{zhang2023frame,
  author = {Yitian Zhang and Yue Bai and Chang Liu and Huan Wang and Sheng Li and Yun Fu},
  title = {{Frame Flexible Network}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2023},
  doi = {10.1109/cvpr52729.2023.01012},
}
Figure