TL;DR
STFormer (Spatial-Temporal Transformer) is a new deep learning architecture designed to reconstruct high-speed video from a single, compressed 2D snapshot. By factorizing attention into separate spatial and temporal branches, it achieves state-of-the-art reconstruction quality with linear computational complexity, outperforming previous methods in both accuracy and inference speed.
What Problem Does This Paper Address?
Capturing high-speed video typically requires expensive hardware, massive storage, and high transmission bandwidth. Video Snapshot Compressive Imaging (SCI) offers a "computational imaging" alternative: it uses a low-speed 2D sensor to capture multiple high-speed frames encoded into a single measurement (the optical encoder).
The challenge lies in the software decoder: how do you accurately reconstruct the original video sequence from that one messy, overlapping snapshot?
- Traditional algorithms (like GAP-TV) are slow and struggle with complex motion.
- CNN-based models have small receptive fields, making it hard to capture long-term temporal correlations.
- Standard Transformers excel at long-range dependencies but suffer from quadratic computational complexity, making them too "heavy" for high-resolution video tasks.
Methods
The authors propose STFormer, an end-to-end reconstruction network built on three main components:
- Token Generation (TG) Block: Unlike standard Vision Transformers (ViT) that split images into non-overlapping patches (which can lose local detail), STFormer uses 3D convolutions to generate tokens. This preserves local spatial-temporal structures.
- STFormer Block: This is the core innovation. To keep the model efficient, it uses Space-Time Factorization:
- Spatial Self-Attention (SSA): Computes attention within local windows (similar to Swin Transformer) to capture spatial details.
- Temporal Self-Attention (TSA): Computes attention across the time dimension for tokens at the same spatial position. This allows the model to track motion over many frames without the massive cost of global 3D attention.
- Grouping Resnet Feed Forward (GRFF) Network: Instead of a standard MLP, the authors use a grouped ResNet structure to fuse information across different layers and strengthen correlations between adjacent tokens.
- Video Reconstruction (VR) Block: A final set of 3D convolutions that maps the processed tokens back into the final video frames.
Datasets
The model was trained and evaluated on a wide variety of data:
- Training: The DAVIS2017 dataset (90 scenes).
- Simulated Grayscale Benchmarks: Six standard datasets including Kobe, Traffic, Runner, Drop, Crash, and Aerial (256x256 resolution).
- Simulated Color Benchmarks: Six datasets including Beauty, Bosphorus, Jockey, and others (512x512 resolution).
- Large-Scale Simulation: High-res datasets like Messi and Hummingbird (up to 1080p).
- Real-World Data: Data captured from physical SCI camera systems, including the Duomino, Water Balloon, Hand, and Hammer sequences.
Key Insights and Ideas
- Linear Complexity is King: By restricting spatial attention to local windows and temporal attention to specific spatial points, the computational cost grows linearly with the number of pixels, rather than quadratically. This makes high-res reconstruction feasible.
- 3D Convs > Patches: Using 3D convolutions for tokenization acts as a "soft" patch embedding that prevents the "blocking artifacts" often seen in patch-based Transformers.
- Flexibility: STFormer is robust to changes in the "mask" (the encoding pattern) and input size. Unlike some CNNs that need retraining if the hardware mask changes, STFormer’s attention mechanism adapts dynamically.
- Aha Moment: The authors found that separate spatial and temporal attention branches, when fused correctly, perform better than trying to do "true" 3D attention, which is often too noisy and computationally expensive.
Key Results
- State-of-the-Art Accuracy: On grayscale benchmarks, the "Large" version (STFormer-L) achieved an average PSNR of 36.75 dB, outperforming the previous best (DUN-3DUnet) by 1.49 dB.
- Efficiency: The "Small" version (STFormer-S) is incredibly fast, processing a measurement in 0.14 seconds—nearly 10x faster than DUN-3DUnet while maintaining higher quality than most older CNN methods.
- Real-World Performance: In tests on real SCI camera data, STFormer recovered sharp edges and clear text (e.g., in the Duomino set) where previous SOTA methods produced blurry or "over-smoothed" results.
- High Compression: The model maintained high fidelity even at a compression rate of $B=50$ (50 frames squeezed into 1 image).
Limitations and Future Work
- Noise Gap: While STFormer performs well on real data, there is still a performance gap between simulated data and real-world captures due to complex sensor noise.
- Fixed Compression Training: The current model is typically trained for a specific compression rate (e.g., $B=8$ or $B=10$). The authors note that research into models that handle arbitrary compression rates more gracefully is needed.
- Future Directions: The authors plan to extend STFormer to Spectral SCI (reconstructing color spectrums) and use it as a backbone for downstream tasks like video action recognition and object tracking.
Code Availability: The authors have made their code and pre-trained models public at: https://github.com/ucaswangls/STFormer
Summary updated