segface_hair_khairstyle
Personal Hugging Face model repository for a custom PyTorch hair-only segmentation checkpoint trained on a K-Hairstyle based AIHub subset.
Model Summary
- Backbone:
swin_base - Input size:
512x512 - Freeze backbone:
True - LoRA:
rank=8,alpha=16.0,dropout=0.05 - Threshold used during validation:
0.5 - Train / Val split used for this run:
50,000/5,000
Validation Metrics
Validation metrics are recorded during training. Additional hold-out test metrics are listed below when available.
| Metric | Value |
|---|---|
| Best epoch | 7 |
| Val IoU | 0.9487 |
| Val Dice | 0.9736 |
| Val Precision | 0.9723 |
| Val Recall | 0.9751 |
| Epochs completed | 10 |
| Avg epoch time (sec) | 3546.45 |
Hold-out Test Metrics
| Split | IoU | Dice | Precision | Recall |
|---|---|---|---|---|
| Fine-tuned test | 0.9368 | 0.9674 | 0.9651 | 0.9697 |
| Fine-tuned test_hard | 0.9393 | 0.9687 | 0.9663 | 0.9711 |
| Baseline SegFace test | 0.1360 | 0.2394 | 0.1360 | 1.0000 |
| Baseline SegFace test_hard | 0.1803 | 0.3055 | 0.1803 | 1.0000 |
Comparison Notes
- Test IoU improved from
0.1360to0.9368(+0.8008). - Test Dice improved from
0.2394to0.9674(+0.7280). - Hard test IoU improved from
0.1803to0.9393(+0.7590). - Hard test Dice improved from
0.3055to0.9687(+0.6632). - The pretrained baseline tended to over-predict hair regions, showing high recall but very low precision.
Test Split Summary
- train / val / test / test_hard:
50,000/5,000/921/150 - source overlap train-test:
0 - source overlap val-test:
0
Qualitative Comparison
Test
- Selection:
top-improved, previews:12 - Representative sample
ad5c2098-485e-48d7-979b-6190bb01e7a2: baseline IoU0.0481-> fine-tuned IoU0.9751(+0.9270).
Test Hard
- Selection:
top-improved, previews:4 - Representative sample
ccfa01f0-1b0a-4a39-a1c9-9d5c883f3fb2: baseline IoU0.0707-> fine-tuned IoU0.9546(+0.8839).
Bundle Contents
best.pt: inference checkpointconfig.json: training-time model configtraining_run_summary.json: run summary and validation metricsreports/*.json: hold-out test and baseline comparison reports when availablereports/mask_comparison/**: baseline vs fine-tuned qualitative comparison sheets and sample previews when availabledocs/test_split_summary.json: hold-out split summary when availableinference.py: local / Hub inference examplerequirements.txt: minimal runtime dependencieshair_mask_dataset/,models/: custom model code required to load the checkpoint
Inference
Run locally from the root of this model bundle:
python -m pip install -r requirements.txt
python inference.py --checkpoint best.pt --input path/to/input.jpg --output-mask output_mask.png --output-overlay output_overlay.png
You can also load directly from the Hugging Face Hub after uploading:
python -m pip install -r requirements.txt
python inference.py --repo-id siik/segface_hair_khairstyle --input path/to/input.jpg --output-mask output_mask.png --output-overlay output_overlay.png
Inputs and Outputs
- Input: RGB portrait image file such as
.jpgor.png - Output mask: single-channel binary hair mask PNG
- Output overlay: optional RGB overlay image for quick visual inspection
Notes
- This repo contains custom code and a raw PyTorch checkpoint, not a Transformers-format model.
- Preprocessing expects RGB input, resize to
512, ImageNet normalization, and sigmoid threshold0.5. - Before making the repository public, verify whether your AIHub / K-Hairstyle data usage terms allow public redistribution of derived model weights.
Training Artifacts
- Downloads last month
- 6



