For years, the computer vision community operated under a comfortable assumption: Convolutional Neural Networks (CNNs) learn a hierarchy of features, starting with simple edges and culminating in complex object shapes. However, recent research threw a wrench in this theory, suggesting that CNNs are actually "texture addicts," often ignoring an object's global shape in favor of local patterns like fur or fabric.
A fascinating paper from ICLR 2021, "Shape or Texture: Understanding Discriminative Features in CNNs," goes deeper than ever before to settle this debate. Instead of just looking at what a network predicts, the authors probe the "latent representations"—the internal brain states of the model—to find out exactly where, when, and how shape information is stored.
TL;DR
While CNNs are often biased toward texture, they actually encode a surprising amount of shape information in their later layers. This paper reveals that networks learn the bulk of their shape-processing capabilities in the first few epochs of training, but knowing an object's shape doesn't necessarily mean the network understands its semantic class at a pixel level.
What Problem Does This Paper Address?
Previous studies on "texture bias" mostly looked at the final output of a network. For example, if you show a model a "cat" made of "elephant skin" texture (a stylized image), and it predicts "elephant," we say it has a texture bias.
But this "black box" approach has flaws. It doesn't tell us if the network saw the cat shape but chose to ignore it, or if it failed to encode the shape entirely. Furthermore, it doesn't explain where in the network this information lives or when it appears during the training process. The authors wanted to move beyond simple classification labels to a per-pixel understanding of what the network actually "knows."
Methods
The researchers used two clever "probing" techniques to audit the internal state of CNNs (specifically ResNets):
- Dimensionality Estimation: They used mutual information to estimate how many "neurons" (dimensions in the feature space) are dedicated to shape versus texture. By feeding the network pairs of images that share a shape but have different textures (and vice versa), they could calculate which neurons were firing consistently for which feature.
- Read-out Modules: They froze the weights of a pre-trained CNN and attached a tiny, three-layer "decoder" to its internal layers. They then tasked this decoder with performing two jobs: Binary Segmentation (just finding the silhouette/shape of the object) and Semantic Segmentation (finding the shape and identifying the class). If a simple decoder can extract a perfect mask from a frozen layer, it proves that the information was already there.
Datasets
To thoroughly test these models, the authors utilized several datasets:
- ImageNet (IN): The standard benchmark for image classification.
- Stylized ImageNet (SIN): Images where the texture is replaced by artistic styles (e.g., a bird made of van Gogh brushstrokes) to force a focus on shape.
- PASCAL VOC 2012: Used for evaluating segmentation performance.
- Stylized PASCAL VOC (SVOC): A new benchmark introduced by the authors. They applied style transfer to the PASCAL dataset, allowing them to test per-pixel shape encoding on images with conflicting texture cues.
Key Insights and Ideas
- The "Early Bird" Effect: Surprisingly, CNNs learn almost all the shape information they will ever know within the first 10 epochs of training. After that, the network mostly fine-tunes its classification logic, but the "detectors" for shape are already set.
- Shape is a "Late Layer" Luxury: While early layers handle edges and blobs, the actual 2D silhouette (shape) of an object is primarily encoded in the very last stages of the feature extractor.
- Shape $\neq$ Semantics: This is the "aha" moment. The authors found that a network can be very good at outlining an object (Binary Segmentation) without having any idea what that object is (Semantic Segmentation).
As seen in the figure above, when presented with a stylized image (a bird with conflicting textures), the network can often "see" the object's boundary perfectly (Shape heatmap). However, it assigns incorrect, texture-driven class labels (like Dog or Sheep) to the pixels inside that boundary (Semantic mask).
- Depth Matters: Deeper networks (like ResNet-152) naturally dedicate more neurons to shape encoding than shallower ones (ResNet-50), likely because they have the "capacity" to build more complex hierarchical representations.
Key Results
- Shape Encoding Efficiency: In a standard ResNet-50, about 17% of the neurons in the final stage encode shape, while 33.8% encode texture. When trained on Stylized ImageNet, the shape-encoding neurons jump to 26.2%.
- The 97% Mark: The authors showed that 97.1% of the final "shape knowledge" (measured by binary mIoU) is acquired in just the first 10% of ImageNet training.
- Read-out Success: Even a model trained only for classification (ImageNet) contains enough internal information to achieve a 70.6% mIoU on binary shape extraction. This proves that shape is a "discriminative feature" the network uses, even if it's not explicitly told to look for it.
Limitations and Future Work
The authors acknowledge that their definition of "shape" is limited to 2D class-agnostic silhouettes. They don't account for 3D structure or internal object parts.
Additionally, while they show where shape is, they haven't yet solved the "bias" problem—even though the shape info is present in the latent layers, the final classification layer often chooses to trust texture more. Future work could involve designing architectures or loss functions that force the final classifier to "listen" more closely to the shape-encoding neurons discovered in this study.
Reference: Islam, M. A., Kowal, M., Esser, P., Jia, S., Ommer, B., Derpanis, K. G., & Bruce, N. D. B. (2021). Shape or Texture: Understanding Discriminative Features in CNNs. ICLR 2021.
Summary updated