Abstract
There is a growing belief that deep neural networks with a shape bias may exhibit better generalization capabilities than models with a texture bias, because shape is a more reliable indicator of the object category. However, we show experimentally that existing measures of shape bias are not stable predictors of generalization and argue that shape discrimination should not come at the expense of texture discrimination. Thus, we propose a pseudo-task to explicitly boost both shape and texture discriminability in models trained via self-supervised learning. For this purpose, we train a ViT to detect which input token has been combined with an incorrect positional embedding. To retain texture discrimination, the ViT is also trained as in MoCo with a student-teacher architecture and a contrastive loss over an extra learnable class token. We call our method DILEMMA, which stands for Detection of Incorrect Location EMbeddings with MAsked inputs. We evaluate our method through fine-tuning on several datasets and show that it outperforms MoCoV3 and DINO. Moreover, we show that when downstream tasks are strongly reliant on shape (such as in the YOGA-82 pose dataset), our pre-trained features yield a significant gain over prior work.
Introduction
Despite the massive success of deep learning in computer vision, models often suffer from a "texture bias." They tend to identify objects based on local patterns—such as fur, scales, or fabric—rather than the overall geometry or "shape" of the object. This is a significant hurdle for generalization; while a silhouette of a cat remains recognizable as a cat regardless of its color or pattern, a model over-reliant on texture might fail if the lighting or material changes.
Current Self-Supervised Learning (SSL) methods like MoCo or DINO rely heavily on contrastive learning, teaching models that different views of the same image should have similar representations. While effective, these methods do not explicitly force the model to understand the spatial relationship between object parts. DILEMMA addresses this by challenging the model to identify which parts of an image are in the wrong place, effectively baking a "shape bias" into the learned features.
The DILEMMA Framework
The core of DILEMMA (Detection of Incorrect Location EMbeddings with Masked inputs) is a spatial reasoning task designed to improve geometric understanding. The pipeline operates as follows:
- Tokenization and Positional Corruption: An image is split into a grid of patches (tokens). Standard Vision Transformers (ViTs) add positional embeddings to these tokens to provide spatial context. DILEMMA intentionally "corrupts" a fraction of these by swapping the correct positional embedding of a token with an incorrect one from elsewhere in the image.
- Input Sparsity (Masking): To increase the difficulty of the task and accelerate training, a large percentage of tokens are discarded (masked) before being fed into the Student network. This prevents the model from relying on easy-to-find local texture cues.
- Teacher-Student Architecture: The system employs two networks. The Teacher processes the full, uncorrupted image to create a target representation, while the Student processes the sparse, corrupted version.
- Dual Loss Function: The model optimizes two goals simultaneously: a Contrastive Loss to align global representations and the DILEMMA Loss, a binary classification task where the model predicts whether each token's positional embedding is correct or mismatched.
Experimental Setup and Datasets
The researchers evaluated DILEMMA across a wide range of benchmarks to test both general performance and specific shape bias:
- Pre-training: Conducted on ImageNet-1K and ImageNet-100.
- Shape-Specific Evaluation: The Yoga-82 dataset was used for human pose classification. In this context, texture (clothing) is less informative than the geometric arrangement of body parts, making it an ideal test for shape bias.
- Downstream Tasks: Evaluation included 13 datasets such as CIFAR-10/100, ADE20K (semantic segmentation), and DAVIS (unsupervised object segmentation).
Key Results
DILEMMA consistently outperformed established baselines like MoCoV3 and DINO across various metrics:
- Accuracy and Efficiency: On ImageNet-1K linear probing, DILEMMA improved MoCoV3 by 4.41% and DINO by 3.97% under identical training time constraints. The use of input sparsity allowed for 2.5x larger mini-batches, significantly speeding up convergence.
- Superior Shape Encoding: The most dramatic results appeared in the Yoga-82 pose dataset. DILEMMA-trained models jumped from ~51% to ~57% accuracy, demonstrating a vastly superior ability to encode geometric information compared to standard SSL methods.
- Segmentation and Boundaries: The method yielded a 4.6% mIoU improvement in semantic segmentation on ADE20K, suggesting that spatial reasoning helps the model better identify object boundaries.
Conclusion
DILEMMA demonstrates that adding a spatial reasoning task acts as a powerful regularizer for Vision Transformers. By forcing the model to reconcile local patches with their global positions, it prevents "cheating" via texture cues and encourages a more robust understanding of object geometry. While currently tested on Small and Base ViT variants, the synergy between global contrastive goals and local spatial detection suggests that DILEMMA is a versatile and efficient "add-on" for future large-scale self-supervised models.
Summary updated