Favicon of CodeFormer

CodeFormer

Local AI face restoration software built on PyTorch and CUDA. Restore faces in photos and videos, with control over image quality and fidelity.

Screenshot of CodeFormer website

CodeFormer restores degraded faces in photos and videos using a learned library of facial details and a Transformer model. It's for people restoring images on their own hardware, developers adding face enhancement to a project, and researchers working on image restoration. Its main distinction is an adjustable balance between visual quality and fidelity to the input face.

That balance matters when the original contains too little detail for an exact reconstruction. You can favor a cleaner-looking result or preserve more of the input's appearance. The model predicts facial details from a learned codebook, so a restored face can include generated detail rather than only recovered information.

Alongside face restoration, CodeFormer supports inpainting and colorization for cropped, aligned face images. It can process whole photos as well as prepared face crops, and it accepts video input for face enhancement. Whole-image processing blends restored faces back into the background; this can affect hair texture around the face boundary.

The Python implementation runs locally with PyTorch and CUDA, and pretrained models are available to download. Local processing handles images on your own machine. Browser demos on Hugging Face, Replicate and OpenXLab provide hosted alternatives. The project also publishes training code and configuration files for researchers who want to train the restoration model.

Similar to CodeFormer