Surgformer: Surgical Transformer with Hierarchical Temporal Attention for Surgical Phase Recognition

Shu Yang, Luyang Luo, Qiong Wang, Hao Chen

Abstract

Surgical phase recognition is a critical task for the development of context-aware systems in the operating room. Traditional approaches often rely on two-stage models that decouple spatial and temporal feature extraction, leading to inefficiencies and a loss of interaction between visual details and procedural timing. This paper presents Surgformer, an end-to-end transformer architecture that utilizes Hierarchical Temporal Attention (HTA) to capture both local and global temporal dependencies from sparsely sampled video frames. Evaluated on the Cholec80 and Autolaparo datasets, Surgformer achieves state-of-the-art performance, demonstrating the effectiveness of a unified, target-centric attention mechanism in complex surgical environments.

1. Introduction

In modern surgical practice, the ability to automatically identify the current step of a procedure—known as surgical phase recognition—is fundamental for workflow optimization, automated documentation, and surgeon training. Despite its importance, the task remains challenging due to the high spatial-temporal redundancy of surgical video and the complex, non-linear nature of surgical workflows.

Current methodologies typically fall into two categories: two-stage models and one-stage models. Two-stage models first extract spatial features using a Convolutional Neural Network (CNN) or a Vision Transformer (ViT) and then process these features through a temporal model like a Long Short-Term Memory (LSTM) network or a Temporal Convolutional Network (TCN). This separation often prevents the model from learning the intricate relationships between spatial cues and temporal context. Conversely, existing one-stage models often struggle with the computational burden of processing long video sequences or lack the "memory" required to understand the global context of a multi-hour surgery.

Surgformer addresses these limitations by introducing a unified, end-to-end transformer architecture designed to efficiently model long-range dependencies while maintaining focus on local phase transitions.

2. Methodology

Surgformer departs from dense frame-by-frame processing, instead employing a strategy that balances computational efficiency with contextual depth.

2.1 Sparse Sampling

To mitigate the noise and redundancy inherent in high-frequency surgical video, Surgformer utilizes a sparse sampling strategy. By sampling frames at a fixed rate (e.g., one frame every four), the model reduces the input volume while retaining sufficient information to identify critical phase transitions. This approach allows the model to process longer temporal windows without a proportional increase in computational cost.

2.2 Hierarchical Temporal Attention (HTA)

The core innovation of Surgformer is the Hierarchical Temporal Attention (HTA) mechanism. Unlike standard temporal attention that treats all frames in a sequence with equal granularity, HTA partitions the video into segments with varying temporal resolutions ($T, T/2, T/4$). This hierarchical structure allows the model to analyze the "target frame" through multiple lenses simultaneously:

  • Global Context: A wide-angle view that captures the overall progression of the surgery.
  • Local Consistency: A high-resolution view that focuses on immediate movements and subtle transitions.

By aggregating these multi-scale features, the model builds a robust representation centered on the current frame, ensuring that predictions are informed by both the immediate action and the broader procedural stage.

2.3 Aggregated Spatial Attention (ASA)

Following temporal feature extraction, the Aggregated Spatial Attention (ASA) module propagates temporal information across different spatial regions of the frame. This ensures that the model understands the spatial context—where an instrument is located or what tissue is being manipulated—in direct relation to the temporal phase.

2.4 End-to-End Training

Surgformer is trained in an end-to-end fashion. This allows the gradients to flow through both the spatial and temporal modules simultaneously, enabling the spatial features to adapt to the requirements of the temporal attention mechanism and vice versa.

3. Experiments and Results

The performance of Surgformer was evaluated on two benchmark datasets: Cholec80 (80 gallbladder removal videos) and Autolaparo (21 laparoscopic hysterectomy videos).

3.1 Performance on Cholec80

On the Cholec80 dataset, Surgformer achieved a video-level accuracy of 93.4%. This performance matches or exceeds established two-stage models such as SKiT and LoViT, proving that a one-stage transformer can be as effective as more complex, decoupled architectures.

3.2 Performance on Autolaparo

The Autolaparo dataset represents a more significant challenge due to the complexity of hysterectomies and the subtlety of phase transitions. Surgformer demonstrated a substantial improvement over previous state-of-the-art models on this dataset, reaching 85.7% accuracy. This represents a nearly 3% increase over the previous best-performing model, SKiT.

3.3 Ablation Studies

Ablation experiments highlighted the impact of the HTA module. The inclusion of hierarchical attention consistently improved the Jaccard score—a metric measuring the overlap between predicted and ground-truth phases—by up to 4.8% compared to models using standard temporal attention.

4. Discussion and Conclusion

Surgformer introduces a "target-centric" perspective to surgical phase recognition, arguing that the most effective way to classify the current frame is to build dependencies specifically around it using multi-scale temporal information. The results suggest that sparse sampling is not only sufficient but beneficial, as it forces the model to focus on the most informative frames.

However, limitations remain. The "Target Frame-centric Aggregation" (TFA) showed a slight performance dip on the highly complex Autolaparo dataset compared to its performance on Cholec80. This indicates that in procedures with high ambiguity, a purely target-centric approach may benefit from even broader global modeling.

Future research will focus on refining the model's handling of ambiguous transitions and exploring its deployment in real-time clinical settings to support live surgical decision-making.

Summary updated

BibTeX
@inproceedings{yang2024surgformer,
  author = {Shu Yang and Luyang Luo and Qiong Wang and Hao Chen},
  title = {{Surgformer: Surgical Transformer with Hierarchical Temporal Attention for Surgical Phase Recognition}},
  booktitle = {International Conference on Medical Image Computing and Computer-Assisted Intervention},
  year = {2024},
  doi = {10.1007/978-3-031-72089-5\_57},
}
Figure