Abstract
OCNet introduces the concept of Object Context to semantic segmentation, explicitly modeling the relationship between pixels belonging to the same object category. To make this computationally feasible for high-resolution images, the authors developed Interlaced Sparse Self-Attention (ISA), a novel factorization that achieves the benefits of dense self-attention with a fraction of the memory and compute overhead.
Introduction
Semantic segmentation—the task of assigning a category label to every pixel in an image—relies heavily on "context." A pixel showing a patch of gray is easier to identify as "road" if the network knows it is surrounded by "cars" and "sidewalks."
Traditional methods like Pyramid Pooling (PPM) or Atrous Spatial Pyramid Pooling (ASPP) capture context by looking at fixed spatial regions or using dilated convolutions. However, these methods often mix "useful" object pixels with "noisy" background pixels. While standard Self-Attention (SA) can theoretically model these relationships perfectly, its computational complexity is quadratic ($O(N^2)$) relative to the number of pixels. This makes SA prohibitively expensive for the high-resolution images common in modern computer vision.
Methodology
The authors propose two major innovations to address these challenges:
Object Context
They define the ideal context for a pixel as the set of all other pixels in the image that belong to the same category. Since ground-truth labels are unavailable at inference, they use a learned dense relation matrix where higher scores indicate pixels likely belonging to the same object.
Interlaced Sparse Self-Attention (ISA)
To solve the $O(N^2)$ bottleneck, ISA factorizes the dense relation matrix into two successive sparse operations:
- Global Relation: Computes attention across a subset of pixels sampled at long intervals.
- Local Relation: Computes attention within local neighborhoods.
By "interlacing" these two steps, information can propagate from any pixel to any other pixel in the image, mimicking a dense matrix but with significantly lower complexity. The authors integrate these modules into several architectures, including Base-OC, Pyramid-OC, and ASP-OC.
Experimental Results
The researchers evaluated OCNet on five major benchmarks: Cityscapes, ADE20K, LIP (Look Into Person), PASCAL-Context, and COCO-Stuff.
Computational Efficiency
The results highlight a massive leap in efficiency without sacrificing accuracy. For a standard input size, ISA uses only 10.2% of the GPU memory and 24.6% of the FLOPs compared to standard self-attention, while running nearly 2x faster.
As shown in the scaling analysis, the computational cost of standard SA explodes as image resolution increases, whereas ISA scales much more gracefully, enabling the use of self-attention on high-resolution feature maps.
Segmentation Accuracy
On Cityscapes, the ASP-OC variant achieved an mIoU of 80.01%, a significant improvement over the Dilated ResNet-101 baseline (75.9%). The model also showed strong generalization when applied to the Mask-RCNN framework for object detection and instance segmentation.
Conclusion
OCNet demonstrates that a pixel’s identity is inherited from the object it belongs to, and prioritizing same-category pixels for context improves parsing. ISA further proves that full $N \times N$ matrices are not required for global context; alternating between coarse-grained global views and fine-grained local views achieves nearly identical results with vastly superior efficiency. Future work may explore inter-category co-occurrence relations and explicit spatial priors to further refine predictions.
Summary updated