This repository is the official implementation of the paper: "Semi-Supervised Tooth Segmentation in Panoramic Radiographs using Boundary-Aware Curriculum Learning".
BACL is a novel semi-supervised learning framework designed to address the challenges of boundary ambiguity and label scarcity in dental panoramic radiographs (PAN). By integrating uncertainty-driven boundary supervision with a confidence-aware curriculum learning strategy, our method progressively learns from easy-to-hard samples, achieving state-of-the-art performance with limited annotations.
- [2025-11]: Code released. Includes the complete
CurriculumBatchSamplerand dual-decoder implementation.
- 📈 Progressive Curriculum Learning:
- Staged Training: Transitions smoothly from a fully supervised phase (Stage 1) to a semi-supervised regime (Stage 2) based on validation performance.
- Adaptive Sampling: Features a
CurriculumBatchSamplerthat dynamically selects unlabeled samples based on difficulty scores derived from tooth count and standard deviation.
- 🎯 Boundary-Aware Architecture:
- Dual-Decoder Design: A shared encoder with two specialized decoders—one for semantic segmentation and one for boundary detection.
- Uncertainty-Guided Supervision: Generates pseudo-boundary labels from the teacher model's uncertainty maps to refine edge fidelity.
- 🔗 Topological Consistency:
- Incorporates a connectivity loss to penalize disconnected components and internal holes, ensuring anatomically plausible segmentation.
The BACL framework consists of a Teacher-Student architecture utilizing a UNet backbone with a dual-decoder head.
- Supervised Phase: The model learns foundational features using labeled data with pixel-wise Cross-Entropy and Dice losses, plus explicit boundary supervision.
- Semi-Supervised Curriculum Phase: The model leverages unlabeled data via consistency regularization. A curriculum scheduler introduces harder samples (e.g., pediatric mixed dentition) only when the model is sufficiently confident.
- Linux or Windows
- Python 3.8+
- PyTorch 1.10+
- CUDA 11.0+
- Clone the repository:
git clone https://github.com/XinghaiLuo/BACL-Tooth-Segmentation.git cd BACL-Tooth-Segmentation - Install dependencies:
pip install -r requirements.txt
Please organize your dataset as follows. The project includes a preprocessing script to convert images and LabelMe JSON annotations into the required .npy format.
data/
└── preprocess/
├── label_image/ # Labeled images (.npy)
├── label_mask/ # Labeled masks (.npy, 53 channels: Background + 52 FDI teeth)
└── unlabel_image/ # Unlabeled images (.npy)
Preprocessing: To convert your raw data, run:
python utils/data_preprocess.pyThis script resizes images to [700, 360] and generates multi-channel masks.
To train the model using the curriculum strategy:
python trainer/curriculum_self_train.pyKey Configuration (config/curriculum_self_train.json):
"use_curriculum": Set totrueto enable the progressive learning strategy."stage1_performance_threshold":0.35(Dice score required to trigger the semi-supervised stage)."boundary_weight":0.1(Weight for the boundary supervision loss)."consistency_weight":0.1(Weight for the semi-supervised consistency loss).
Training logs and visualizations (segmentation masks, uncertainty maps, curriculum progress) are saved to the log/ directory. View them using TensorBoard:
tensorboard --logdir log/curriculum_self_trainWe achieved state-of-the-art performance on clinical dental datasets, significantly outperforming existing semi-supervised methods.
| Method | Image DSC | Instance DSC |
|---|---|---|
| UNet (Baseline) | xx% | xx% |
| Mean Teacher | xx% | xx% |
| CPS | xx% | xx% |
| BCP | xx% | xx% |
| BACL (Ours) | xx% | xx% |
BACL-Project/
├── config/ # Training configurations (JSON)
├── dataloader/
│ ├── tooth_loader_2d.py # Dataset loader & CurriculumBatchSampler
│ └── ...
├── model/
│ └── unet.py # UNetWithBoundary & GaussianSmoothing layers
├── trainer/
│ └── curriculum_self_train.py # Main training loop (Stage 1 -> Stage 2)
├── utils/
│ ├── losses.py # Dice, Connectivity, & Consistency losses
│ └── utils.py # Difficulty analysis & Metric calculations
└── full_project_code.txt
