Patch-Based Image Inpainting With Dual Codebooks and Transformers

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Transformer-based image inpainting methods suffer from information loss due to downsampling and quantization, leading to misalignment of masked regions and reduced computational efficiency.

Innovation Solution

A patch-based encoding approach using a Patch-based Vector Quantized Variational Auto-Encoder (P-VQVAE) and a dual codebook to process images in non-overlapping patches, avoiding quantization of feature vectors and separately managing masked and unmasked regions, with iterative token sampling and decoding to generate inpainted images.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Productivity

If transformer-based solutions downsample input images to lower resolutions, then computational efficiency is maintained, but information loss and misalignment of masked region boundaries occur

Engineering Contradiction:
Improvecomputational efficiencyVSAvoidinformation loss
Core Design Contradiction:
ProductivityVSLoss of information

Solution Approach 1:

The patent divides the image into non-overlapping patches of a fixed size (e.g., 16x16 pixels) and processes each patch independently through the transformer. This segmentation approach maintains the original image resolution without downsampling, preserving boundary information of masked regions while keeping computational complexity manageable by processing patches in parallel rather than treating the entire image as one large sequence

Inventive Principle:
Principle #1Segmentation

2Productivity

If pixels are quantized to quantized pixels, then computational efficiency is improved, but information loss increases

Engineering Contradiction:
Improvecomputational efficiencyVSAvoidinformation loss
Core Design Contradiction:
ProductivityVSLoss of information

Solution Approach 1:

The patent transforms the problem from operating in the pixel domain to operating in the feature vector domain. Instead of quantizing pixels directly, the model extracts feature vectors from patches using a pretrained encoder, then performs transformer operations on these continuous feature vectors. This dimensional transformation allows the model to work with richer information while maintaining computational efficiency through the structure of feature vector operations

Inventive Principle:
Principle #17Another dimension (Dimensionality change)

3Adaptability or versatility

If each pixel is treated as a token, then global structure understanding is achieved, but information loss occurs due to the large number of tokens

Engineering Contradiction:
Improveglobal structure understandingVSAvoidinformation loss
Core Design Contradiction:
Adaptability or versatilityVSLoss of information

Solution Approach 1:

The patent segments the image into patches and treats each patch as a single token rather than treating every pixel as a separate token. This reduces the number of tokens from potentially millions of pixels to a manageable number of patches (e.g., 256 patches for a 512x512 image), enabling global structure understanding through transformer attention mechanisms while avoiding information loss from excessive tokenization

Inventive Principle:
Principle #1Segmentation

Data Source

PatentEP4515483B1Generating an inpainted image from a masked image using a patch-based encoder
Publication Date: 2026.04.01 MICROSOFT TECHNOLOGY LICENSING LLC
  • EP4515483B1 patent drawingFigure 1
  • EP4515483B1 patent drawingFigure 2
  • EP4515483B1 patent drawingFigure 3

AI summary

The disclosure herein describes generating an inpainted image from a masked image using a patch-based encoder and an unquantized transformer. An image including a masked region and an unmasked region is received, and the received image is divided into a plurality of patches including masked patches. The plurality of patches is encoded into a plurality of feature vectors, wherein each patch is encoded to a feature vector. Using a transformer, a predicted token is generated for each masked patch using a feature vector encoded from the masked patch, and a quantized vector of the masked patch is determined using generated predicted token and a masked patch-specific codebook. The determined quantized vector of the masked patch is included into a set of quantized vectors associated with the plurality of patches, and an output image is generated from the set of quantized vectors using a decoder.