This is our official implementation of S⁴M!
[arXiv] [Project]
by Heeji Yoon*, Heeseong Shin*, Eunbeen Hong, Hyunwook Choi, Hansang Cho, Daun Chung, Seungryong Kim†
We propose S⁴M, a semi-supervised instance segmentation framework that effectively leverages capabilities of Segment Anything Model (SAM) through three key components: structural distillation, pseudo-label refinement, and specialized data augmentation.
Please follow installation.
Please follow dataset preperation.
Training is split into two consecutive steps. We provide shell scripts for each stage:
train_teacher.sh: Pre-train the teacher modeltrain_student.sh: Train the semi-supervised student model. Please note that this stage requires a minimum of 2 GPUs.
# First train teacher model
bash ./scripts/cityscapes/train_teacher.sh [NUM_GPUS] [PERCENTAGE]
# After completing pre-training teacher model, train student model
bash ./scripts/cityscapes/train_student.sh [NUM_GPUS] [PERCENTAGE] [TEACHER_CKPT]
# evaluation
bash ./scripts/cityscapes/val.sh [NUM_GPUS] [TEACHER_CKPT] SSL.TRAIN_SSL False SSL.EVAL_WHO TEACHER
bash ./scripts/cityscapes/val.sh [NUM_GPUS] [STUDENT_CKPT] SSL.TRAIN_SSL True SSL.EVAL_WHO STUDENTWe want to note that, in case the of Cityscapes, teacher pre-training is configured to run on 2× RTX 3090 GPUs, and semi-supervised student training is configured to run on 4× RTX 3090 GPUs by default.
bash ./scripts/coco/train_teacher.sh [NUM_GPUS] [PERCENTAGE]
# After completing pre-training teacher model, train student model
bash ./scripts/coco/train_student.sh [NUM_GPUS] [PERCENTAGE] [TEACHER_CKPT]
# evaluation
bash ./scripts/coco/val.sh [NUM_GPUS] [TEACHER_CKPT] SSL.TRAIN_SSL False SSL.EVAL_WHO TEACHER
bash ./scripts/coco/val.sh [NUM_GPUS] [STUDENT_CKPT] SSL.TRAIN_SSL True SSL.EVAL_WHO STUDENTFor the COCO dataset, teacher pre-training is configured to run on 2× RTX A6000 GPUs, and semi-supervised student training is configured to run on 4× RTX A6000 GPUs by default.
We provide pre-trained teacher and student model checkpoints for Cityscapes and COCO.
| Model | 5% | 10% | 20% | 30% | Download |
|---|---|---|---|---|---|
| Teacher | 17.2 | 22.5 | 29.6 | 31.9 | link |
| Student | 30.1 | 33.3 | 37.2 | 37.7 | link |
| Model | 1% | 2% | 5% | 10% | Download |
|---|---|---|---|---|---|
| Teacher | 15.1 | 20.3 | 26.1 | 30.3 | link |
| Student | 24.2 | 28.1 | 32.0 | 34.6 | link |
Code is largely based on GuidedDistillation and SAM2. We sincerely thank the original authors for their invaluable work and contributions!
If you find this research useful, please consider citing:
@misc{yoon2025s4mboostingsemisupervisedinstance,
title={S^4M: Boosting Semi-Supervised Instance Segmentation with SAM},
author={Heeji Yoon and Heeseong Shin and Eunbeen Hong and Hyunwook Choi and Hansang Cho and Daun Jeong and Seungryong Kim},
year={2025},
eprint={2504.05301},
archivePrefix={arXiv},
primaryClass={cs.CV},
url={https://arxiv.org/abs/2504.05301},
}