All models

partialconv_unet_places

U-Net inpainter whose masked, renormalized convolutions ignore hole pixels and shrink the mask each layer.

Diffusion and generative · 46 operations Checked

100%

Showing the top corner; full diagram not loaded yetShowing a small copy; full diagram not loaded yetLarge diagram, not loaded yet

Open SVG

Loading diagram (47 KB)

Open in a new tab

Click or tap a spot to read it up close. Scroll or drag inside the diagram to move through it. Zoom with + and − or Ctrl and scroll. Press 0 for the whole graph. Swipe inside the diagram to move through it. Use + and − to zoom.

At a glance

Parameters
234.7K
Operations
46
Framework
PyTorch
Recurrent
No
Published
Lecture Notes in Computer Science (arXiv 2018)
Cited by
2,420 (as of 9 October 2026)
Authors
Guilin Liu, Fitsum A. Reda, Kevin J. Shih and others
Checked
Passed: the trace was replayed operation by operation and matched the model's own output for this input.

Files

The diagram is a drawing of a TorchLens trace of the source code. It contains no code or weights.

Details
Stable ID
m12055
Graph hash
4014905bb1c82b7d106c6ee67800316a69ef41046305ee6bc417b27d7b5f3fae
Skeleton hash
033db4495e527db5397d408b3fe9114405183421503d8c9739802f4c66dcae91
Architecture hash
2921749826f7889aa62988a5515f734c7e358d1b8fbda949fde2fd40d77d8d90
Diagram SHA-256
83e52addfb227e55958433ec567dbee6bbe47e8eab6670d47151a45b760e5ad1
TorchLens version
2.36.0
Renderer
graphviz 2.43.0+pyvips 3.2.0+libvips 8.18.7+render-opts@06c1f0d3
Check
Forward pass replayed in PyTorch

How this diagram was made

menagerie.classics.partialconv_unet:build_partialconv_unet_places: build({})

What it is

This is the partial-convolution U-Net for image inpainting, trained on the Places2 scene dataset, which fills irregular holes in an image with plausible content and no post-processing. The problem it attacks is that ordinary convolutions over a corrupted image respond to the substitute values placed in the holes, typically the mean, which produces color discrepancy and blurriness.

A partial convolution masks the input window and renormalizes the result, so the output depends only on valid pixels, with a scaling factor sum(1)/sum(M) that corrects for how many valid inputs the window held. After each layer the mask is updated: any location where the convolution saw at least one valid input is marked valid, so the holes shrink layer by layer. With enough layers any mask becomes all ones, provided the input had some valid pixels.

The network is a UNet-like architecture with every convolution replaced by a partial convolution and nearest neighbor up-sampling in the decoder; skip links concatenate both feature maps and masks. The final layer also receives the original holed image and mask, so the model can simply copy non-hole pixels, and partial convolution with boundary masking replaces padding at the image border.

Training combines per-pixel losses on valid and hole regions with VGG-based perceptual and style losses and a total variation term, weighted as 1, 6, 0.05, 120 and 0.1. The authors found the style loss necessary to avoid checkerboard artifacts and the perceptual loss important against grid-shaped ones. Because holes corrupt batch statistics, training runs first with Batch Normalization on, then fine-tunes with the encoder's Batch Normalization parameters frozen while the decoder keeps it enabled. The ImageNet and Places2 models trained for 10 days on a single NVIDIA V100 GPU with a batch size of 6, and inference on a 512×512 image takes 0.029s regardless of hole size.

Key idea. A convolution that is masked and renormalized to depend only on valid pixels, paired with an automatic mask update each layer, so a U-Net can inpaint irregular holes without conditioning on hole values or post-processing.

  • partial convolution
  • PConv
  • partialconv_unet_places
  • image inpainting
  • irregular holes
  • hole filling
  • Places2
  • image completion
  • Image Inpainting for Irregular Holes Using Partial Convolutions

AI-written summary, based on the paper and checked automatically against it; not reviewed by a person. Corrections welcome.

Cite the paper

@misc{liu2018imageinpaintingirregularholes,
      title={Image Inpainting for Irregular Holes Using Partial Convolutions}, 
      author={Guilin Liu and Fitsum A. Reda and Kevin J. Shih and Ting-Chun Wang and Andrew Tao and Bryan Catanzaro},
      year={2018},
      eprint={1804.07723},
      archivePrefix={arXiv},
      primaryClass={cs.CV},
      url={https://arxiv.org/abs/1804.07723}, 
}