<p align="center">
<br>
<img src="https://modelscope.oss-cn-beijing.aliyuncs.com/modelscope.gif" width="400"/>
<br>
<h1>FaceChain</h1>
<p>
# Introduction
å¦ææ¨çæä¸æï¼å¯ä»¥é
读[ä¸æçæ¬çREADME](./README_ZH.md)ã
FaceChain is a deep-learning toolchain for generating your Digital-Twin. With a minimum of 1 portrait-photo, you can create a Digital-Twin of your own and start generating personal portraits in different settings (multiple styles now supported!). You may train your Digital-Twin model and generate photos via FaceChain's Python scripts, or via the familiar Gradio interface.
FaceChain is powered by [ModelScope](https://github.com/modelscope/modelscope).
<p align="center">
ModelScope Studio <a href="https://modelscope.cn/studios/CVstudio/cv_human_portrait/summary">ð¤<a></a>  ï½ HuggingFace Space <a href="https://huggingface.co/spaces/modelscope/FaceChain">ð¤</a> 
</p>
<br>
![image](resources/git_cover.jpg)
# News
- High performance inpainting for single & double person, Simplify User Interface. (September 09th, 2023 UTC)
- More Technology Details can be seen in [Paper](https://arxiv.org/abs/2308.14256). (August 30th, 2023 UTC)
- Add validate & ensemble for Lora training, and InpaintTab(hide in gradio for now). (August 28th, 2023 UTC)
- Add pose control module. (August 27th, 2023 UTC)
- Add robust face lora training module, enhance the performance of one pic training & style-lora blending. (August 27th, 2023 UTC)
- HuggingFace Space is available now! You can experience FaceChain directly with <a href="https://huggingface.co/spaces/modelscope/FaceChain">ð¤</a> (August 25th, 2023 UTC)
- Add awesome prompts! Refer to: [awesome-prompts-facechain](resources/awesome-prompts-facechain.txt) (August 18th, 2023 UTC)
- Support a series of new style models in a plug-and-play fashion. (August 16th, 2023 UTC)
- Support customizable prompts. (August 16th, 2023 UTC)
- Colab notebook is available now! You can experience FaceChain directly with [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/modelscope/facechain/blob/main/facechain_demo.ipynb). (August 15th, 2023 UTC)
# To-Do List
- Support more style models (such as those on Civitai). --on-going, hot
- Support more beauty-retouch effects
- Support latest foundation models such as SDXL
- Support high resolution
- Support group photo scenario, e.g, multi-person
- Provide more funny apps
# Citation
Please cite FaceChain in your publications if it helps your research
```
@article{liu2023facechain,
title={FaceChain: A Playground for Identity-Preserving Portrait Generation},
author={Liu, Yang and Yu, Cheng and Shang, Lei and Wu, Ziheng and
Wang, Xingjun and Zhao, Yuze and Zhu, Lin and Cheng, Chen and
Chen, Weitao and Xu, Chao and Xie, Haoyu and Yao, Yuan and
Zhou, Wenmeng and Chen Yingda and Xie, Xuansong and Sun, Baigui},
journal={arXiv preprint arXiv:2308.14256},
year={2023}
}
```
# Installation
## Compatibility Verification
We have verified e2e execution on the following environment:
- python: py3.8, py3.10
- pytorch: torch2.0.0, torch2.0.1
- tensorflow: 2.8.0, tensorflow-cpu
- CUDA: 11.7
- CUDNN: 8+
- OS: Ubuntu 20.04, CentOS 7.9
- GPU: Nvidia-A10 24G
## Resource Requirement
- GPU: About 19G
- Disk: About 50GB
## Installation Guide
The following installation methods are supported:
### 1. ModelScope notebookãrecommendedã
The ModelScope Notebook offers a free-tier that allows ModelScope user to run the FaceChain application with minimum setup, refer to [ModelScope Notebook](https://modelscope.cn/my/mynotebook/preset)
```shell
# Step1: æçnotebook -> PAI-DSW -> GPUç¯å¢
# Step2: Entry the Notebook cellï¼clone FaceChain from github:
!GIT_LFS_SKIP_SMUDGE=1 git clone https://github.com/modelscope/facechain.git --depth 1
# Step3: Change the working directory to facechain:
import os
os.chdir('/mnt/workspace/facechain') # You may change to your own path
print(os.getcwd())
!pip3 install gradio
!pip3 install controlnet_aux==0.0.6
!pip3 install python-slugify
!python3 app.py
# Step4: click "public URL" or "local URL", upload your images to
# train your own model and then generate your digital twin.
```
Alternatively, you may also purchase a [PAI-DSW](https://www.aliyun.com/activity/bigdata/pai/dsw) instance (using A10 resource), with the option of ModelScope image to run FaceChain following similar steps.
### 2. Docker
If you are familiar with using docker, we recommend to use this way:
```shell
# Step1: Prepare the environment with GPU on local or cloud, we recommend to use Alibaba Cloud ECS, refer to: https://www.aliyun.com/product/ecs
# Step2: Download the docker image (for installing docker engine, refer to https://docs.docker.com/engine/install/ï¼
docker pull registry.cn-hangzhou.aliyuncs.com/modelscope-repo/modelscope:ubuntu20.04-cuda11.7.1-py38-torch2.0.1-tf1.15.5-1.8.0
# Step3: run the docker container
docker run -it --name facechain -p 7860:7860 --gpus all registry.cn-hangzhou.aliyuncs.com/modelscope-repo/modelscope:ubuntu20.04-cuda11.7.1-py38-torch2.0.1-tf1.15.5-1.8.0 /bin/bash
(Note: you may need to install the nvidia-container-runtime, refer to https://github.com/NVIDIA/nvidia-container-runtime)
# Step4: Install the gradio in the docker container:
pip3 install gradio
pip3 install controlnet_aux==0.0.6
pip3 install python-slugify
# Step5 clone facechain from github
GIT_LFS_SKIP_SMUDGE=1 git clone https://github.com/modelscope/facechain.git --depth 1
cd facechain
python3 app.py
# Note: FaceChain currently assume single-GPU, if your environment has multiple GPU, please use the following instead:
# CUDA_VISIBLE_DEVICES=0 python3 app.py
# Step6
Run the app server: click "public URL" --> in the form of: https://xxx.gradio.live
```
### 3. Conda Virtual Environment
Use the conda virtual environment, and refer to [Anaconda](https://docs.anaconda.com/anaconda/install/) to manage your dependencies. After installation, execute the following commands:
(Note: mmcv has strict environment requirements and might not be compatible in some cases. It's recommended to use Docker.)
```shell
conda create -n facechain python=3.8 # Verified environments: 3.8 and 3.10
conda activate facechain
GIT_LFS_SKIP_SMUDGE=1 git clone https://github.com/modelscope/facechain.git --depth 1
cd facechain
pip3 install -r requirements.txt
pip3 install -U openmim
mim install mmcv-full==1.7.0
# Navigate to the facechain directory and run:
python3 app.py
# Note: FaceChain currently assume single-GPU, if your environment has multiple GPU, please use the following instead:
# CUDA_VISIBLE_DEVICES=0 python3 app.py
# Finally, click on the URL generated in the log to access the web page.
```
**Note**: After the app service is successfully launched, go to the URL in the log, enter the "Image Customization" tab, click "Select Image to Upload", and choose at least one image with a face. Then, click "Start Training" to begin model training. After the training is completed, there will be corresponding displays in the log. Afterwards, switch to the "Image Experience" tab and click "Start Inference" to generate your own digital image.
*Note* For windows user, you should pay attention to following steps:
```shell
1. reinstall package pytorch and numpy compatible with tensorflow
2. install mmcv-full by pip: pip3 install mmcv-full
```
**If you want to use the `Audio Driven Talking Head` tab, please refer to the installation guide in [installation_for_talkinghead](doc/installation_for_talkinghead.md).**
### 4. Colab notebook
| Colab | Info
| --- | --- |
[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/modelscope/facechain/blob/main/facechain_demo.ipynb) | FaceChain Installation on Colab
# Script Execution
FaceChain supports direct training and inf
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
FaceChain是一个可以用来打造个人数字形象的深度学习模型工具。用户仅需要提供最低一张照片即可获得独属于自己的个人形象数字替身。FaceChain支持在gradio的界面中使用模型训练和推理能力,也支持资深开发者使用python脚本进行训练推理
资源推荐
资源详情
资源评论
收起资源包目录
深度学习工具链:facechain (204个子文件)
.gitattributes 50B
.gitignore 1KB
facechain_demo.ipynb 4KB
git_cover_CH.jpg 995KB
git_cover.jpg 988KB
git_cover_1.jpg 456KB
git_cover_2.jpg 364KB
4.jpg 152KB
5.jpg 135KB
3.jpg 108KB
1.jpg 96KB
2.jpg 88KB
Christmas.jpg 68KB
Traditional_chinese_style.jpg 68KB
Underwater.jpg 65KB
Zhuang_style.jpg 64KB
Wedding_dress_2.jpg 64KB
Rainy_night.jpg 64KB
Science_fiction.jpg 64KB
School_uniform.jpg 63KB
Chinese_traditional.jpg 63KB
Fairy_style.jpg 63KB
Mongolian.jpg 62KB
European_fields.jpg 62KB
Mechnical.jpg 60KB
India.jpg 59KB
Armor.jpg 58KB
Flowers.jpg 58KB
Deer_girl.jpg 58KB
Model_style.jpg 57KB
Men_suit.jpg 57KB
Motorcycle_race_style.jpg 56KB
Hanfu.jpg 54KB
Li.jpg 54KB
Wild_west.jpg 53KB
Chinese_winter_hanfu.jpg 53KB
Wedding_dress.jpg 52KB
T-shirt.jpg 50KB
Cybernetics_punk.jpg 50KB
Polaroid_style.jpg 49KB
Chinese_traditional_gorgeous_suit.jpg 48KB
Street_style.jpg 48KB
Hong_Kong_night_style.jpg 47KB
DreamyOcean.jpg 46KB
Soccer.jpg 46KB
Jacket_in_Snow_Mountain.jpg 46KB
Working_suit.jpg 45KB
Gown.jpg 44KB
Redstyle.jpg 43KB
Elegant_Princess.jpg 43KB
Chinese_Girl_among_Plum_Blossoms.jpg 43KB
Cheongsam.jpg 42KB
Retro_style.jpg 42KB
Gentleman.jpg 42KB
Cartoon.jpg 42KB
ZangZu.jpg 39KB
Luolita.jpg 38KB
Roaming_Astronaut.jpg 38KB
Tibetan_clothing.jpg 38KB
Tyndall.jpg 37KB
Barbie_Doll.jpg 37KB
Duobaan.jpg 36KB
Princess_style.jpg 35KB
Kimono.jpg 35KB
PekingOpera_female_role.jpg 35KB
Autumn_populus.jpg 34KB
Miaozu.jpg 33KB
Snow_white.jpg 32KB
Chinese_New_Year.jpg 32KB
West_cowboy.jpg 32KB
Hiphop.jpg 32KB
Bleak_autumn.jpg 32KB
Fashion_glasses.jpg 31KB
Flame_red_style.jpg 30KB
Wizard_of_Oz.jpg 30KB
Dunhuang.jpg 29KB
Disneyland.jpg 27KB
Witch.jpg 26KB
Embroidery.jpg 26KB
GuoFeng.jpg 26KB
Lolita.jpg 26KB
Colorful_rainbow.jpg 25KB
Casual_Lifestyle.jpg 25KB
Ocean_Summer_vibe.jpg 25KB
Maid.jpg 25KB
Pixy_Girl.jpg 23KB
Cowboy.jpg 22KB
Cool_tones.jpg 22KB
Innocent_Girl_in_White_Dress.jpg 21KB
style_lora_xiapei.jpg 131B
example3.jpg 131B
framework_eng.jpg 131B
prompt_elf_lord_of_rings.jpg 131B
framework.jpg 131B
example1.jpg 130B
example2.jpg 130B
Miaozu.json 812B
Wizard_of_Oz.json 744B
Mechnical.json 653B
Retro_style.json 637B
共 204 条
- 1
- 2
- 3
资源评论
汀、人工智能
- 粉丝: 7w+
- 资源: 367
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功