Update README.md
Browse files
    	
        README.md
    CHANGED
    
    | @@ -10,21 +10,22 @@ pipeline_tag: image-to-image | |
| 10 |  | 
| 11 | 
             
            <div align="center">
         | 
| 12 |  | 
| 13 | 
            -
            [**Project Page**](https://arc2face.github.io/) **|** [**Original Paper (ArXiv)**](https://arxiv.org/abs/2403.11641) **|** [**Expression Adapter Paper ( | 
| 14 |  | 
| 15 | 
             
            </div>
         | 
| 16 |  | 
| 17 | 
            -
            ## Introduction
         | 
| 18 | 
            -
             | 
| 19 | 
            -
            Arc2Face is an ID-conditioned face model, that can generate diverse, ID-consistent photos of a person given only its ArcFace ID-embedding.
         | 
| 20 | 
            -
            It is trained on a restored version of the WebFace42M face recognition database, and is further fine-tuned on FFHQ and CelebA-HQ.
         | 
| 21 |  | 
| 22 | 
            -
            Arc2Face has been extended with a fine-grained **Expression Adapter | 
| 23 |  | 
| 24 | 
             
            <div align="center">
         | 
| 25 | 
             
            <img src='https://huggingface.co/foivospar/Arc2Face/resolve/main/assets/exp_teaser.jpg'>
         | 
| 26 | 
             
            </div>
         | 
| 27 |  | 
|  | |
|  | |
|  | |
|  | |
|  | |
| 28 | 
             
            <div align="center">
         | 
| 29 | 
             
            <img src='https://huggingface.co/foivospar/Arc2Face/resolve/main/assets/samples_short.jpg'>
         | 
| 30 | 
             
            </div>
         | 
| @@ -47,7 +48,15 @@ We also provide a ControlNet model trained on top of Arc2Face for pose control. | |
| 47 | 
             
            <img src='https://huggingface.co/foivospar/Arc2Face/resolve/main/assets/controlnet_short.jpg'>
         | 
| 48 | 
             
            </div>
         | 
| 49 |  | 
| 50 | 
            -
            ##  | 
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
| 51 |  | 
| 52 | 
             
            The models can be downloaded directly from this repository or using python:
         | 
| 53 | 
             
            ```python
         | 
| @@ -61,9 +70,9 @@ hf_hub_download(repo_id="FoivosPar/Arc2Face", filename="controlnet/config.json", | |
| 61 | 
             
            hf_hub_download(repo_id="FoivosPar/Arc2Face", filename="controlnet/diffusion_pytorch_model.safetensors", local_dir="./models")
         | 
| 62 | 
             
            ```
         | 
| 63 |  | 
| 64 | 
            -
            Please check our [GitHub repository](https://github.com/foivospar/Arc2Face) for complete inference instructions.
         | 
| 65 |  | 
| 66 | 
            -
            ## Sample Usage with Diffusers
         | 
| 67 |  | 
| 68 | 
             
            To use the Arc2Face model with the `diffusers` library, first load the pipeline components:
         | 
| 69 |  | 
| @@ -83,7 +92,7 @@ import numpy as np | |
| 83 |  | 
| 84 | 
             
            # Arc2Face is built upon SD1.5
         | 
| 85 | 
             
            # The repo below can be used instead of the now deprecated 'runwayml/stable-diffusion-v1-5'
         | 
| 86 | 
            -
            base_model = ' | 
| 87 |  | 
| 88 | 
             
            encoder = CLIPTextModelWrapper.from_pretrained(
         | 
| 89 | 
             
                'models', subfolder="encoder", torch_dtype=torch.float16
         | 
| @@ -110,7 +119,7 @@ Then, pick an image to extract the ID-embedding and generate images: | |
| 110 | 
             
            app = FaceAnalysis(name='antelopev2', root='./', providers=['CUDAExecutionProvider', 'CPUExecutionProvider'])
         | 
| 111 | 
             
            app.prepare(ctx_id=0, det_size=(640, 640))
         | 
| 112 |  | 
| 113 | 
            -
            img = np.array(Image.open('https://huggingface.co/foivospar/Arc2Face/resolve/main/assets/examples/joacquin.png'))[:,:,::-1] | 
| 114 |  | 
| 115 | 
             
            faces = app.get(img)
         | 
| 116 | 
             
            faces = sorted(faces, key=lambda x:(x['bbox'][2]-x['bbox'][0])*(x['bbox'][3]-x['bbox'][1]))[-1]  # select largest face (if more than one detected)
         | 
|  | |
| 10 |  | 
| 11 | 
             
            <div align="center">
         | 
| 12 |  | 
| 13 | 
            +
            [**Project Page**](https://arc2face.github.io/) **|** [**Original Paper (ArXiv)**](https://arxiv.org/abs/2403.11641) **|** [**Expression Adapter Paper (ArXiv)**](http://arxiv.org/abs/2510.04706) **|** [**Code**](https://github.com/foivospar/Arc2Face) **|** [🤗 **Gradio demo**](https://huggingface.co/spaces/FoivosPar/Arc2Face)
         | 
| 14 |  | 
| 15 | 
             
            </div>
         | 
| 16 |  | 
|  | |
|  | |
|  | |
|  | |
| 17 |  | 
| 18 | 
            +
            🚀 **NEW (2025):** Arc2Face has been extended with a fine-grained **Expression Adapter** (see [below](#expression-adapter)), enabling the generation of any subject under any facial expression (even rare, asymmetric, subtle, or extreme ones). This extension is detailed in the paper [ID-Consistent, Precise Expression Generation with Blendshape-Guided Diffusion](http://arxiv.org/abs/2510.04706).
         | 
| 19 |  | 
| 20 | 
             
            <div align="center">
         | 
| 21 | 
             
            <img src='https://huggingface.co/foivospar/Arc2Face/resolve/main/assets/exp_teaser.jpg'>
         | 
| 22 | 
             
            </div>
         | 
| 23 |  | 
| 24 | 
            +
            ## Introduction
         | 
| 25 | 
            +
             | 
| 26 | 
            +
            Originally, Arc2Face is an ID-conditioned face model designed to generate diverse, ID-consistent photos of a person given only its ArcFace ID-embedding.
         | 
| 27 | 
            +
            It is trained on a restored version of the WebFace42M face recognition database, and is further fine-tuned on FFHQ and CelebA-HQ.
         | 
| 28 | 
            +
             | 
| 29 | 
             
            <div align="center">
         | 
| 30 | 
             
            <img src='https://huggingface.co/foivospar/Arc2Face/resolve/main/assets/samples_short.jpg'>
         | 
| 31 | 
             
            </div>
         | 
|  | |
| 48 | 
             
            <img src='https://huggingface.co/foivospar/Arc2Face/resolve/main/assets/controlnet_short.jpg'>
         | 
| 49 | 
             
            </div>
         | 
| 50 |  | 
| 51 | 
            +
            ## Expression Adapter
         | 
| 52 | 
            +
             | 
| 53 | 
            +
            Our [extension]((http://arxiv.org/abs/2510.04706)) combines Arc2Face with a custom IP-Adapter designed for generating ID-consistent images with precise expression control based on FLAME blendshape parameters. We also provide an optional Reference Adapter which can be used to condition the output directly on the input image, i.e. preserving the subject's appearance and background (to an extent). You can find more details in the report.
         | 
| 54 | 
            +
             | 
| 55 | 
            +
            <div align="center">
         | 
| 56 | 
            +
            <img src='https://huggingface.co/foivospar/Arc2Face/resolve/main/assets/arc2face_exp.jpg'>
         | 
| 57 | 
            +
            </div>
         | 
| 58 | 
            +
             | 
| 59 | 
            +
            ## Download Core Models (Arc2Face)
         | 
| 60 |  | 
| 61 | 
             
            The models can be downloaded directly from this repository or using python:
         | 
| 62 | 
             
            ```python
         | 
|  | |
| 70 | 
             
            hf_hub_download(repo_id="FoivosPar/Arc2Face", filename="controlnet/diffusion_pytorch_model.safetensors", local_dir="./models")
         | 
| 71 | 
             
            ```
         | 
| 72 |  | 
| 73 | 
            +
            Please check our [GitHub repository](https://github.com/foivospar/Arc2Face) for complete inference instructions on ControlNet and the Expression Adapter.
         | 
| 74 |  | 
| 75 | 
            +
            ## Sample Usage with Diffusers (core model)
         | 
| 76 |  | 
| 77 | 
             
            To use the Arc2Face model with the `diffusers` library, first load the pipeline components:
         | 
| 78 |  | 
|  | |
| 92 |  | 
| 93 | 
             
            # Arc2Face is built upon SD1.5
         | 
| 94 | 
             
            # The repo below can be used instead of the now deprecated 'runwayml/stable-diffusion-v1-5'
         | 
| 95 | 
            +
            base_model = 'stable-diffusion-v1-5/stable-diffusion-v1-5'
         | 
| 96 |  | 
| 97 | 
             
            encoder = CLIPTextModelWrapper.from_pretrained(
         | 
| 98 | 
             
                'models', subfolder="encoder", torch_dtype=torch.float16
         | 
|  | |
| 119 | 
             
            app = FaceAnalysis(name='antelopev2', root='./', providers=['CUDAExecutionProvider', 'CPUExecutionProvider'])
         | 
| 120 | 
             
            app.prepare(ctx_id=0, det_size=(640, 640))
         | 
| 121 |  | 
| 122 | 
            +
            img = np.array(Image.open('https://huggingface.co/foivospar/Arc2Face/resolve/main/assets/examples/joacquin.png'))[:,:,::-1]
         | 
| 123 |  | 
| 124 | 
             
            faces = app.get(img)
         | 
| 125 | 
             
            faces = sorted(faces, key=lambda x:(x['bbox'][2]-x['bbox'][0])*(x['bbox'][3]-x['bbox'][1]))[-1]  # select largest face (if more than one detected)
         |