OadTR: Online Action Detection with Transformers

Xiang Wang, Shiwei Zhang, Zhiwu Qing, Yuanjie Shao, Zhengrong Zuo, Changxin Gao, Nong Sang

Introduction

Online Action Detection (OAD) is a critical task in computer vision where models must identify actions in a video stream as they occur, using only current and past frames. This "live" analysis is essential for real-time applications such as autonomous driving and intelligent surveillance. Historically, OAD has relied on Recurrent Neural Networks (RNNs) like LSTMs to model temporal dependencies. However, RNNs suffer from sequential processing bottlenecks, gradient vanishing over long sequences, and limited ability to capture complex non-linear interactions between distant frames.

To overcome these limitations, the OadTR (Online Action Detection TRansformer) framework introduces a pure Transformer-based architecture. By leveraging self-attention, OadTR can process temporal windows in parallel, effectively capturing long-range historical context while simultaneously anticipating future frames to improve current recognition.

Methods: The OadTR Architecture

OadTR utilizes an encoder-decoder structure designed specifically for the constraints of online detection.

Encoder and Task Token

Unlike standard Transformers that might use the last frame's output for classification, OadTR introduces a dedicated task token. This token is appended to the sequence of historical frame features. Through the encoder's self-attention layers, the task token interacts with all historical frames to learn a global, discriminative representation of the entire sequence. This prevents the model from being overly biased toward the most recent frame, which might be blurry or partially occluded.

Decoder and Future Anticipation

Inspired by human cognition, where anticipating the next move helps clarify the present, OadTR includes a decoder that predicts representations for future clips. It uses learnable "prediction queries" that attend to the encoder's historical features to estimate the next few seconds of video. The final classification of the current frame is performed by concatenating the historical summary (from the task token) and the anticipated future context (from the decoder).

The OadTR architecture features a Transformer encoder with a task token and a decoder for future anticipation.

Experimental Results

The model was rigorously evaluated on three major benchmarks: HDD (driving footage), TVSeries (unconstrained TV show clips), and THUMOS14 (a standard action detection benchmark).

Performance and Efficiency

OadTR sets a new state-of-the-art (SOTA) across these datasets. On THUMOS14, it achieved a 58.3% mAP, a significant improvement over the previous best of 50.0% held by IDN. Beyond accuracy, the Transformer-based design allows for massive parallelism, resulting in an inference speed of approximately 110 FPS. This is substantially faster than previous RNN-based models like TRN and IDN, making it highly suitable for real-time deployment.

Comparison of loss curves, inference speed, and mAP performance between TRN, IDN, and OadTR.

Key Insights

  • Anticipation as an Auxiliary Task: Training the model to predict the future acts as a powerful regularizer, helping the model distinguish between similar-looking start-of-action sequences (e.g., "picking up a glass" vs. "drinking").
  • Early Detection: OadTR excels at identifying actions in their earliest stages (0%-10% completion), a vital capability for safety-critical systems like autonomous vehicles.

Conclusion

OadTR demonstrates that Transformers are not only more accurate than RNNs for online action detection but also significantly more efficient. By combining global historical encoding via a task token with future anticipation, the framework provides a robust solution for real-time video understanding. Future work may extend this temporal framework to spatio-temporal detection to identify both the "what" and "where" of actions in real-time.

Summary updated

BibTeX
@inproceedings{wang2021oadtr,
  author = {Xiang Wang and Shiwei Zhang and Zhiwu Qing and Yuanjie Shao and Zhengrong Zuo and Changxin Gao and Nong Sang},
  title = {{OadTR: Online Action Detection with Transformers}},
  booktitle = {IEEE/CVF International Conference on Computer Vision},
  year = {2021},
  doi = {10.1109/iccv48922.2021.00747},
}
Figure