Abstract
The CLEVR dataset has been used extensively in language grounded visual reasoning in Machine Learning (ML) and Natural Language Processing (NLP) domains. We present a graph parser library for CLEVR, that provides functionalities for object-centric attributes and relationships extraction, and construction of structural graph representations for dual modalities. Structural order-invariant representations enable geometric learning and can aid in downstream tasks like language grounding to vision, robotics, compositionality, interpretability, and computational grammar construction. We provide three extensible main components - parser, embedder, and visualizer that can be tailored to suit specific learning setups. We also provide out-of-the-box functionality for seamless integration with popular deep graph neural network (GNN) libraries. Additionally, we discuss downstream usage and applications of the library, and how it accelerates research for the NLP research community.
Introduction
The CLEVR dataset is a cornerstone for evaluating an AI's ability to reason about 3D shapes, colors, and spatial relationships. However, most contemporary models treat CLEVR as a "black box" task, mapping raw pixels and text strings directly to answers. This approach often bypasses the underlying compositional logic of the scene. Geometric Learning, specifically through Graph Neural Networks (GNNs), is naturally suited for reasoning about objects and their relationships. Yet, a standardized, easy-to-use tool to transform CLEVR’s multimodal data into graph structures has been missing. Researchers have often had to build custom, brittle pipelines to extract attributes and relationships into a format GNNs can process.
Methods
The CLEVR Parser library addresses this gap with three extensible core components:
1. The Parser
The Parser acts as the library's core logic engine. It processes language utterances and image scene graphs to produce structural graph representations ($G_s$ for text, $G_t$ for images). It utilizes a custom Named Entity Recognizer (NER) built on the SpaCy NLP library to identify object attributes and spatial predicates within text.
2. The Embedder
This component transforms parsed graphs into latent embeddings. It generates feature matrices for nodes and edges that are natively compatible with deep learning frameworks like PyTorch Geometric. The embedder supports various backends, ranging from simple one-hot encodings to sophisticated Transformer models like BERT or GPT-2.
3. The Visualizer
To aid in model debugging and interpretability, the library includes tools to render these complex graphs. It can generate structural representations that explicitly link attributes to objects and define the relationships between them.
Datasets
The library is optimized for the CLEVR dataset. Additionally, the authors provide specialized subsets:
- 1obj: A curated dataset featuring parsed image scenes using Mask-RCNN semantic segmentation.
- 1obj-CoGenT: A version designed for testing "Compositional Generalization," requiring models to handle attribute combinations in the test set that were absent during training.
Key Insights and Ideas
- Structural Order-Invariance: Unlike text sequences, graphs are naturally invariant to the order of attributes. Whether a prompt says "large red rubber ball" or "red large rubber ball," the resulting graph is identical, enhancing model robustness.
- Multimodal Alignment: The library can construct a joint graph ($G_u$) by connecting text nodes to image nodes, providing a ground-truth structure for referring expression tasks.
- Semantic Clustering: t-SNE visualizations of the generated embeddings show that similar question templates naturally group together, suggesting the graph-based approach effectively captures the underlying programmatic logic of the queries.
Key Results
The primary contribution of this work is a utility-focused library that simplifies GNN integration:
- Seamless GNN Integration: The library outputs standard $(X, A, E)$ tuples (Features, Adjacency, Edges), allowing researchers to plug CLEVR data into a GNN with minimal code.
- Logical Decomposition: Complex spatial queries are successfully decomposed into clear, hierarchical graph structures that align with the ground-truth logic of the CLEVR environment.
Limitations and Future Work
Currently, the library is optimized for the synthetic CLEVR environment. While it supports Mask-RCNN for image parsing, transitioning to "in-the-wild" scenes (e.g., Visual Genome) would require more robust relationship extraction. Future work aims to extend support to diverse physics engines and causal reasoning tasks, potentially aiding agents in learning to manipulate objects in 3D environments based on natural language.
Summary updated