ScalpVision: U²-Net Pseudo Hair Segmentation Weights
⚠️ These are the weights for the pseudo hair segmentation model ($\text{U}^{2}$-Net), i.e. the stage before SAM is applied. The outputs of this model are the pseudo labels $\hat{M}$, which are then refined with SAM (
sam_guide.py→sam_predict.py→make_final_mask.py) to obtain the final hair masks $M$. This checkpoint alone does not produce the final SAM-refined masks.
This checkpoint belongs to ScalpVision: Scalp Diagnostic System With Label-Free Segmentation and Training-Free Image Translation (MICCAI 2025).
- 💻 Code (required): https://github.com/winston1214/ScalpVision
- 📄 Paper: arXiv:2406.17254
- 🌐 Project page: https://0110tpwls.github.io/scalpvision25/
How to use
This weight must be used with the $\text{U}^{2}$-Net code in the ScalpVision GitHub repository — specifically the segmentation/ part:
| File | Role |
|---|---|
segmentation/model/u2net.py | $\text{U}^{2}$-Net model definition (U2NET(3, 1)) |
segmentation/u2net_test.py | Inference with this weight → pseudo segmentation labels $\hat{M}$ |
segmentation/u2net_train.py | Training script that produced this weight |
- Clone the repository and download the weight:
git clone https://github.com/winston1214/ScalpVision.git
cd ScalpVision/segmentation
huggingface-cli download winston1214/scalpvision_hair_segmentation u2net_tar_min.pth --local-dir saved_models/new_seg_ckpt
- In
segmentation/u2net_test.py, setmodel_dirto the downloaded file (e.g.saved_models/new_seg_ckpt/u2net_tar_min.pth) and setimage_dir/prediction_dirfor your workspace, then run:
python u2net_test.py
Loading it manually:
import torch
from model import U2NET # from ScalpVision/segmentation/model
net = U2NET(3, 1)
net.load_state_dict(torch.load("u2net_tar_min.pth", map_location="cpu"))
net.eval()
- To get the final masks, continue with the SAM stage in the repository (
sam_guide.py→sam_predict.py→make_final_mask.py).
Model details
- Architecture: $\text{U}^{2}$-Net (full size,
U2NET(3, 1), ~173.6 MB) - Input: RGB scalp image, rescaled to 320×320 (
RescaleT(320),ToTensorLab(flag=0)) - Output: hair probability map (first output
d1, min-max normalized) - Checkpoint:
u2net_tar_min.pth, the checkpoint with the minimum target loss - Data: AI-Hub scalp image dataset
Citation
@InProceedings{KimYou_Scalp_MICCAI2025,
author = { Kim, Youngmin and Kim, Saejin and Moon, Hoyeon and Yu, Youngjae and Noh, Junhyug},
title = { { Scalp Diagnostic System With Label-Free Segmentation and Training-Free Image Translation } },
booktitle = {proceedings of Medical Image Computing and Computer Assisted Intervention -- MICCAI 2025},
year = {2025},
publisher = {Springer Nature Switzerland},
volume = {LNCS 15967},
month = {September},
}
@article{qin2020u2,
title={U2-Net: Going deeper with nested U-structure for salient object detection},
author={Qin, Xuebin and Zhang, Zichen and Huang, Chenyang and Dehghan, Masood and Zaiane, Osmar R and Jagersand, Martin},
journal={Pattern recognition},
volume={106},
pages={107404},
year={2020},
publisher={Elsevier}
}