Skip to content

Saury997/S3H-Net

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

21 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

S3H-Net for Medical Image Segmentation

Paper Title: S3H-Net: Injecting Hybrid Semantic-Spatial Guidance via Superpixel Hypergraphs for Medical Image Segmentation

Conference: MICCAI 2026 (Submission ID: 2653)

Status: 🟒 Accept

Python PyTorch Lightning MICCAI 2026 License

πŸ“’ News

  • [2026-06-13] πŸŽ‰ Accept! Our paper has been accepted to MICCAI 2026!
  • [2026-02-27] πŸ“ Paper submitted to MICCAI 2026.

πŸ“– Overview

This repository contains the official PyTorch implementation of S3H-Net, a novel architecture designed to push the boundaries of medical image segmentation by integrating Superpixel-based Semantic-Spatial Hypergraphs.

Accurate medical image segmentation is often hindered by complex geometries and blurred boundaries. While graph-based methods have gained popularity, they often suffer from semantic ambiguity due to fixed-patch nodes and limited global context injection. S3H-Net overcomes these bottlenecks through a boundary-aware and multi-scale reasoning approach.

Key Contributions:

  • 🌟 Boundary-Aware Node Construction: Unlike traditional patch-based methods, we utilize the Simple Linear Iterative Clustering (SLIC) algorithm for node construction. This ensures strict alignment with target contours and preserves semantic purity by avoiding the mixing of heterogeneous features.
  • 🧠 Hybrid Semantic-Spatial Hypergraph (HSSH): We introduce a parallel Semantic Encoder built on HSSH blocks. This component captures high-order, multi-scale semantic guidance continuously across the network, rather than being restricted to bottlenecks.
  • πŸ”Œ Cross-Covariance Semantic Injection (CCSI): To bridge the gap between non-local hypergraph topology and local CNN features, the CCSI module leverages inter-channel attention to effectively inject reasoned global context into local features.
  • πŸ† State-of-the-Art Performance: S3H-Net has been extensively validated across five medical imaging modalities, consistently outperforming current SOTA methods in both accuracy and robustness.

πŸ—οΈ Framework Architecture

Framework Architecture
S3H-Net employs a dual-branch design, which parallels a standard CNN backbone with a Semantic Encoder based on HSSH blocks. The Semantic Encoder captures high-order semantic correlations, which are then hierarchically injected through the CCSI module to dynamically rectify local pixel-wise features.

πŸ“Š Results & Visualization

1. Quantitative Comparison

Qualitative Results

2. Qualitative Results

Qualitative Results
Qualitative comparison of our S3H-Net with other SOTA methods. Oversegmented areas are marked in red, and under-segmented areas are marked in green.

πŸ“¦ Dataset Preparation

1. Download Datasets

We conduct comprehensive experiments on six public datasets across five medical imaging modalities:

Dataset Modality Target Structure Samples Download
CVC-ClinicDB Endoscopy Polyp 612 Official Link
ETIS-LaribPolypDB Endoscopy Polyp 196 Kaggle
ISIC2018 Dermoscopy Skin Lesion 2,593 Official Link
USG Ultrasound Breast Cancer 252 Official Link
DSB2018 Microscopy Nuclei 670 Kaggle
PROMISE12 MRI Prostate 80 (2172 slices) Official Link

Tip

Download Propressed Data: You can also download the data files we have collected on Quark Cloud Drive (will be open after double-blind review). All you need to do is replace the datasets directory.

2. Directory Structure

Please arrange your project directory as follows:

Project_Root/
β”œβ”€β”€ datasets/
β”‚   β”œβ”€β”€ Dataset_A/
β”‚   β”‚   β”œβ”€β”€ images/       # Raw images (.tif, .png, etc.)
β”‚   β”‚   └── masks/        # Ground truth masks
β”‚   └── Dataset_B/
β”‚       β”œβ”€β”€ images/
β”‚       └── masks/
β”œβ”€β”€ configs/
β”‚	β”œβ”€β”€ default.yaml	  # Default setting of our model
β”‚	└── PROMISE_split.json
β”œβ”€β”€ checkpoints/          # Pre-trained weights
β”œβ”€β”€ runs/                 # Logging files
β”œβ”€β”€ outputs/			  # Output predictions
β”œβ”€β”€ src/                  # Source code
β”œβ”€β”€ requirements.txt
β”œβ”€β”€ test.py
└── train.py

