PixelHacker: AI Inpainting via Diffusion Models for Image Restoration
What is PixelHacker?
PixelHacker is a diffusion-model-based image inpainting tool that focuses on maintaining structural and semantic consistency during the inpainting process. It annotates foreground and background regions through a latent category guidance approach, and uses these annotations to guide the inpainting process.

Main Features of PixelHacker
Strong complex structure inpainting capability: Accurately captures and reconstructs complex textures, shapes, and spatial relationships in images.
Semantic consistency: The inpainted image is highly consistent with the original image in terms of color, object features, and logical structure.
Dataset and pre-training: Pre-trained on a large dataset containing 14 million image-mask pairs, and fine-tuned on open-source benchmarks.
Broad applicability: Performs exceptionally well on datasets such as Places2, CelebA-HQ, and FFHQ.
Core Technology of PixelHacker
Latent Categories Guidance (LCG): PixelHacker constructs a large dataset containing 14 million image-mask pairs and annotates foreground and background regions (116 latent categories for foreground and 21 latent categories for background), thereby guiding the model to focus on the structural and semantic information of the image during inpainting.
Linear attention mechanism: The model encodes the latent foreground and background features through two fixed-size embedding vectors, and intermittently injects these features into the model through a linear attention mechanism during the denoising process.
PixelHacker Architecture
PixelHacker is based on the Latent Diffusion Architecture. It converts the input image into latent space through an encoder, then injects foreground and background features during the denoising process, and finally reconstructs the inpainted image through a decoder.
Methods and Workflow
Dataset construction: A large-scale image-mask pair dataset is built by annotating foreground and background categories.
Feature encoding: Fixed-size embedding vectors are used to encode the foreground and background, respectively.
Denoising process: During the denoising process of the diffusion model, foreground and background features are injected into the model through a linear attention mechanism, facilitating multiple interactions of structure and semantics.
Pre-training and fine-tuning: Pre-training is performed on a self-built dataset, and fine-tuning is performed on open-source benchmark datasets, ultimately yielding the PixelHacker model.

PixelHacker Application Scenarios
Image restoration: Removing advertisements, filling in scratches, repairing damaged areas.
Image editing: Background replacement, object replacement, maintaining an overall natural feel.
Artistic creation: Creative generation, style transfer.
Cultural heritage preservation: Restoring images of ancient books, murals, and other cultural heritage.
Medical image processing: Removing artifacts, enhancing image details.
Project Links
Project Page:https://hustvl.github.io/PixelHacker/
GitHub Code:https://github.com/hustvl/PixelHacker
Paper Link:https://arxiv.org/abs/2504.20438
Script Planner Assistant▸
AI Apps
AI News 