TL;DR
This paper introduces L-BRGM, a novel Bayesian image reconstruction framework that leverages pre-trained StyleGAN2 models to solve ill-posed inverse problems like image inpainting and super-resolution. By jointly optimizing over both the style-code and the input latent code—and using the GAN's own mapping network as a data-driven regularizer—the method unlocks the full expressive power of the generator, achieving highly competitive and often superior perceptual results compared to existing state-of-the-art GAN inversion techniques.
What Problem Does This Paper Address?
In computational imaging, "inverse problems" involve trying to recover a clean, high-resolution original image from a degraded, noisy, or incomplete measurement (like a blurred or masked photo). Because multiple original images could technically produce the same degraded output, the problem is "ill-posed." To solve it, researchers use priors—rules or models that penalize unnatural-looking solutions.
Recently, deep generative models (like GANs) have become incredibly popular as priors. However, simply searching for the best image within a GAN's standard output range often fails due to "mode collapse" (the exact target image might not exist in the generator's strict mathematical range). To fix this, researchers use "GAN inversion" to apply soft constraints, allowing the model to bend the rules slightly to match the target image. A recent method called BRGM (Bayesian Reconstruction through Generative Models) does this, but it relies on hand-crafted mathematical priors for the latent codes, which limits the reconstruction quality. This paper asks: Can we use the GAN's own internal mapping network to learn a better, data-driven prior for these latent codes?
Methods
The authors propose L-BRGM (Learned-BRGM), an optimization-based approach that builds on the Bayesian Maximum A Posteriori (MAP) estimation framework.
- Joint Optimization: Instead of just optimizing the final latent space, L-BRGM jointly optimizes the input noise code ($z$) and the intermediate "style-code" ($w$).
- Data-Driven Regularization: StyleGAN2 features an 8-layer mapping network ($M$) that translates $z$ into $w$. Instead of hand-crafting a prior for $w$, L-BRGM uses $M(z)$ to model the distribution of $w$.
- Layer-wise Flexibility: The method optimizes over an extended latent space ($w^+$), allowing different style-codes ($w_i$) for the 18 different layers of the StyleGAN2 generator. However, it regularizes all of them to stay close to the output of the mapping network $M(z)$, ensuring they don't drift into generating unnatural artifacts.
- Implementation: The non-convex loss function (which includes pixel-wise error, VGG perceptual loss, and latent regularizers) is minimized using the Adam optimizer. To avoid getting stuck in local minima, they use multiple random initializations (100 samples) and employ early stopping based on the LPIPS perceptual metric to prevent the image from diverging from reality.
Datasets
- FFHQ (Flickr-Faces-HQ): The primary dataset used for evaluation, consisting of high-quality human faces. The authors tested their method on images at both $256^2$ and $1024^2$ resolutions. A holdout set of 99 images was used for performance validation.
Key Insights and Ideas
- Data-driven priors beat hand-crafted ones: Using the mapping network $M(z)$ to regularize the style-code produces much more natural images. Without this regularization, reconstructed images look artificially smooth and fail to recover crucial high-frequency details (like hair texture) far from the masked boundaries.
- Joint optimization is powerful: Optimizing both the input noise $z$ and the style-code $w$ simultaneously allows the model to find a "sweet spot" between staying true to the generative prior (looking like a real face) and matching the degraded input (data fidelity).
- Metrics mismatch in generative tasks: The authors noted that SSIM (Structural Similarity Index), a classic image quality metric, does not correlate well with actual human visual perception in these tasks. Instead, LPIPS (Learned Perceptual Image Patch Similarity) is a much better indicator of success.
Key Results
- High-Resolution Inpainting ($1024^2$): L-BRGM significantly outperformed its predecessor, BRGM. For a half-mask, L-BRGM achieved an average LPIPS of 0.460 (vs. BRGM's 0.495). For an eye-patch mask, it achieved 0.393 (vs. BRGM's 0.428). Lower LPIPS is better.
- Standard Inpainting ($256^2$): L-BRGM achieved the best average LPIPS (0.224) on half-mask inpainting, beating both BRGM (0.226) and the specialized DeepGIN network (0.303).
- Super-resolution: At $1024^2$, L-BRGM beat BRGM (LPIPS 0.414 vs 0.426). However, at $256^2$, a specialized facial restoration model called GFP-GAN outperformed L-BRGM (LPIPS 0.231 vs 0.277).
Limitations and Future Work
- Limitations: L-BRGM slightly underperforms in SSIM compared to competitors, though the authors argue SSIM is a flawed metric for this specific visual task. Furthermore, L-BRGM falls short of specialized models like GFP-GAN on super-resolution tasks because GFP-GAN utilizes bespoke, domain-specific loss functions (like facial component preservation) that a general GAN inversion technique lacks.
- Future Work: The authors suggest the ambitious goal of developing generic methods that can outperform state-of-the-art across all possible target images, rather than just specific domains like faces. They also propose researching generative models with inherently more interpretable—and thus easier to regularize—latent spaces to make inverse problem reconstruction even more robust.
Summary updated