A Context Aware Deep Learning Architecture for Object Detection

Kevin Bardool, Tinne Tuytelaars, José Oramas M.

Introduction

While modern Deep Neural Networks (DNNs) excel at identifying objects based on local appearance, they frequently lack the "common sense" required to interpret global scene context. Standard detectors may identify a boat in a forest or a car floating in the sky because the pixel patterns match the class, ignoring spatial and semantic constraints. This paper proposes a modular two-stage architecture designed to inject contextual reasoning into the detection pipeline by decoupling appearance-based identification from spatial-semantic validation.

Methods

The proposed system utilizes a secondary Fully Convolutional Network (FCN) to analyze "contextual feature maps" generated by a primary detector (Mask R-CNN). This allows the model to learn spatial constraints and size-relative-to-depth relationships, effectively performing a "sanity check" on object proposals.

The two-stage architecture featuring a modified Mask R-CNN for heatmap generation and an FCN for context-based rescoring.

The architecture consists of two primary components:

  1. Primary Detector (Modified Mask R-CNN): An off-the-shelf Mask R-CNN is modified to output per-class contextual feature maps. These heatmaps encode the detector's confidence and the spatial location of each bounding box proposal.
  2. Contextual Learner (FCN): These heatmaps are fed into a secondary FCN. Unlike the primary detector, the FCN does not process raw image pixels; it operates solely on the abstraction of detection maps to learn geometric and semantic relationships.

A final scoring layer calculates a "contextual score" for each proposal, which is used to re-evaluate and potentially re-rank the original detections. This mechanism boosts contextually appropriate objects while demoting out-of-place false positives.

Key Insights and Ideas

The researchers evaluated the architecture using a synthetic image generator—designed to enforce strict contextual rules like horizon-based scaling—and a subset of the COCO dataset. Several key findings emerged:

  • Separation of Concerns: By treating context and appearance as distinct tasks, the primary detector can focus on "what" an object is, while the secondary model focuses on "where" it belongs.
  • Geometric Learning: The model successfully learned the "horizon rule," favoring larger objects lower in the frame (closer to the observer), effectively deriving 3D depth cues from 2D data.
  • Spatial Constraints: The system demonstrated the ability to reject proposals in statistically unlikely locations, such as cars in the sky.

Key Results

On a test set of 500 synthetic images, the context-aware rescoring stage provided a 1.3 point improvement in mean Average Precision (mAP) over the initial detector stage.

Performance comparison showing mAP and per-class AP improvements after the rescoring stage.

As shown in the results table, the "Rescoring Stg - Score 1" consistently outperforms the "Detector Stg - Score 1" across multiple classes, including person, car, and airplane. This confirms the model's ability to refine scores based on the learned contextual maps.

Limitations and Future Work

Despite the improvements, the authors noted that the model struggled with complex semantic co-occurrences (e.g., keyboard and mouse). Furthermore, in some real-world COCO scenarios, the original Mask R-CNN softmax scores remained dominant, suggesting that the optimal weighting between appearance and context is a subject for future optimization. Scaling these learned contextual behaviors to the full variability of real-world datasets remains a significant challenge for future research.

Summary updated

BibTeX
@inproceedings{bardool2019context,
  author = {Kevin Bardool and Tinne Tuytelaars and José Oramas M.},
  title = {{A Context Aware Deep Learning Architecture for Object Detection}},
  booktitle = {BNAIC/BENELEARN},
  year = {2019},
}
Figure