Emergence of Shape Bias in Convolutional Neural Networks through Activation Sparsity

Tianqin Li, Ziqi Wen, Yangfan Li, Tai Sing Lee

Abstract

Current deep-learning models for object recognition are known to be heavily biased toward texture. In contrast, human visual systems are known to be biased toward shape and structure. What could be the design principles in human visual systems that led to this difference? How could we introduce more shape bias into the deep learning models? In this paper, we report that sparse coding, a ubiquitous principle in the brain, can in itself introduce shape bias into the network. We found that enforcing the sparse coding constraint using a non-differential Top-K operation can lead to the emergence of structural encoding in neurons in convolutional neural networks, resulting in a smooth decomposition of objects into parts and subparts and endowing the networks with shape bias. We demonstrated this emergence of shape bias and its functional benefits for different network structures with various datasets. For object recognition convolutional neural networks, the shape bias leads to greater robustness against style and pattern change distraction. For the image synthesis generative adversary networks, the emerged shape bias leads to more coherent and decomposable structures in the synthesized images. Ablation studies suggest that sparse codes tend to encode structures, whereas the more distributed codes tend to favor texture.

Introduction: The Texture Bias Problem

A fundamental discrepancy exists between artificial and biological vision. While humans recognize objects primarily by their global shape and structural geometry, standard Convolutional Neural Networks (CNNs) are notoriously "lazy," relying heavily on local textures. This phenomenon, known as texture bias, makes deep learning models fragile; a model trained to recognize a cat may fail if that cat is rendered with the texture of an elephant, even if the silhouette remains unmistakable.

Previous attempts to rectify this have relied on massive data augmentation, such as training on "stylized" datasets. However, this research, presented at NeurIPS 2023, explores a more intrinsic solution: Activation Sparsity. By mimicking the brain's sparse coding principle—where only a small fraction of neurons fire at any given time—the authors demonstrate that shape bias naturally emerges from the architectural constraint itself.

The Mechanism: Spatial Top-K Sparsity

The authors propose a biologically inspired Spatial Top-K Layer. In a standard CNN, activations are dense and distributed. In the proposed sparse model, the network identifies the $K$ largest absolute responses in each channel across all spatial locations, zeroing out all other activations.

This simple architectural tweak forces the network to prioritize the most salient features. To understand what these sparse neurons were learning, the researchers employed texture synthesis and reconstruction techniques. By "asking" the network to reconstruct an image using only its Top-K (strongest) neurons versus its non-Top-K (weakest) neurons, they discovered a clear functional division: the strongest activations encode structural parts, while the weaker "tail" activations handle texture and color.

Experimental Results

1. Object Recognition and Robustness

The researchers tested the Top-K constraint on standard architectures like ResNet-18, AlexNet, and VGG16 using several benchmarks:

  • Cue-Conflict Benchmark: This is the gold standard for measuring shape bias, featuring images where object shapes are filled with conflicting textures (e.g., a bottle shape filled with a clock texture). Sparse CNNs pushed the frontier of shape bias significantly closer to human performance levels.
  • Stylized ImageNet: A ResNet-18 trained with Top-K sparsity improved accuracy on texture-distorted images from 49.3% to 55.4%, while maintaining its performance on standard ImageNet data.
  • Zero-Shot Emergence: Remarkably, the authors found that simply inserting a Top-K operation into a pre-trained AlexNet during inference—without any additional training—immediately increased its shape bias.

2. Image Synthesis and Semantic Decomposition

The benefits of sparsity extend to Generative Adversarial Networks (GANs). In few-shot image generation tasks (using datasets like Jeep-100 and Fish-100), adding Top-K sparsity to a FastGAN model improved the FID score (a measure of image quality) by 21.1% for the Jeep category. More importantly, the sparsity led to "semantic decomposition." Instead of generating "melty" or incoherent pixels, the network learned to generate distinct, composable parts—such as wheels, windows, and chassis—that formed a coherent whole.

Why Sparsity Favors Shape

A key insight from the paper's ablation studies is the "Mean Replacement" experiment. The authors found that the location of firing neurons (the occupancy map) carries significantly more shape information than the exact intensity (the activation value). Sparse coding forces the network to focus on these spatial coordinates, effectively creating a "skeleton" of the object. In contrast, distributed codes allow the network to spread information across many low-intensity neurons, which is ideal for capturing repetitive texture patterns but poor for defining structural boundaries.

Limitations and Future Directions

While promising, the Top-K approach introduces new challenges:

  • Hyperparameter Tuning: The value of $K$ is sensitive; the optimal level of sparsity varies depending on the image complexity and the specific layer depth.
  • Computational Overhead: Although sparsity can reduce data transfer in distributed systems, the sorting operation required for Top-K adds computational cost during the training phase.
  • Scaling: Future work is needed to determine if these principles translate effectively to Vision Transformers (ViTs), which handle spatial information differently than CNNs.

Conclusion

By enforcing activation sparsity, this research provides a compelling path toward AI that "sees" the world more like humans do. By prioritizing the enduring reality of shape over the fleeting distraction of texture, sparse CNNs achieve greater robustness and more interpretable internal representations, bringing us one step closer to truly resilient computer vision.

Summary updated

BibTeX
@inproceedings{li2023emergence,
  author = {Tianqin Li and Ziqi Wen and Yangfan Li and Tai Sing Lee},
  title = {{Emergence of Shape Bias in Convolutional Neural Networks through Activation Sparsity}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2023},
  url = {https://openreview.net/forum?id=QzcZb3fWmW},
}
Figure