--- library_name: pytorch pipeline_tag: image-segmentation tags: - pytorch - image-segmentation - hair-segmentation - segface - korean-hairstyle - custom-code language: - ko --- # SegFace_k-hair 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 These are validation metrics from the training run. A separate independent hold-out test split has not been populated yet, so treat these as validation-only results. | 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 | ## Bundle Contents - `best.pt`: inference checkpoint - `config.json`: training-time model config - `training_run_summary.json`: run summary and validation metrics - `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: ```bash 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: ```bash python inference.py --repo-id your-username/SegFace_k-hair --input path/to/input.jpg --output-mask output_mask.png --output-overlay output_overlay.png ``` ## 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](assets/training_curves.png) ![Preview](assets/epoch_010.png)