{"about":{"site":"https://codewithpapers.app","non_affiliation":"Code with Papers and Syntology are not affiliated with, endorsed by, or sponsored by Papers with Code, Meta, or the pwc-archive mirror.","licence":"CC BY-SA 4.0","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","attribution":"https://codewithpapers.app/attribution","modified":"archive material modified by Syntology; see the attribution page"},"url":"/paper/stable-hair-real-world-hair-transfer-via","title":"Stable-Hair: Real-World Hair Transfer via Diffusion Model","arxiv_id":"2407.14078","date":"2024-07-19","proceeding":null,"authors":["Yuxuan Zhang","Qing Zhang","Yiren Song","Jichao Zhang","Hao Tang","Jiaming Liu"],"abstract":"Current hair transfer methods struggle to handle diverse and intricate hairstyles, limiting their applicability in real-world scenarios. In this paper, we propose a novel diffusion-based hair transfer framework, named \\textit{Stable-Hair}, which robustly transfers a wide range of real-world hairstyles to user-provided faces for virtual hair try-on. To achieve this goal, our Stable-Hair framework is designed as a two-stage pipeline. In the first stage, we train a Bald Converter alongside stable diffusion to remove hair from the user-provided face images, resulting in bald images. In the second stage, we specifically designed a Hair Extractor and a Latent IdentityNet to transfer the target hairstyle with highly detailed and high-fidelity to the bald image. The Hair Extractor is trained to encode reference images with the desired hairstyles, while the Latent IdentityNet ensures consistency in identity and background. To minimize color deviations between source images and transfer results, we introduce a novel Latent ControlNet architecture, which functions as both the Bald Converter and Latent IdentityNet. After training on our curated triplet dataset, our method accurately transfers highly detailed and high-fidelity hairstyles to the source images. Extensive experiments demonstrate that our approach achieves state-of-the-art performance compared to existing hair transfer methods. Project page: \\textcolor{red}{\\url{https://xiaojiu-z.github.io/Stable-Hair.github.io/}}","url_abs":"https://arxiv.org/abs/2407.14078v2","url_pdf":"https://arxiv.org/pdf/2407.14078v2.pdf","source":{"archive":"pwc-archive (Hugging Face), CC BY-SA 4.0","snapshot":"2025-07-28","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","row_kind":"abstracts"},"code_links":[{"paper_slug":"stable-hair-real-world-hair-transfer-via","repo_url":"https://github.com/Xiaojiu-z/Stable-Hair","is_official":1,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"jax","reach":{"status":"ok","spdx":"Apache-2.0"}}],"tasks":[{"task_slug":null,"task_name":"Triplet"}],"methods":[{"method_slug":"concatenated-skip-connection","method_name":"Concatenated Skip Connection"},{"method_slug":"convolution","method_name":"Convolution"},{"method_slug":"diffusion","method_name":"Diffusion"},{"method_slug":"max-pooling","method_name":"Max Pooling"},{"method_slug":"relu","method_name":"ReLU"},{"method_slug":"u-net","method_name":"U-Net"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"syntology_url":"https://syntology.ai/paper/2407.14078","atlas_url":"https://app.syntology.ai/?focus=2407.14078","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2407.14078"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-25T09:33:49+00:00","read_at_is":"when the build read Syntology's graph, not when any sample ran","claim":"Per-sample execution status on synthesized fixtures; not a correctness claim about the paper. Samples come from repositories linked to the paper, official or community; repo_kind says which.","repos":[{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/Xiaojiu-z/Stable-Hair","reach":{"status":"ok","spdx":"Apache-2.0"}}],"summary":{"ran":2,"ran_violates":1,"unverified":9},"by_repo_kind":{"official":{"samples":12,"ran":3,"repositories":1}},"repo_kind_vocabulary":{"official":"The archive marks this repository official for the paper","named_in_paper":"The archive records that the paper mentions this repository; it is not marked official","listed":"In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper","found_in_text":"Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted","community":"Not in the archive's code links for this paper; a community repository Syntology harvested"},"n_pointer_only_for_licence":0,"samples":[{"code_sha256_prefix":"149188d4856b3bdc","entry":"compute_noise","repo":"Xiaojiu-z/Stable-Hair","repo_kind":"official","path":"diffusers/pipelines/stable_diffusion/pipeline_cycle_diffusion.py","file_url":"https://github.com/Xiaojiu-z/Stable-Hair/blob/HEAD/diffusers/pipelines/stable_diffusion/pipeline_cycle_diffusion.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"149188d4856b3bdc"}},{"code_sha256_prefix":"291c31214008a679","entry":"preprocess_mask","repo":"Xiaojiu-z/Stable-Hair","repo_kind":"official","path":"diffusers/pipelines/stable_diffusion/pipeline_flax_stable_diffusion_inpaint.py","file_url":"https://github.com/Xiaojiu-z/Stable-Hair/blob/HEAD/diffusers/pipelines/stable_diffusion/pipeline_flax_stable_diffusion_inpaint.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"291c31214008a679"}},{"code_sha256_prefix":"e75e95456d9039f5","entry":"unshard","repo":"Xiaojiu-z/Stable-Hair","repo_kind":"official","path":"diffusers/pipelines/stable_diffusion/pipeline_flax_stable_diffusion.py","file_url":"https://github.com/Xiaojiu-z/Stable-Hair/blob/HEAD/diffusers/pipelines/stable_diffusion/pipeline_flax_stable_diffusion.py","link_basis":"plan_row","language":"python","status":"ran_violates","verification_level":1,"contract_check":"VIOLATES","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"e75e95456d9039f5"}},{"code_sha256_prefix":"d3de8e0f9e293d59","entry":"posterior_sample","repo":"Xiaojiu-z/Stable-Hair","repo_kind":"official","path":"diffusers/pipelines/stable_diffusion/pipeline_cycle_diffusion.py","file_url":"https://github.com/Xiaojiu-z/Stable-Hair/blob/HEAD/diffusers/pipelines/stable_diffusion/pipeline_cycle_diffusion.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"d3de8e0f9e293d59"}},{"code_sha256_prefix":"d4431fe56ad7f713","entry":"prepare_mask_and_masked_image","repo":"Xiaojiu-z/Stable-Hair","repo_kind":"official","path":"diffusers/pipelines/stable_diffusion/pipeline_onnx_stable_diffusion_inpaint.py","file_url":"https://github.com/Xiaojiu-z/Stable-Hair/blob/HEAD/diffusers/pipelines/stable_diffusion/pipeline_onnx_stable_diffusion_inpaint.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"d4431fe56ad7f713"}},{"code_sha256_prefix":"107a1125408a883b","entry":"preprocess","repo":"Xiaojiu-z/Stable-Hair","repo_kind":"official","path":"diffusers/pipelines/stable_diffusion/pipeline_cycle_diffusion.py","file_url":"https://github.com/Xiaojiu-z/Stable-Hair/blob/HEAD/diffusers/pipelines/stable_diffusion/pipeline_cycle_diffusion.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"107a1125408a883b"}},{"code_sha256_prefix":"186d422b4922bcc8","entry":"preprocess","repo":"Xiaojiu-z/Stable-Hair","repo_kind":"official","path":"diffusers/pipelines/stable_diffusion/pipeline_flax_stable_diffusion_img2img.py","file_url":"https://github.com/Xiaojiu-z/Stable-Hair/blob/HEAD/diffusers/pipelines/stable_diffusion/pipeline_flax_stable_diffusion_img2img.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"186d422b4922bcc8"}},{"code_sha256_prefix":"a4ae6b8026b63031","entry":"preprocess","repo":"Xiaojiu-z/Stable-Hair","repo_kind":"official","path":"diffusers/pipelines/stable_diffusion/pipeline_onnx_stable_diffusion_img2img.py","file_url":"https://github.com/Xiaojiu-z/Stable-Hair/blob/HEAD/diffusers/pipelines/stable_diffusion/pipeline_onnx_stable_diffusion_img2img.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"a4ae6b8026b63031"}},{"code_sha256_prefix":"90abefb63ec10393","entry":"preprocess_image","repo":"Xiaojiu-z/Stable-Hair","repo_kind":"official","path":"diffusers/pipelines/stable_diffusion/pipeline_flax_stable_diffusion_inpaint.py","file_url":"https://github.com/Xiaojiu-z/Stable-Hair/blob/HEAD/diffusers/pipelines/stable_diffusion/pipeline_flax_stable_diffusion_inpaint.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"90abefb63ec10393"}},{"code_sha256_prefix":"dfb052a0af48540f","entry":"renew_resnet_paths","repo":"Xiaojiu-z/Stable-Hair","repo_kind":"official","path":"diffusers/pipelines/stable_diffusion/convert_from_ckpt.py","file_url":"https://github.com/Xiaojiu-z/Stable-Hair/blob/HEAD/diffusers/pipelines/stable_diffusion/convert_from_ckpt.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"dfb052a0af48540f"}},{"code_sha256_prefix":"c5ec9c13e456a046","entry":"renew_vae_resnet_paths","repo":"Xiaojiu-z/Stable-Hair","repo_kind":"official","path":"diffusers/pipelines/stable_diffusion/convert_from_ckpt.py","file_url":"https://github.com/Xiaojiu-z/Stable-Hair/blob/HEAD/diffusers/pipelines/stable_diffusion/convert_from_ckpt.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"c5ec9c13e456a046"}},{"code_sha256_prefix":"cea0bc82e0c96896","entry":"shave_segments","repo":"Xiaojiu-z/Stable-Hair","repo_kind":"official","path":"diffusers/pipelines/stable_diffusion/convert_from_ckpt.py","file_url":"https://github.com/Xiaojiu-z/Stable-Hair/blob/HEAD/diffusers/pipelines/stable_diffusion/convert_from_ckpt.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"cea0bc82e0c96896"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}