Gpen-bfr-2048.pth
pip install onnx onnxruntime-gpu
: It leverages a generative adversarial network (GAN) as a prior, which allows it to "hallucinate" realistic skin textures, eye details, and hair that are often completely lost in low-quality photos. gpen-bfr-2048.pth
The filename refers to a high-resolution pre-trained model for the GAN Prior Embedded Network (GPEN) , a framework designed for blind face restoration in real-world scenarios . Core Functionality pip install onnx onnxruntime-gpu : It leverages a
| Component | Description | Reference | |-----------|-------------|-----------| | | Modified ResNet‑50 (or ResNet‑101 in some configs) that extracts a 512‑dim latent code from the degraded input. | He et al., Deep Residual Learning for Image Recognition (CVPR 2016) | | Latent Mapping | Two fully‑connected layers (512 → 512) with LeakyReLU, mapping the encoder output to the StyleGAN2 latent space (W) . | Karras et al., Analyzing and Improving the Image Quality of StyleGAN (CVPR 2020) | | Generator (StyleGAN2‑based) | A pre‑trained StyleGAN2 backbone (trained on FFHQ‑1024) that synthesises a high‑resolution face from the latent code. | Karras et al., StyleGAN2 (CVPR 2020) | | Adaptive Instance Normalization (AdaIN) | Injects the latent code into each synthesis block, controlling coarse to fine attributes (pose, expression, illumination). | Huang & Belongie, Arbitrary Style Transfer (ECCV 2017) | | Discriminators (used only during training) | Multi‑scale PatchGAN discriminators that enforce realism at 64 × 64, 128 × 128, …, 2048 × 2048. | Isola et al., Image‑to‑Image Translation with Conditional Adversarial Nets (CVPR 2017) | | Losses | • Pixel‑wise L1/L2 (reconstruction) • Perceptual loss (VGG‑19 features) • Adversarial loss (R1 regularised) • Identity loss (ArcFace feature distance) • LPIPS (learned perceptual similarity) | Multiple papers (see section 3) | | Upsampling Path | Progressive up‑sampling inside the generator: 8 → 16 → 32 → … → 2048. All up‑sampling uses nearest‑neighbor + 3 × 3 conv (as in StyleGAN2). | Karras et al., StyleGAN2 | | He et al