Default Splitting Strategy: All datasets were split into Training, Validation, and Test sets with a ratio of 8:1:1, except for PROMISE12. For PROMISE12, we strictly adhered to the official challenge split provided in PROMISE_split.json.

Custom Splitting: If you wish to customize the data partitioning, simply create a JSON configuration file (e.g., my_split.json) with the following structure:

{
  "train": [
    "001.png",
    "002.png",
    "... (list all training filenames)"
  ],
  "val": [
    "009.png",
    "... (list all validation filenames)"
  ],
  "test": [
    "010.png",
    "... (list all test filenames)"
  ]
}

Then, specify this file in your configuration (default.yaml) or via command line arguments.

Warning

Filename Consistency: When using our code, the filename of the input image must exactly >match the filename of its corresponding ground truth mask.

  • βœ… Correct: images/001.png ↔ masks/001.png
  • ❌ Incorrect: images/001.png ↔ masks/001_mask.png

Mismatched filenames will result in data loading errors or incorrect pairing.

πŸ› οΈ Environment Setup

We recommend using Python 3.10+ and PyTorch 2.0+. Our implementation is built on PyTorch Lightning, a high-level framework that eliminates boilerplate code to let you focus on research logic while natively supporting scalable multi-GPU training and rigorous reproducibility.

# Step 1: Create a new isolated environment named 'S3H_Net' with Python 3.12
conda create -n S3H_Net python=3.12 -y

# Step 2: Activate the environment
conda activate S3H_Net

# Step 3: Install PyTorch & Lightning Core
# This ensures CUDA compatibility. Adjust 'cu118' based on your GPU driver.
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
pip install lightning==2.5

# Step 4: Install remaining project dependencies
pip install -r requirements.txt

Important

Reproducibility & Seed: All results in this work were generated using the random seed 3407. Our code defaults to this seed to ensure exact reproducibility of the reported metrics. If you modify the seed, slight performance variations may occur.

⚑ Quick Start

0. Parameter Configuration

Our project includes a comprehensive default configuration file: configs/default.yaml. It covers all essential settings, including:

  • 🎲 Random Seed (Default: 3407 for reproducibility)
  • πŸ“‚ Dataset Paths & Preprocessing parameters
  • πŸ—οΈ Model Architecture hyperparameters
  • πŸš€ Training Settings (optimizer, learning rate, epochs, early stopping)
  • πŸ“ Logging & Checkpoint saving paths

Note

Ready to Use: The provided default.yaml is pre-configured and ready for immediate execution. You can directly run the training scripts without modification unless you intend to customize specific hyperparameters or switch datasets.

1. Training

To train the model from scratch:

python train.py --config configs/default.yaml

Tip

Visualize Results: PyTorch Lightning integrate TensorBoard for logging. While training is running (or after), launch the dashboard with:

tensorboard --logdir=runs

Then visit http://localhost:6006 in your browser.

2. Evaluation / Inference

To evaluate the trained model:

python test.py --config configs/default.yaml --ckpt_path checkpoints/best.ckpt

Output Details:

  • πŸ–¨οΈ Metrics: Evaluation metrics (e.g., DSC, HD95) will be printed directly to the terminal.
  • πŸ–ΌοΈ Visualizations: Segmentation results for the test set will be saved automatically to the outputs/ directory.

πŸ™ Acknowledgements

This repo is based in part on the works of SSN-PyTorch, HGNN and ViHGNN for their open-source code. We thank the authors for their valuable contributions, which inspired and guided our implementation.

About

[MICCAI 2026] The official implementation of paper: "S3H-Net: Injecting Hybrid Semantic-Spatial Guidance via Superpixel Hypergraphs for Medical Image Segmentation"

Topics

Resources

License

Stars

1 star

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages