# sczhou/CodeFormer

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/sczhou-codeformer).**

17,811 stars · 3,696 forks · Python · other

## Links

- GitHub: https://github.com/sczhou/CodeFormer
- awesome-repositories: https://awesome-repositories.com/repository/sczhou-codeformer.md

## Topics

`codebook` `codeformer` `face-enhancement` `face-restoration` `pytorch` `restoration` `super-resolution` `vqgan`

## Description

CodeFormer is a deep learning framework designed for the restoration and enhancement of facial images and video sequences. It functions as a comprehensive processing engine capable of reconstructing high-quality facial features from degraded, blurry, or damaged inputs, while also providing tools for image upscaling and generative inpainting to fill missing or corrupted regions.

The system distinguishes itself by utilizing a codebook-based quantization approach that maps input patches to high-quality facial representations, supported by transformer-based global modeling to ensure structural consistency. It incorporates latent space manifold projection and multi-scale feature fusion to filter noise and preserve fine-grained textures, while an adversarial training objective enforces realistic output generation. For video applications, the framework employs temporal consistency regularization to maintain stability across sequential frames.

Beyond core restoration, the project includes capabilities for colorizing monochrome or faded portraits by applying natural skin tones. The software is distributed as a Python-based repository, providing the necessary models and utilities to perform these enhancement tasks on both static images and video files.

## Tags

### Artificial Intelligence & ML

- [Facial Analysis](https://awesome-repositories.com/f/artificial-intelligence-ml/facial-analysis.md) — Reconstructs high-quality facial features from blurry, damaged, or low-resolution photographs. ([source](https://cdn.jsdelivr.net/gh/sczhou/CodeFormer@master/README.md))
- [Image Restoration Models](https://awesome-repositories.com/f/artificial-intelligence-ml/image-restoration-models.md) — Reconstructs high-quality facial features from degraded, blurry, or damaged inputs. ([source](https://cdn.jsdelivr.net/gh/sczhou/CodeFormer@master/README.md))
- [Codebook Quantization Layers](https://awesome-repositories.com/f/artificial-intelligence-ml/feature-extraction/convolutional-feature-extractors/feature-map-aggregators/codebook-quantization-layers.md) — Uses a learned dictionary of facial features to map degraded input patches to high-quality codebook entries.
- [Video-to-Video Synthesis](https://awesome-repositories.com/f/artificial-intelligence-ml/generative-ai-resources/diffusion-visual-models/generative-ai-tasks/video-to-video-synthesis.md) — Processes video sequences to improve facial quality across multiple frames using generative restoration models. ([source](https://cdn.jsdelivr.net/gh/sczhou/CodeFormer@master/README.md))
- [Generative Adversarial Architectures](https://awesome-repositories.com/f/artificial-intelligence-ml/image-generation/generative-adversarial-architectures.md) — Employs adversarial training to generate realistic facial textures and prevent blurring in restored images.
- [Feature Fusion Architectures](https://awesome-repositories.com/f/artificial-intelligence-ml/feature-fusion-architectures.md) — Integrates information across multiple resolution levels to preserve both fine-grained textures and global structure.
- [Latent Space Generative Models](https://awesome-repositories.com/f/artificial-intelligence-ml/generative-ai-resources/diffusion-visual-models/generative-ai-models/latent-space-generative-models.md) — Projects corrupted inputs into a learned latent space to filter noise and recover facial details.
- [Transformer Models](https://awesome-repositories.com/f/artificial-intelligence-ml/transformer-models.md) — Uses self-attention mechanisms to capture long-range dependencies and ensure structural consistency.

### Graphics & Multimedia

- [Video Restoration Tools](https://awesome-repositories.com/f/graphics-multimedia/video-restoration-tools.md) — Provides advanced restoration and upsampling models to improve facial quality and visual consistency across video sequences.
- [AI Upscaling](https://awesome-repositories.com/f/graphics-multimedia/image-editing-processing/image-enhancement-tools/ai-upscaling.md) — Increases the resolution of processed facial images to enhance fine details and produce sharper results. ([source](https://cdn.jsdelivr.net/gh/sczhou/CodeFormer@master/README.md))
- [Video Transformation and Enhancement](https://awesome-repositories.com/f/graphics-multimedia/media-processing-analysis/media-manipulation/media-processing-workflows/video-transformation-enhancement.md) — Enhances facial content in video sequences to provide a clearer and more consistent viewing experience.
- [Inpainting and Outpainting Tools](https://awesome-repositories.com/f/graphics-multimedia/media-processing-analysis/media-manipulation/media-processing-workflows/generative-visual-engines/inpainting-and-outpainting-tools.md) — Fills in missing or corrupted regions of facial images by synthesizing consistent pixels.
- [Historical Photo Restoration](https://awesome-repositories.com/f/graphics-multimedia/historical-photo-restoration.md) — Restores original visual depth to black and white or faded portraits through colorization and enhancement.
- [Portrait Colorization Engines](https://awesome-repositories.com/f/graphics-multimedia/portrait-colorization-engines.md) — Applies natural skin tones and color palettes to monochrome or faded facial images to restore their appearance.
- [Portrait Colorization Models](https://awesome-repositories.com/f/graphics-multimedia/portrait-colorization-models.md) — Applies natural skin tones and color palettes to monochrome or faded portraits to restore visual depth. ([source](https://cdn.jsdelivr.net/gh/sczhou/CodeFormer@master/README.md))

### Data & Databases

- [Temporal Stability Constraints](https://awesome-repositories.com/f/data-databases/data-processing-pipelines/stream-processing-systems/stream-processing/frame-based/temporal-stability-constraints.md) — Applies frame-to-frame constraints to minimize flickering and maintain stability across video sequences.
