Real-Time Defect Removal and Mask-Guided Image Inpainting of Live-Captured Images Using a Pretrained LaMa-Based Inpainter with Bilevel Hypergradient Adapter Optimization
DOI:
https://doi.org/10.70917/ijcisim-2026-1894Keywords:
Image inpainting, mask-guided inpainting, LaMa; adapter-based refinement, Mask-Aware Bilevel Hypergradient Optimization, masked-region restorationAbstract
Image inpainting is used when part of an image is missing or damaged. In live-captured images, this is harder because
the defect shape is not always regular. The repaired part should look like it belongs to the same image. This work proposes a real
time defect removal and mask-guided image inpainting framework for such images. A pretrained Large Mask Inpainting (LaMa)
model is used as the base inpainter. LaMa is first adapted using the Landscape dataset. Small adapter layers are then trained with
Mask-Aware Bilevel Hypergradient Optimization (MABHO) to improve the repaired region. The output is checked with full-image
scores and masked-region scores. The proposed Masked Region Restoration Quality Loss (MRQL) score is also used to measure
the repair quality inside the damaged area. Training and 5-fold cross-validation use 300 Landscape images. For external validation,
150–180 Intel images are used. Real-time testing is done on 15 camera-captured images. Compared with the frozen LaMa baseline
on the Landscape dataset, Peak Signal-to-Noise Ratio (PSNR) increases from 20.96 to 22.84 dB, and Structural Similarity Index
Measure (SSIM) increases from 0.811 to 0.864. Learned Perceptual Image Patch Similarity (LPIPS) decreases from 0.184 to 0.129.
The framework further achieves 20.72 dB Masked-PSNR, 0.823 Masked-SSIM, and 0.884 MRQL. These results show that the
proposed method supports practical defect-aware restoration for live-captured images.