BlooDet: Surgical Bleeding Detection
- BlooDet is a dual-task surgical detection framework that segments bleeding regions and localizes bleeding points using a memory-augmented, bidirectionally guided architecture.
- It integrates a video-capable SAM 2 backbone with custom prompt, edge, and memory modules to exploit spatial-temporal cues in laparoscopic procedures.
- The framework achieves state-of-the-art performance with precise segmentation (IoU 64.88%) and improved point localization (PCK-10% 83.69%) on the SurgBlood benchmark.
BlooDet is a dual-task, online detection framework for quantitative bleeding region segmentation and bleeding point localization in laparoscopic surgical videos. Developed to exploit spatial-temporal cues in real-world surgical data, it synergistically unites bleeding-area mask and bleeding-source point detection in a bidirectionally guided, memory-augmented architecture. BlooDet builds upon, and extensively extends, the video-capable Segment Anything Model 2 (SAM 2) backbone, integrating novel prompt and memory mechanisms designed to maximize detection accuracy under surgical conditions typified by rapid hemoglobin dynamics and camera movement (Pei et al., 28 Mar 2025).
1. Dual-Branch Network Architecture
BlooDet features two parallel, tightly coupled branches: a Mask Branch that predicts binary bleeding region masks, and a Point Branch that outputs coordinate positions and confidence for the bleeding source per video frame. A sliding window over sequences of consecutive frames is employed, with each time step processing the current video frame and its predecessors. Input images are passed through the shared SAM 2 image encoder to obtain multi-scale features , which are subsequently processed by both memory modeling modules—one for the region masks, one for bleeding point features.
A defining characteristic is bidirectional branch guidance: the Mask Branch incorporates a soft point-heatmap from the Point Branch as a prompt, while the Point Branch reuses historical mask features and maps for optical-flow–based compensation and spatial anchoring. This architecture exploits spatial-temporal correlations between regions and acute bleed points, allowing each task to provide contextual evidence for the other and enhancing overall detection robustness.
2. Adaptive Prompt Embedding and Decoder Integration
BlooDet leverages key components from the official ICLR ‘25 release of SAM 2: the image encoder, prompt encoder, and transformer-based decoder. To tailor SAM 2’s generalist design to the surgical bleeding detection tasks, the Mask Branch integrates two custom prompt types:
Edge Prompt (): Generated by a multi-scale Wavelet Laplacian filter applied to high-resolution features, encoding blood region edges. This prompt is transformed via a lightweight prompt encoder comprised of alternating 2×2 convolutions, LayerNorm, and GELU activation layers:
Point Prompt (): The soft point-heatmap from the Point Branch is Fourier-feature-encoded positionally:
where denotes Fourier-feature positional encoding and 0 is a learned embedding.
Both prompt embeddings, 1 and 2, are fused in the SAM 2 mask decoder, which jointly attends over 3, 4, and 5 to predict the bleeding-region mask 6.
3. Point Branch: Memory Modeling and Optical Flow Compensation
For accurate bleeding point localization, the Point Branch incorporates both mask-guided spatiotemporal memory and explicit motion compensation:
- Memory Banks: For each time point, two memory banks store past point-feature memories 7 and mask-feature memories 8. These enable temporal modeling over the recent video window.
- Optical Flow: For each inter-frame pair, dense flow 9 is computed, but critically, to isolate camera (not hemorrhage) movement, the average flow over background pixels (weighted by 0) yields the global camera offset:
1
This is mapped via a small MLP and concatenated with past point (2) and mask (3) encodings to form reference tensors 4 for each of the 5 stored frames.
- Point Feature Synthesis and Decoding: The current features 6 attend (self- and cross-attention) to all 7, yielding 8. A transformer-based decoder, following the standard SAM 2 paradigm but with additional learnable query tokens, decodes the bleeding point coordinate 9 and existence score 0.
4. Loss Functions, Training, and Inference Protocols
The overall training objective combines region, edge, point localization, and point existence terms:
1
with empirical weights 2, 3.
- Mask/Edge Losses: Per-pixel sum of Focal Loss and Dice Loss.
- Point Loss: Smooth L1 loss applied only on frames where a bleeding point exists (4), plus binary cross-entropy (BCE) for point existence prediction.
The memory banks update on each new frame using memory encoders for both mask and point features, truncating to 5 entries as needed. Training uses the SurgBlood dataset (5,330 frames from 95 surgical clips), Adam with linear warm-up and linear decay, and fixed PWC-Net weights for optical flow. Inference applies the pipeline over sliding windows, yielding mask and point predictions for the final frame in each window.
Inference Pipeline Pseudocode
6
5. Empirical Performance and Ablation Analysis
Quantitative evaluation on the SurgBlood benchmark indicates that BlooDet achieves state-of-the-art results for both bleeding region and point detection:
| Method | IoU↑ | Dice↑ | PCK-2%↑ | PCK-5%↑ | PCK-10%↑ |
|---|---|---|---|---|---|
| SAM 2‐Adapter | 64.23 | 77.95 | – | – | – |
| SAM 2 + point head | 50.93 | 67.49 | 12.35 | 41.68 | 71.99 |
| BlooDet | 64.88 | 78.70 | 18.62 | 55.85 | 83.69 |
Mask segmentation achieves IoU of 64.88% and Dice of 78.70%. For point detection, BlooDet yields PCK-10% of 83.69%, surpassing the next best baseline by approximately 12 percentage points.
Ablation studies confirm the complementary roles of the Edge Generator (EG) and Point Memory Modeling (PMM): removing either module degrades both mask and point metrics, with the full model yielding superior accuracy (e.g., IoU 64.88%, Dice 78.70%, PCK-2% 18.62%). Removing multi-scale branches or Laplacian filtering from the edge prompt lowers IoU by 3–4 points; substituting background-weighted optical flow for standard approaches yields increased point accuracy. Bidirectional guidance contributes ~1–2 IoU to region accuracy and ~6–8 points to PCK-2% for points.
6. Architectural Significance and Discussion
BlooDet introduces a novel approach to dual-task detection that goes beyond naïve multi-headed or serial solutions by establishing bidirectional, memory-augmented coupling between masks and points. The adaptive edge and point prompt mechanisms, combined with temporal memory and cross-task guidance, enable effective exploitation of subtle spatial-temporal relationships frequently present in challenging surgical video data. The architecture, by leveraging explicit camera-motion compensation and inter-frame context, addresses the confounding effects of camera movement and blood flow dynamics more robustly than previous methods.
The use of a shared SAM 2 backbone for video processing ensures consistency and leverages advances from large-scale segmentation research, while the bespoke modules enable precise adaptation for the critical tasks of surgical bleeding quantification and point localization.
7. Dataset and Benchmarking: SurgBlood
BlooDet was trained and evaluated on the SurgBlood dataset, which comprises 5,330 annotated frames over 95 laparoscopic surgical video clips, each annotated for bleeding regions (masks) and discrete bleeding points. Data splits used 75 clips for training and 20 for testing, with 8-frame, 512×512-pixel windowed inputs.
This new benchmark supports objective, reproducible comparison across methods addressing intraoperative bleeding detection. On this dataset, BlooDet outperforms a set of 12 contemporary baselines.
All information precisely reflects “Synergistic Bleeding Region and Point Detection in Laparoscopic Surgical Videos” (Pei et al., 28 Mar 2025).