TL;DR
This paper investigates the performance of auto-regressive versus parallel Transformers for predicting polygonal shapes in images, framing it as a set prediction problem. They find that auto-regressive Transformers excel when there's a natural order to the elements being predicted (like points along a line), while parallel Transformers are better for unordered sets and higher cardinality, though they require oversampling.
What Problem Does This Paper Address?
Predicting polygonal shapes in images is a crucial task for applications like extracting building outlines from satellite imagery or enabling vision-based navigation for drones. This problem is challenging because polygons can have a variable number of vertices (cardinality) and, when treated as a set of points, are inherently permutation-invariant. While Transformers have shown great success in sequence modeling and set prediction, it's unclear how their two main prediction paradigms – auto-regressive (one element at a time) and parallel (all elements at once) – perform on visual set prediction tasks, especially those involving geometric shapes like polygons. This paper aims to bridge this gap by systematically comparing these two Transformer approaches on various polygonal shape prediction tasks.
Methods
The core of this work lies in comparing two Transformer architectures for set prediction:
- Parallel Transformers: These models, inspired by DETR (DEtection TRansformer), predict all elements of a set simultaneously. They leverage an attention mechanism to aggregate information from the entire input and output, inherently handling permutation invariance. For tasks with a variable number of elements, they often require strategies like oversampling object queries to ensure good performance.
- Auto-regressive Transformers: These models generate the output sequence (or set) element by element, conditioning each prediction on the previously generated elements. This approach is akin to machine translation. For visual set prediction, this involves defining special tokens (e.g., "start," "end," "end-of-polygon") and treating the prediction of a polygon as a sequence of point predictions.
The authors adapt existing Transformer architectures, primarily based on DETR, to implement both parallel and auto-regressive models for their polygonal shape prediction tasks.
Datasets
The paper utilizes a combination of toy and synthetic datasets:
- Point Dataset: Images with a variable number of white points. This is a pure set prediction task where points are unordered.
- Line Dataset: Images containing a single white line composed of 7 segments, with 8 points defining the line. This dataset has an explicit natural order for the points.
- Gate Dataset: Images with convex polygons (gates) of 4 corners.
- Polygon Dataset: Images with non-convex polygons of 3 to 7 corners. This is framed as predicting an ordered set of points that form a polygon.
- Synthetic Gate Dataset: Realistic synthetic images simulating drone flight through wireframe objects (gates), generated using a graphical engine. This dataset increases complexity with varying backgrounds and lighting.
The toy datasets were manually generated with millions of training images and thousands for testing. The synthetic gate dataset had 26,000 training and 3,000 testing images.
Key Insights and Ideas
- Order Matters: The presence of a natural order in the data (like points along a line) significantly benefits auto-regressive Transformers, allowing them to achieve near-perfect performance where parallel models struggle.
- Cardinality Trade-off: Auto-regressive models perform well on low-cardinality sets but degrade as the number of elements increases. Conversely, parallel models handle higher cardinality better, especially with oversampling strategies.
- Decomposition Benefit: Decomposing complex polygons into sequences of points and predicting them auto-regressively offers a substantial advantage, potentially due to the conditional decomposition acting as a strong inductive bias.
- Oversampling Necessity: Parallel Transformers, particularly for tasks like gate detection, require oversampling of object queries to achieve competitive results, especially when dealing with higher cardinality.
- Positional Encodings Nuance: For auto-regressive models in this visual context, fixed positional encodings were found to be detrimental, unlike in NLP tasks. An imposed spatial order (left-to-right, top-to-bottom) was more beneficial.
Key Results
- Line Dataset: Auto-regressive models achieved near-perfect mAP (98.36%) on the line dataset, significantly outperforming parallel models (25.04% mAP), highlighting the importance of natural order.
- Point Dataset: Auto-regressive models showed a slight advantage for low cardinality but deteriorated significantly as the number of points increased, while parallel models performed more consistently.
- Gate Datasets (Toy & Synthetic): Parallel models with oversampling outperformed those without and generally performed better than auto-regressive models on higher cardinality gate collections. Auto-regressive models were comparable on low-cardinality gate datasets.
- Polygon Dataset: Auto-regressive models outperformed parallel models by over 20% mAP, attributed to the ability to decompose polygons into ordered point sequences.
- Speed: Auto-regressive models were approximately twice as fast as parallel models on the polygon dataset, as they avoided Hungarian matching and oversampling.
Limitations and Future Work
- Dataset Bias: The authors acknowledge that most experiments were conducted on toy datasets, and it's unclear how these findings generalize to more challenging, real-world datasets.
- Future Exploration: They suggest expanding research to polygonal building segmentation from satellite images. Further exploration into learned token embeddings and testing the effect of fixed or learned positional encodings are also proposed. The authors also note that polygon detection is a fundamental problem and warrants further investigation.
Summary updated