Visual Parser: Representing Part-whole Hierarchies with Transformers

Shuyang Sun, Xiaoyu Yue, Song Bai, Philip H. S. TorrarXiv 2021

Abstract

Human vision is able to capture the part-whole hierarchical information from the entire scene. This paper presents the Visual Parser (ViP) that explicitly constructs such a hierarchy with transformers. ViP divides visual representations into two levels, the part level and the whole level. Information of each part represents a combination of several independent vectors within the whole. To model the representations of the two levels, we first encode the information from the whole into part vectors through an attention mechanism, then decode the global information within the part vectors back into the whole representation. By iteratively parsing the two levels with the proposed encoder-decoder interaction, the model can gradually refine the features on both levels. Experimental results demonstrate that ViP can achieve very competitive performance on three major tasks e.g. classification, detection and instance segmentation. In particular, it can surpass the previous state-of-the-art CNN backbones by a large margin on object detection. The tiny model of the ViP family with $7.2\times$ fewer parameters and $10.9\times$ fewer FLOPS can perform comparably with the largest model ResNeXt-101-64$\times$4d of ResNe(X)t family. Visualization results also demonstrate that the learnt parts are highly informative of the predicting class, making ViP more explainable than previous fundamental architectures.

Introduction

In psychology, it is well-established that humans perceive the world through a hierarchy: we see low-level pixels, which form parts, which form objects, which form scenes. However, most modern computer vision backbones, such as ResNet or standard Vision Transformers, typically treat an image as a flat grid of features or a sequence of tokens, failing to model this hierarchy explicitly. Conventional neural networks often struggle to dynamically allocate neurons to represent specific "parts" of an object that might change in shape or position. The Visual Parser (ViP) addresses this by leveraging compositional representations directly, aiming for a more robust and explainable architecture.

Methodology: The Part-Whole Interaction

The Visual Parser (ViP) maintains two distinct levels of representation throughout the network:

  1. The Part Level: A set of $N$ independent vectors ($p$) that capture essential, condensed information about the scene.
  2. The Whole Level: A regular spatial feature map ($x$) representing the entire visual input.

The core of ViP is an iterative Encoder-Decoder interaction. The Part Encoder uses an attention mechanism where the "parts" act as queries to "parse" information from the "whole" feature map, condensing spatial information into semantic part vectors. A "part-wise reasoning" module then allows these parts to communicate. Conversely, the Whole Decoder maps the refined part information back onto the spatial feature map, allowing every pixel to benefit from global context.

Conceptual diagram of the iterative part-whole interaction in ViP.

This dynamic allocation allows the network to create a flexible parse tree for every image. Because the "parts" are highly condensed (e.g., only 16 or 32 vectors), the computational cost of global interaction is significantly lower than standard pixel-to-pixel global attention.

Experimental Results

The model was evaluated on ImageNet-1K for classification and MS COCO for object detection and instance segmentation.

Efficiency and Detection Performance

ViP demonstrates superior efficiency compared to traditional CNN backbones. As shown in Figure 1, the "Tiny" version (ViP-Ti) performs comparably to the much larger ResNeXt-101-64x4d while using 7.2x fewer parameters. In terms of computational cost, it requires 10.9x fewer FLOPs. On COCO object detection, ViP-Ti outperformed ResNet-18 by a massive 7.9 AP when used in a RetinaNet framework.

Comparison of COCO BBox mAP vs Backbone Parameters. ViP-Ti achieves comparable performance to X101-64 with significantly fewer parameters.

Classification and Speed

On ImageNet, ViP-B achieved 83.8% Top-1 accuracy, outperforming similar-sized models like Swin-B and TNT-B. Furthermore, ViP-S was found to be 6.3x faster than HaloNet while maintaining similar accuracy levels, highlighting its practical utility for real-time applications.

Conclusion

The Visual Parser introduces a novel way to explicitly model part-whole hierarchies in vision transformers. By iteratively refining part and whole representations, ViP achieves state-of-the-art performance with high efficiency and improved explainability. While currently limited to a two-level hierarchy, future work could expand this into multi-level structures and explore scaling on even larger datasets like ImageNet-21K.

Summary updated

BibTeX
@misc{sun2021visual,
  author = {Shuyang Sun and Xiaoyu Yue and Song Bai and Philip H. S. Torr},
  title = {{Visual Parser: Representing Part-whole Hierarchies with Transformers}},
  year = {2021},
  eprint = {2107.05790},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2107.05790},
}
Figure