{"id":13563652,"url":"https://github.com/ZPdesu/Barbershop","last_synced_at":"2025-04-03T20:31:32.738Z","repository":{"id":37921264,"uuid":"373140682","full_name":"ZPdesu/Barbershop","owner":"ZPdesu","description":"Barbershop: GAN-based Image Compositing using Segmentation Masks (SIGGRAPH Asia 2021)","archived":false,"fork":false,"pushed_at":"2023-06-25T17:53:30.000Z","size":87915,"stargazers_count":1394,"open_issues_count":62,"forks_count":275,"subscribers_count":63,"default_branch":"main","last_synced_at":"2025-04-01T14:17:00.098Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://zpdesu.github.io/Barbershop/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ZPdesu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2021-06-02T11:19:16.000Z","updated_at":"2025-03-31T08:16:15.000Z","dependencies_parsed_at":"2024-01-14T04:06:26.825Z","dependency_job_id":null,"html_url":"https://github.com/ZPdesu/Barbershop","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZPdesu%2FBarbershop","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZPdesu%2FBarbershop/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZPdesu%2FBarbershop/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZPdesu%2FBarbershop/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ZPdesu","download_url":"https://codeload.github.com/ZPdesu/Barbershop/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247074689,"owners_count":20879301,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T13:01:21.793Z","updated_at":"2025-04-03T20:31:32.728Z","avatar_url":"https://github.com/ZPdesu.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# Barbershop: GAN-based Image Compositing using Segmentation Masks\n![teaser](docs/assets/teaser.png)\n\n\u003e [**Barbershop: GAN-based Image Compositing using Segmentation Masks**](https://zpdesu.github.io/Barbershop/)\u003cbr/\u003e\n[Peihao Zhu](https://github.com/ZPdesu),\n[Rameen Abdal](https://github.com/RameenAbdal),\n[John Femiani](https://scholar.google.com/citations?user=rS1xJIIAAAAJ\u0026hl=en),\n[Peter Wonka](http://peterwonka.net/)\u003cbr/\u003e\n\n\n\u003e [arXiv](https://arxiv.org/abs/2106.01505) | [BibTeX](#bibtex) | [Project Page](https://zpdesu.github.io/Barbershop/) | [Video](https://youtu.be/ZU-yrAvoJfQ)\n\n\n\u003e **Abstract** Seamlessly blending features from multiple images is extremely challenging because of complex relationships in lighting, geometry, and partial occlusion which cause coupling between different parts of the image. Even though recent work on GANs enables synthesis of realistic hair or faces, it remains difficult to combine them into a single, coherent, and plausible image rather than a disjointed set of image patches. We present a novel solution to image blending, particularly for the problem of hairstyle transfer, based on GAN-inversion. We propose a novel latent space for image blending which is better at preserving detail and encoding spatial information, and propose a new GAN-embedding algorithm which is able to slightly modify images to conform to a common segmentation mask. Our novel representation enables the transfer of the visual properties from multiple reference images including specific details such as moles and wrinkles, and because we do image blending in a latent-space  we are able to synthesize images that are coherent. Our approach avoids blending artifacts present in other approaches and finds a globally consistent image. Our results demonstrate a significant improvement over the current state of the art in a user study, with users preferring our blending solution over 95 percent of the time.\n\n\n## Description\nOfficial Implementation of Barbershop. **KEEP UPDATING! Please Git Pull the latest version.**\n\n## Updates\n`2021/12/27` Add dilation and erosion parameters to smooth the boundary.\n\n#### `2021/12/24` Important Update: Add semantic mask inpainting module to solve the occlusion problem. Please git pull the latest version.\n\n`2021/12/18` Add a rough version of the project.\n\n`2021/06/02` Add project page.\n\n\n## Installation\n- Clone the repository:\n``` \ngit clone https://github.com/ZPdesu/Barbershop.git\ncd Barbershop\n```\n- Dependencies:  \nWe recommend running this repository using [Anaconda](https://docs.anaconda.com/anaconda/install/). \nAll dependencies for defining the environment are provided in `environment/environment.yaml`.\n\n\n## Download II2S images\nPlease download the [II2S](https://drive.google.com/drive/folders/15jsR9yy_pfDHiS9aE3HcYDgwtBbAneId?usp=sharing) \nand put them in the `input/face` folder.\n\n\n## Getting Started  \nPreprocess your own images. Please put the raw images in the `unprocessed` folder.\n```\npython align_face.py\n```\n\nProduce realistic results:\n```\npython main.py --im_path1 90.png --im_path2 15.png --im_path3 117.png --sign realistic --smooth 5\n```\n\nProduce results faithful to the masks:\n```\npython main.py --im_path1 90.png --im_path2 15.png --im_path3 117.png --sign fidelity --smooth 5\n```\n\n\n\n## Todo List\n* add a detailed readme\n* update mask inpainting code\n* integrate image encoder\n* add preprocessing step\n* ...\n\n## Acknowledgments\nThis code borrows heavily from [II2S](https://github.com/ZPdesu/II2S).\n\n## BibTeX\n\n```\n@misc{zhu2021barbershop,\n      title={Barbershop: GAN-based Image Compositing using Segmentation Masks},\n      author={Peihao Zhu and Rameen Abdal and John Femiani and Peter Wonka},\n      year={2021},\n      eprint={2106.01505},\n      archivePrefix={arXiv},\n      primaryClass={cs.CV}\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FZPdesu%2FBarbershop","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FZPdesu%2FBarbershop","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FZPdesu%2FBarbershop/lists"}