BRAIN Enhancing Image Inpainting Using Hybrid Architecture Combining CNN-Vision Transformer and GAN

BRAIN Journal Interactive Companion

Enhancing Image Inpainting Using Hybrid Architecture Combining CNN-Vision Transformer and GAN

A CNN-ViT-GAN framework joins local feature extraction, global contextual reasoning, and adversarial texture refinement in one reconstruction pipeline.

PSNR ↑36.2212dB
SSIM ↑0.9779structure
LPIPS ↓0.0260perception
Trace the architecture
224 × 224Reconstruction signal7 → 3 channels

Overview

Three complementary systems, one completion objective

Missing regions are reconstructed without sacrificing the known image. Gated convolutions encode local structure, a Vision Transformer models distant relationships, and a PatchGAN-like discriminator supplies local realism during training.

01

Local structure

Four gated convolution blocks learn hierarchical features while reducing spatial resolution.

CNN encoder
02

Global context

Two Transformer layers with eight attention heads process 196 tokens at the bottleneck.

ViT · 256 dimensions
03

Perceptual detail

Adversarial and feature-matching objectives guide realistic local textures without replacing reconstruction loss.

PatchGAN-like discriminator
CelebAprocessed subset
224 × 224input resolution
200training epochs
15pretraining epochs
8batch size
AdamWoptimizer

Architecture Workbench

Follow the reconstruction signal

Select a stage to inspect its role, dimensions, and connection to the complete system.

01

Input assembly

Seven-channel tensor

Known pixels preserved Icomp = M ⊙ Ipred + (1 − M) ⊙ Iinput M = 1 missing · M = 0 known

Ablation Atlas

What changes when a component disappears?

Compare every controlled configuration against the complete design. Higher PSNR and SSIM are better; lower LPIPS is better.

Complete system

Proposed design

Balanced reference

Exact quantitative comparison
ConfigurationPSNR ↑SSIM ↑LPIPS ↓

Qualitative Evidence

One metric cannot describe every reconstruction

Inputs, masks, error maps, and outputs reveal texture and boundary behavior that aggregate scores can miss.

Qualitative comparison of proposed design and four ablation variants, showing input, masked input, reconstruction error map, and reconstructed output
Qualitative comparison across five configurations Rectangular and irregular masks expose differences in structural consistency, texture generation, and transition quality.
Metric tension

Without GAN

PSNR, SSIM, and LPIPS improve numerically, while reconstructed regions appear smoother and more conservative in texture synthesis.

Largest quantitative drop

Without ViT

PSNR falls to 34.3591, with weaker global structure and semantic coherence across distant regions.

Perceptual supervision

Without perceptual loss

LPIPS rises to 0.0352, the highest value among the tested configurations.

Objective Simulator

Operate the defined calculations

Enter component values to see how the fixed loss weights shape the generator objective, or convert mean squared error into PSNR for normalized images.

01

Generator loss composer

Adversarial multiplier α remains explicit.

Quick presets
Total objective LG0.0000
Live equation Set values to compose the objective.
Configuration comparison

Compare A/B

Save two parameter states and inspect the objective difference.

Configuration ANot saved
Configuration BNot saved
Save A and B to calculate the difference.
02

PSNR calculator

MAXI = 1 for normalized images.

30.00dB

Lower MSE produces higher PSNR.

MSE–PSNR curveHigh fidelity
10⁻⁸10⁻⁴1 80400
Reverse calculator

Target PSNR → required MSE

Required MSE3.1623e-4

Illustrative normalized range (0–1). The paper defines the weights, but does not report a universal “normal” raw loss value.

+ = 0.0000

Interpretive Boundary

Strong on the tested setting, bounded beyond it.