DicFace
[ICCV2025 Highlight] DicFace: Dirichlet-Constrained Variational Codebook Learning for Temporally Coherent Video Face Restoration
Install / Use
/learn @fudan-generative-vision/DicFaceREADME
🖼️ Showcase
Blind Face Restoration
<table align="center" width="100%" border="0" cellpadding="10"> <tr> <td style="text-align: center;"> <video src="https://github.com/user-attachments/assets/eb61d793-b860-476e-bae5-f6fcade1e11f" muted autoplay loop width="480"></video> </td> <td style="text-align: center;"> <video src="https://github.com/user-attachments/assets/eb9be43a-8fb9-4fbd-ac92-a686ab0c188b" muted autoplay loop width="480"></video> </td> </tr> </table>Face Inpainting
<table align="center" width="100%" border="0" cellpadding="10"> <tr> <td style="text-align: center;"> <video src="https://github.com/user-attachments/assets/1cd12d53-2ead-4cf3-b56c-1a6316484e93" muted autoplay loop width="480"></video> </td> <td style="text-align: center;"> <video src="https://github.com/user-attachments/assets/a16b7021-a401-41cb-9a39-37a788f6a001" muted autoplay loop width="480"></video> </td> </tr> </table>Face Colorization
<table align="center" width="100%" border="0" cellpadding="10"> <tr> <td style="text-align: center;"> <video src="https://github.com/user-attachments/assets/cb038911-8b26-472d-8fb9-a6cdda127084" muted autoplay loop width="480"></video> </td> <td style="text-align: center;"> <video src="https://github.com/user-attachments/assets/ffc85ef7-4987-42af-b892-79544ea29f87" muted autoplay loop width="480"></video> </td> </tr> </table>🐾 Wild Data Examples
<div align="center"><video src="https://github.com/user-attachments/assets/90fe03dd-b0cc-446b-bb6a-169e98c875df" muted autoplay loop width="3240"></video> <video src="https://github.com/user-attachments/assets/c165fca5-652b-4586-a928-2ba5bda6ae03" muted autoplay loop width="3240"></video> <br> <video src="https://github.com/user-attachments/assets/f911165d-2259-4378-828c-a4468e5fa4dc" muted autoplay loop width="3240"></video> <br>
<table align="center" width="100%" border="0" cellpadding="10"> <tr> <td style="text-align: center;"> <video src="https://github.com/user-attachments/assets/34eea191-f972-4b6f-9529-cc39b9831875" muted autoplay loop width="480"></video> </td> <td style="text-align: center;"> <video src="https://github.com/user-attachments/assets/b7f0466b-321d-42b5-ae70-65b4a7347698" muted autoplay loop width="480"></video> </td> </tr> </table> </div>📰 News
2025/07/25: 🎉🎉🎉 Our paper has been accepted to ICCV 2025and selected as a highlight.2025/06/26: 🎉🎉🎉 Our paper has been accepted to ICCV 2025.2025/06/25: Release our test data on huggingface repo.2025/06/23: Release our pretrained model on huggingface repo.2025/06/17: Paper submitted on Arixiv. paper2025/06/16: 🎉🎉🎉 Release inference scripts
📅️ Roadmap
| Status | Milestone | ETA | | :----: | :----------------------------------------------------------------------------------------------------- | :--------: | | ✅ | Inference Code release | 2025-6-16 | | ✅ | Model Weight release, baidu-link |2025-6-16 | | ✅ | Paper submitted on Arixiv | 2025-6-17 | | ✅ | Test data release | 2025-6-25 | | ✅ | Training Code release | 2025-6-26 |
⚙️ Installation
- System requirement: PyTorch version >=2.4.1, python == 3.10
- Tested on GPUs: A800, python version == 3.10, PyTorch version == 2.4.1, cuda version == 12.1
Download the codes:
git clone https://github.com/fudan-generative-vision/DicFace
cd DicFace
Create conda environment:
conda create -n DicFace python=3.10
conda activate DicFace
Install PyTorch
conda install pytorch==2.4.1 torchvision==0.19.1 torchaudio==2.4.1 pytorch-cuda=12.1 -c pytorch -c nvidia
Install packages with pip
pip install -r requirements.txt
python basicsr/setup.py develop
conda install -c conda-forge dlib
📥 Download Pretrained Models
The pre-trained weights have been uploaded to Baidu Netdisk. Please download them from the link
Now you can easily get all pretrained models required by inference from our HuggingFace repo.
File Structure of Pretrained Models The downloaded .ckpts directory contains the following pre-trained models:
.ckpts
|-- CodeFormer # CodeFormer-related models
| |-- bfr_100k.pth # Blind Face Restoration model
| |-- color_100k.pth # Color Restoration model
| |-- codeformer.pth # codeformer model
| |-- vqgan_discriminator.pth # vqgan_discriminator model
| `-- inpainting_100k.pth # Image Inpainting model
|-- dlib # dlib face-related models
| |-- mmod_human_face_detector.dat # Human face detector
| `-- shape_predictor_5_face_landmarks.dat # 5-point face landmark predictor
|-- facelib # Face processing library models
| |-- detection_Resnet50_Final.pth # ResNet50 face detector
| |-- detection_mobilenet0.25_Final.pth # MobileNet0.25 face detector
| |-- parsing_parsenet.pth # Face parsing model
| |-- yolov5l-face.pth # YOLOv5l face detection model
| `-- yolov5n-face.pth # YOLOv5n face detection model
|-- realesrgan # Real-ESRGAN super-resolution model
| `-- RealESRGAN_x2plus.pth # 2x super-resolution enhancement model
`-- vgg # VGG feature extraction model
`-- vgg.pth # VGG network pre-trained weights
🎮 Run Inference
for blind face restoration
python scripts/inference.py \
-i /path/to/video \
-o /path/to/output_folder \
--max_length 10 \
--save_video_fps 24 \
--ckpt_path /bfr/bfr_weight.pth \
--bg_upsampler realesrgan \
--save_video
# or your videos has been aligned
python scripts/inference.py \
-i /path/to/video \
-o /path/to/output_folder \
--max_length 10 \
--save_video_fps 24 \
--ckpt_path /bfr/bfr_weight.pth \
--save_video \
--has_aligned
for colorization & inpainting task
The current colorization & inpainting tasks only supports input of aligned faces. If a non-aligned face is input, it may lead to unsatisfactory final results.
# for colorization task
python scripts/inference_color_and_inpainting.py \
-i /path/to/video_warped \
-o /path/to/output_folder \
--max_length 10 \
--save_video_fps 24 \
--ckpt_path /colorization/colorization_weight.pth \
--bg_upsampler realesrgan \
--save_video \
--has_aligned
# for inpainting task
python scripts/inference_color_and_inpainting.py \
-i /path/to/video_warped \
-o /path/to/output_folder \
--max_length 10 \
--save_video_fps 24 \
--ckpt_path /inpainting/inpainting_weight.pth \
--bg_upsampler realesrgan \
--save_video \
--has_aligned
Test Data
Our test data can be accessed via the following links:
- Baidu Netdisk: https://pan.baidu.com/s/1zMp3fnf6LvlRT9CAoL1OUw (Password:
drhh) - Hugging Face Dataset: [https://huggingface.co
Related Skills
docs-writer
98.7k`docs-writer` skill instructions As an expert technical writer and editor for the Gemini CLI project, you produce accurate, clear, and consistent documentation. When asked to write, edit, or revie
model-usage
330.3kUse CodexBar CLI local cost usage to summarize per-model usage for Codex or Claude, including the current (most recent) model or a full model breakdown. Trigger when asked for model-level usage/cost data from codexbar, or when you need a scriptable per-model summary from codexbar cost JSON.
arscontexta
2.8kClaude Code plugin that generates individualized knowledge systems from conversation. You describe how you think and work, have a conversation and get a complete second brain as markdown files you own.
be
Assume the personality of the Persona described in any of the document available in the @~/.ai/personas directory.
