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.1360 to 0.9368 (+0.8008).
  • Test Dice improved from 0.2394 to 0.9674 (+0.7280).
  • Hard test IoU improved from 0.1803 to 0.9393 (+0.7590).
  • Hard test Dice improved from 0.3055 to 0.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 IoU 0.0481 -> fine-tuned IoU 0.9751 (+0.9270).

Test Qualitative Comparison

Test Hard

  • Selection: top-improved, previews: 4
  • Representative sample ccfa01f0-1b0a-4a39-a1c9-9d5c883f3fb2: baseline IoU 0.0707 -> fine-tuned IoU 0.9546 (+0.8839).

Test Hard Qualitative Comparison

Bundle Contents

  • best.pt: inference checkpoint
  • config.json: training-time model config
  • training_run_summary.json: run summary and validation metrics
  • reports/*.json: hold-out test and baseline comparison reports when available
  • reports/mask_comparison/**: baseline vs fine-tuned qualitative comparison sheets and sample previews when available
  • docs/test_split_summary.json: hold-out split summary when available
  • inference.py: local / Hub inference example
  • requirements.txt: minimal runtime dependencies
  • hair_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 .jpg or .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 threshold 0.5.
  • Before making the repository public, verify whether your AIHub / K-Hairstyle data usage terms allow public redistribution of derived model weights.

Training Artifacts

Training Curve

Preview

Downloads last month
6
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support