Context-Aware Automatic Occlusion Removal

Kumara Kahatapitiya, Dumindu Tissera, Ranga Rodrigo · DOI

Abstract

Occlusion removal is a critical application in image enhancement. While existing methods often rely on manual annotation or domain-specific constraints, this paper introduces a novel methodology for automatic, context-aware occlusion detection and removal. By modeling the relationship between foreground and background objects using vector embeddings, the proposed system identifies out-of-context objects and reconstructs the scene through deep inpainting. Evaluation on the COCO-Stuff dataset and a user study establish a new baseline for generic occlusion removal.

Introduction

Capturing a perfect photograph is often hindered by unwanted foreground objects—such as a stray trash can in a landscape or a crowd in a historic site—that distract from the intended subject. While manual editing tools exist, automating this process is difficult because "unrelatedness" is inherently contextual. For instance, a dog is expected in a park but may be an occlusion in a formal indoor setting. Previous automated approaches were limited to specific types of occlusions like rain or faces. This research addresses the broader challenge of autonomously deciding what belongs in a scene based on contextual logic.

Methodology

The proposed system utilizes a four-stage pipeline to bridge computer vision and natural language processing (NLP):

  1. Foreground Segmentator: Employs DeepLabv3+ to generate pixel-wise masks for discrete "thing" classes (e.g., people, cars).
  2. Background Extractor: Uses a ResNet-101 backbone to identify "stuff" classes (e.g., sky, grass) that define the environment.
  3. Relation Predictor: The core innovation, which uses a skip-gram language model to calculate cosine similarity between foreground objects and the background context.
  4. Inpainter: A two-stage Generative Adversarial Network (GAN) with contextual attention that fills the masked regions with coherent textures.
The proposed system architecture integrates foreground segmentation, background extraction, and relation prediction to drive the final inpainting stage.

Learning Contextual Relations via Embeddings

To quantify "common sense" relationships, the authors trained a skip-gram model on a modified MS COCO caption corpus. By stripping captions of syntax and focusing solely on object labels, the model learns vector embeddings where spatially and contextually related objects cluster together. A foreground object is flagged for removal if its cosine similarity to the surrounding scene falls below a threshold of 0.4.

A t-SNE visualization of the learned embeddings shows how the model clusters related objects, enabling the system to distinguish between contextually appropriate and inappropriate elements.

Experimental Results

The system was evaluated using the COCO-Stuff dataset and a user study involving 1,245 image pairs. Key findings include:

  • Visual Quality: 79.7% of reconstructed images were rated as "visually pleasing," indicating that the GAN-based inpainter maintains high spatial coherence.
  • Contextual Logic: The system successfully demonstrated the ability to remove objects based on environment (e.g., removing a vehicle from a wilderness setting while retaining it in a city street).
  • Baseline Performance: The relation predictor achieved a precision of 39.03% and a recall of 17.46%. While modest, these figures represent the first baseline for fully automatic, generic context-aware removal.

Conclusion and Future Work

This work demonstrates that NLP-style embeddings can effectively model visual context for automated image editing. However, a gap remains between statistical co-occurrence and human intuition, as rare but natural objects may be incorrectly flagged. Future research will focus on developing a dedicated "occlusion dataset" to enable end-to-end training and improve the precision of the relation predictor.

Summary updated

BibTeX
@inproceedings{kahatapitiya2019context,
  author = {Kumara Kahatapitiya and Dumindu Tissera and Ranga Rodrigo},
  title = {{Context-Aware Automatic Occlusion Removal}},
  booktitle = {ICIP},
  year = {2019},
  doi = {10.1109/icip.2019.8803141},
}
Figure