Introduction
In modern deep learning, the architecture of a neural network is defined not just by its connectivity but also by its "shape"—the spatial dimensions (height and width) of feature maps at each layer. Traditionally, this shape is a human-designed hyperparameter. Researchers manually determine where to downsample using fixed operations like stride-2 convolutions or 2x2 pooling. However, these fixed resizing factors are often sub-optimal, especially when a model designed for one resolution (e.g., ImageNet) is applied to another (e.g., CIFAR-10).
Shape Adaptor is a differentiable, "drop-in" module that allows neural networks to automatically learn their own spatial resizing factors during training. By moving away from rigid, human-defined shapes, this approach optimizes the network's inductive bias directly from data.
The Shape Adaptor Module
The core of the Shape Adaptor is a differentiable module that can be integrated into standard convolutional neural networks (CNNs). It replaces fixed resizing layers with a learnable mechanism that searches a continuous space of resizing factors.
Mechanism and Optimization
As shown in the figure above, the module employs a two-branch architecture:
- Dual Resizing Branches: Each module contains two resizing paths (e.g., one branch downsamples by a factor $r_1=0.5$, while the other maintains $r_2=1.0$).
- Learnable Weighting: A scalar parameter $\alpha$, passed through a sigmoid function, determines the relative importance of each branch.
- Adaptive Resizing Layer: To merge the outputs, the module uses an internal bilinear interpolation layer. This layer reshapes intermediate features into a common spatial dimension defined by the learnable factor $s(\alpha) = (1 - \alpha)r_1 + \alpha r_2$.
- Memory Management: Because networks may naturally favor larger feature maps to preserve information, the authors introduce a dynamic penalty term ($\rho$) to ensure the learned shape stays within a user-defined GPU memory budget.
Experimental Evaluation
The authors evaluated Shape Adaptor across seven diverse image classification datasets, ranging from small-resolution sets like CIFAR-10 and SVHN to fine-grained datasets like FGVC-Aircraft and CUBS-200-2011, and large-scale benchmarks like ImageNet. The module was tested using three popular baselines: VGG-16, ResNet-50, and MobileNetv2.
Key Results and Insights
The experiments demonstrated that "shape" is as critical as connectivity. Even with an identical number of parameters, networks with learned shapes consistently outperformed human-designed counterparts. For instance, on the Aircraft dataset, MobileNetv2's accuracy improved from 77.64% to 83.00%.
As illustrated in the comparison above, Shape Adaptors often discover a "Goldilocks" resolution—preserving higher resolutions in early layers and downsampling more aggressively later—that differs significantly from standard human heuristics. This automated discovery eliminates the need for manual trial-and-error when transferring models between domains.
Beyond standard training, the authors introduced two specific applications:
- AutoTL (Transfer Learning): Shape Adaptor outperformed state-of-the-art transfer learning methods like PackNet and SpotTune on 4 out of 5 benchmarks.
- AutoSC (Shape Compression): The module can be used to "compress" networks by identifying the smallest possible feature map dimensions that maintain high accuracy, often surpassing human-designed "slim" model variants.
Limitations and Future Work
While effective, the Shape Adaptor currently relies on a logarithmic heuristic to determine where modules should be inserted, as placing them in every layer can sometimes degrade performance. Additionally, without explicit memory constraints, the modules tend to converge toward the largest possible shapes. Future research may explore multi-branch designs with more than two resizing options and the application of learnable shapes in multi-task learning environments.
Summary updated