arXiv:2610.35005cs.CVOct 2026

Manuscript Offprint

arXiv:2610.35005

Shifted Window Temporal Transformer for YOLO-Guided Phase Recognition in Laparoscopic Cholecystectomy Surgery

Sheekar Banerjee, Md. Shahabuddin, Md. Mahbub Hasan Akash, Nabilah, Mohammad Arafat Hussain

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

Intelligent operating rooms require accurate awareness of surgical workflow for better intra-operative decisions, teamwork, and surgical documentation. Therefore, accurately recognizing surgical phase during surgery is crucial. However, previous artificial intelligence-based methods provide fluctuating predictions for the transitions, restricting their clinical use. To address this challenge, we propose a clinically meaningful framework that integrates a Swin Transformer and Temporal Transformer Encoder (TTE) for effective surgical phase recognition and a parallel YOLOv11s network for real-time surgical instrument localization. To avoid phase flickering and to produce stable workflow predictions, a causal temporal smoothing is applied. The proposed framework is tested on the Cholec80 dataset for the simultaneous recognition of the surgical phases and instruments. The overall phase recognition accuracy of this model was 92%, and the macro average F1-score was 0.86. This performance surpasses CNN-based methods such as EndoNet (81.7%) and SV-RCNet (85.3%), as well as temporal convolutional and transformer-based approaches including TeCNO (88.6%), Trans-SVNet (90.9%), and LoViT (91.5%). Besides, the module of instrument detection achieved mAP@0.5 = 0.863. The reliability of the results is confirmed, obtaining a high recognition rate of the workflows, and a high accuracy of the localization of the instruments. The proposed framework can serve as a foundation for intelligent surgical assistance, enriching situation awareness, and potential robotic surgery applications. Code will be made publicly available upon acceptance at: https://github.com/ac005sheekar/LapChol-Surgery-Swin-Cholec80.

Keywords: Surgical Phase Recognition, Surgical Tool Detection, Laparoscopic Cholecystectomy, Cholec80, Swin Transformer, Temporal Transformer Encoder, YOLOv11s, Multi-Task Learning, Sliding Window Prediction, Phase Smoothing.

1 Introduction

Advances in artificial intelligence (AI) have enabled intelligent clinical decision-support systems for improving surgical workflow analysis and inter-operative awareness [11, 12]. In laparoscopic cholecystectomy, large volumes of surgical videos are generated, but manual analysis is time-consuming and impractical, motivating automated video analysis systems [9, 10]. Automatic surgical workflow analysis requires understanding both visual information and procedural context. An effective system must recognize surgical phases while identifying the instruments used during the procedure. Since consecutive frames often have similar visual appearances, spatial information alone may lead to ambiguous predictions and unstable phase transitions. Therefore, robust workflow recognition requires effective spatial and temporal feature modeling [2–6].

Deep learning has substantially advanced surgical workflow analysis. Early CNN-based approaches, including EndoNet [1] and SV-RCNet [46], demonstrated effective feature learning from laparoscopic videos [1, 2]. More recently, Vision Transformers (ViTs) have improved long-range contextual modeling through self-attention [14, 15]. The Swin Transformer further provides hierarchical spatial representations using shifted-window attention [13], while temporal transformers and multi-task learning enable effective modeling of procedural dynamics and complementary phase-instrument information [4–6, 42, 43]. Even though these advances have been made, there are still a number of challenges. Phase recognition and instrument detection are frequently considered conflicting tasks, thus depriving them from exploiting a relationship between the usage of instruments and the advancement of a workflow. Furthermore, two similar visual frames can result in ‘phase flicker’, and class imbalance can lead to less good recognition results for less common surgical phases [3, 6, 40].

Recent advances in artificial intelligence have enabled automated surgical procedure tracking, skill assessment, and intra-operative decision support. Surgical workflow analysis focuses primarily on phase recognition and instrument detection. Early methods relied on handcrafted features and Hidden Markov Models (HMMs), whereas deep learning enabled end-to-end feature learning directly from surgical videos.

CNN-based approaches have been shown to be effective in capturing spatial information in surgical phase recognition [1, 16]. But frame level CNNs cannot capture long-term temporal relations between adjoining frames, which makes the predictions unstable. CNN-LSTM and CNN-GRU architectures help improve temporal modeling but are limited by sequential processing [2, 5, 22, 37]. Vision Transformers (ViTs) and temporal transformer architectures can offer much better long-range spatial and temporal modeling [4–6, 14, 15, 42, 43] respectively. The Swin Transformer further proposes hierarchical representations with shifted-window self-attention for efficient multi-scale contextual modeling, which is beneficial for surgical video analysis [6, 13].

The localization of surgical instruments can complement the information needed for workflow recognition. Traditional two-stage detectors are sensitive to occlusion, illumination variation, and instrument deformation. While YOLO demonstrations are classified by single stage detectors, they can offer a balance between the detection accuracy and the speed of the machine motion inference in the real-time applications [17–21,45][17–21, 45]. Multi-task learning also allows a connection between surgical phases and instruments to be exploited by using shared feature representations. Joint models of these tasks have been seen to yield better performance than independent models in previous studies; performance is a challenge and problems with task balancing and negative transfer still exist [1–5,30,31][1–5, 30, 31].

Surgical datasets are intrinsically unbalanced, the most common aspects of surgery being available in large numbers in the training set, but clinically important aspects occurring with less frequency. Class-balanced sampling, focal loss, and cost-sensitive learning are commonly used to improve minority-class recognition [30–32, 40]. In addition, visually similar consecutive frames can cause phase flickering during real-time inference. Temporal post-processing methods, including causal smoothing and rolling-queue strategies, improve prediction consistency while maintaining low latency [2, 6, 42].

Despite these advances, phase recognition and instrument detection are often treated as separate tasks, and the integration of hierarchical spatial transformers with temporal transformers remains relatively unexplored [4–6, 43]. Real-time deployment is further affected by class imbalance and prediction instability [30]. To address these gaps, this work proposes a unified framework combining a Swin Transformer, Temporal Transformer, YOLO-based instrument localization, and causal temporal smoothing for reliable surgical workflow analysis.

In this paper, to tackle the above problems, we aim at developing a comprehensive spatial–temporal framework that works for surgical phase recognition and real-time instrument localization at the same time. The network combines a Swin Transformer base and Temporal Transformer network for encoding spatial and long-range temporal information and a bespoke YOLOv11s detector in order to locate surgical instruments [17, 20, 21, 41]. Additionally, a causal rolling-queue temporal smoothing strategy is used to smoothen out the prediction and to achieve temporal consistency.

at real-time run time.

The major contributions of this work are summarized as follows:

(a) A single framework to simultaneously recognize surgical phases and locate instruments in real-time during Laparoscopic Cholecystectomy.

(b) A novel Swin Transformer and Temporal Transformer based architecture to incorporate effective spatial–temporal modeling and mitigate phase flickering.

(c) A trained YOLOv11s detector for real-time surgical instrument localization and additional procedural context.

(d) Proposing a causal rolling-queue temporal smoothing strategy and extensive experiments using the Cholec80 dataset towards stable and reliable workflow real-time analysis.

References (45)