Blind Inpainting of Large-scale Masks of Thin Structures with Adversarial and Reinforcement Learning

Hao Chen, Mario Valerio Giuffrida, Peter Doerner, Sotirios A. TsaftarisarXiv 2019

Abstract

Segmenting thin, elongated structures such as blood vessels, roads, and plant roots is a critical first step in many imaging applications. However, these segmentations often suffer from gaps due to noise or occlusions, hindering topological analysis. This paper presents GAN-GL, a novel deep learning framework for "blind" inpainting that automatically detects and repairs these gaps. By integrating adversarial training with reinforcement learning (Policy Gradient), the framework maintains global structural coherence in large-scale images that exceed GPU memory limits. Experimental results across diverse domains demonstrate significant improvements in connectivity and topological accuracy.

Introduction

In imaging domains ranging from medical diagnostics to satellite surveillance, the extraction of thin structures is essential. A common challenge is the presence of "gaps" in segmented masks—discontinuities that are indistinguishable from the background to standard algorithms. These gaps disrupt downstream analysis, such as measuring root system length or road network connectivity.

Existing inpainting methods typically require manual "masks" indicating where gaps are (non-blind inpainting). Furthermore, high-resolution images are often processed in patches due to memory constraints, leading to a "myopic" view that fails to maintain global connectivity. GAN-GL addresses these issues by learning the structural "grammar" of thin lines and enforcing global coherence through a multi-level discriminator approach.

Methodology

The proposed GAN-GL architecture combines local pixel-level realism with global topological consistency.

Architecture Components

The system consists of several key modules:

  • Generator ($G$): A U-Net-based model that identifies and fills gaps in corrupted patches without explicit guidance on gap locations.
  • Local Discriminator ($D_L$): A PatchGAN that ensures inpainted segments are sharp and visually consistent at the local level.
  • Global Discriminator ($D_G$): Evaluates the entire re-composed large-scale image to ensure long-range connectivity.
  • Policy Gradient Training: Since the re-composition of patches into a full image is non-differentiable, the REINFORCE algorithm is employed. $D_G$ serves as a critic, providing a reward signal to $G$ based on the global connectivity of the final output.
Figure 1: The GAN-GL architecture, illustrating the data pipeline, generator, and the dual discriminator system (local and global) integrated via reinforcement learning.

To enhance robustness, the model is trained using a library of diverse artificial gaps (squares, brush strokes, and blobs), preventing overfitting to specific gap geometries.

Experiments and Results

The model was evaluated on four distinct datasets: plant roots, high-resolution retinal vessels (HRF), satellite road networks, and Leonardo Da Vinci's line sketches.

Connectivity as a Metric

Traditional pixel-wise metrics like Mean Squared Error (MSE) are insufficient for thin structures. Instead, the authors focus on the number of "connected components." A successful inpainting should reduce the number of fragments, indicating the restoration of the underlying topology.

The Global Advantage

A key finding is the necessity of the global discriminator. While local-only models can fill gaps, they often fail to connect segments across patch boundaries. The inclusion of the global reward signal significantly reduces fragmentation.

Figure 2: Comparison of inpainting results. The global discriminator (local & global level) significantly reduces the number of disconnected components compared to local-only processing.

Quantitative and Qualitative Performance

On synthetic root data, GAN-GL achieved a Relative Connectivity Improvement of 93.58%, outperforming standard U-Net baselines (87.26%). Qualitative analysis shows that GAN-GL produces cleaner, more continuous structures without the "stubs" or artifacts common in other methods. In plant root studies, the model's performance was found to be comparable to human expert annotators in recovering key traits like total length.

Conclusion

GAN-GL provides a robust solution for the blind inpainting of large-scale thin structures. By leveraging reinforcement learning to bridge the gap between local patch processing and global structural requirements, the model achieves superior topological recovery. Future work includes extending the framework to grayscale or color images and optimizing the reinforcement learning training efficiency.

Summary updated

BibTeX
@misc{chen2019blind,
  author = {Hao Chen and Mario Valerio Giuffrida and Peter Doerner and Sotirios A. Tsaftaris},
  title = {{Blind Inpainting of Large-scale Masks of Thin Structures with Adversarial and Reinforcement Learning}},
  year = {2019},
  eprint = {1912.02470},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1912.02470},
}
Figure