Table of Contents
Fetching ...

Stretching Beyond the Obvious: A Gradient-Free Framework to Unveil the Hidden Landscape of Visual Invariance

Lorenzo Tausani, Paolo Muratore, Morgan B. Talbot, Giacomo Amerio, Gabriel Kreiman, Davide Zoccolan

TL;DR

The paper tackles how visual units encode invariances beyond traditional excited-image visualizations by introducing Stretch-and-Squeeze (SnS), a gradient-free, model-agnostic framework that uses a generative model and CMA-ES to solve a bi-objective optimization in a latent space of dimension $n=4096$, seeking invariant images and adversarial perturbations. SnS probes invariance across multiple processing stages ($\kappa$) and target levels ($\ell$) by maximizing representation dissimilarity (stretch) while preserving downstream activation (squeeze), or vice versa for adversarial samples, with Pareto-front selection guiding the search. Applied to ResNet50, SnS reveals layer-specific invariant manifolds: pixel-space stretching mainly affects luminance/contrast, mid-level stretching alters texture/color, and high-level stretching shifts pose semantics, with invariances and dimensionality showing nonlinear, hierarchical structure. Comparisons between $L_2$-robust and standard networks show robust invariances are more human- and observer-recognizable at all levels but become less interpretable in deep layers, whereas standard networks show the opposite trend, highlighting how robustness shapes perceptual alignment and invariance. SnS offers a powerful, gradient-free tool for neuroscience and AI, capable of probing black-box systems and guiding the design of more human-aligned representations, while enabling analyses of invariance manifold geometry and cross-architecture transferability. The authors provide code, data, and detailed supplementary materials to support replication and future methodological extensions.

Abstract

Uncovering which feature combinations are encoded by visual units is critical to understanding how images are transformed into representations that support recognition. While existing feature visualization approaches typically infer a unit's most exciting images, this is insufficient to reveal the manifold of transformations under which responses remain invariant, which is critical to generalization in vision. Here we introduce Stretch-and-Squeeze (SnS), a model-agnostic, gradient-free framework to systematically characterize a unit's maximally invariant stimuli, and its vulnerability to adversarial perturbations, in both biological and artificial visual systems. SnS frames these transformations as bi-objective optimization problems. To probe invariance, SnS seeks image perturbations that maximally alter (stretch) the representation of a reference stimulus in a given processing stage while preserving unit activation downstream (squeeze). To probe adversarial sensitivity, stretching and squeezing are reversed to maximally perturb unit activation while minimizing changes to the upstream representation. Applied to CNNs, SnS revealed invariant transformations that were farther from a reference image in pixel-space than those produced by affine transformations, while more strongly preserving the target unit's response. The discovered invariant images differed depending on the stage of the image representation used for optimization: pixel-level changes primarily affected luminance and contrast, while stretching mid- and late-layer representations mainly altered texture and pose. By measuring how well the hierarchical invariant images obtained for L2 robust networks were classified by humans and other observer networks, we discovered a substantial drop in their interpretability when the representation was stretched in deep layers, while the opposite trend was found for standard models.

Stretching Beyond the Obvious: A Gradient-Free Framework to Unveil the Hidden Landscape of Visual Invariance

TL;DR

The paper tackles how visual units encode invariances beyond traditional excited-image visualizations by introducing Stretch-and-Squeeze (SnS), a gradient-free, model-agnostic framework that uses a generative model and CMA-ES to solve a bi-objective optimization in a latent space of dimension , seeking invariant images and adversarial perturbations. SnS probes invariance across multiple processing stages () and target levels () by maximizing representation dissimilarity (stretch) while preserving downstream activation (squeeze), or vice versa for adversarial samples, with Pareto-front selection guiding the search. Applied to ResNet50, SnS reveals layer-specific invariant manifolds: pixel-space stretching mainly affects luminance/contrast, mid-level stretching alters texture/color, and high-level stretching shifts pose semantics, with invariances and dimensionality showing nonlinear, hierarchical structure. Comparisons between -robust and standard networks show robust invariances are more human- and observer-recognizable at all levels but become less interpretable in deep layers, whereas standard networks show the opposite trend, highlighting how robustness shapes perceptual alignment and invariance. SnS offers a powerful, gradient-free tool for neuroscience and AI, capable of probing black-box systems and guiding the design of more human-aligned representations, while enabling analyses of invariance manifold geometry and cross-architecture transferability. The authors provide code, data, and detailed supplementary materials to support replication and future methodological extensions.

Abstract

Uncovering which feature combinations are encoded by visual units is critical to understanding how images are transformed into representations that support recognition. While existing feature visualization approaches typically infer a unit's most exciting images, this is insufficient to reveal the manifold of transformations under which responses remain invariant, which is critical to generalization in vision. Here we introduce Stretch-and-Squeeze (SnS), a model-agnostic, gradient-free framework to systematically characterize a unit's maximally invariant stimuli, and its vulnerability to adversarial perturbations, in both biological and artificial visual systems. SnS frames these transformations as bi-objective optimization problems. To probe invariance, SnS seeks image perturbations that maximally alter (stretch) the representation of a reference stimulus in a given processing stage while preserving unit activation downstream (squeeze). To probe adversarial sensitivity, stretching and squeezing are reversed to maximally perturb unit activation while minimizing changes to the upstream representation. Applied to CNNs, SnS revealed invariant transformations that were farther from a reference image in pixel-space than those produced by affine transformations, while more strongly preserving the target unit's response. The discovered invariant images differed depending on the stage of the image representation used for optimization: pixel-level changes primarily affected luminance and contrast, while stretching mid- and late-layer representations mainly altered texture and pose. By measuring how well the hierarchical invariant images obtained for L2 robust networks were classified by humans and other observer networks, we discovered a substantial drop in their interpretability when the representation was stretched in deep layers, while the opposite trend was found for standard models.

Paper Structure

This paper contains 31 sections, 5 equations, 15 figures, 4 tables, 1 algorithm.

Figures (15)

  • Figure 1: The Stretch-and-Squeeze (SnS) algorithm. (a) Overview of the SnS algorithm: candidate stimuli are synthetized from latent codes via the image generator, and the activation response of target units is recorded and used as fitness score by the optimizer, that adjusts a new set of codes. (b) Dual fitness objectives in SnS. To probe invariance (right), SnS maximizes stimulus distance from a reference in the representation space (stretch) and minimizes the variation in the activation of a target unit (squeeze). Conversely, to synthesize adversarial examples (left), SnS minimizes changes in the representation space, while maximizing the variation in the activation of the target unit.
  • Figure 2: SnS generates effective adversarial and invariant examples. The average activation reduction ($\pm$ SD) of $n=77$ readout units of a $L_2$-robust ResNet50 (relative to their MEIs) is plotted against the $L_2$ pixel distance from the MEIs, when the latter were transformed with SnS to yield either adversarial or invariant images, or were subjected to affine transformations (rotation, translation and scaling). The pixel distance refers to $224\times224$ RGB images with values between $0$ and $1$.
  • Figure 3: SnS discovers layer-specific invariances. (a) Example MEI and associated invariant images obtained for a readout neuron ("cup") in $L_2$-robust ResNet50 and computed for three different choices of the stretching representational stages (rows). Multiple results are shown for different random initialization seeds (columns) (b) Same as (a) but for a standard ResNet50. (c) Accuracy of a SVC in discriminating the three classes of invariant images produced by stretching pixel-, mid-, and high-level representations as a function of the number of principal components fed to the classifier.
  • Figure 4: Interpretability of the invariant images by humans and other networks. (a) Illustration of the human classification task with the invariant images generated by SnS for standard and $L_2$-robust networks. (b) Classification accuracies of humans (averaged across subjects and categories) displayed for each experimental condition. (c) Classification accuracies across multiple $L_2$-robust (left) and standard (right) networks. (d) Correlation coefficient between average human performances and the performances of each observer model. For each architecture, the darker color indicates the robust model and the lighter color indicates the standard version. (e) Analysis from (c) extended to multiple architectures: ResNet50, ResNet18, and VGG16_bn. Solid lines indicate the average between different observer networks (translucent lines).
  • Figure S1: Examples of solutions in the final Pareto Front. Visualization of the final Pareto fronts for $n=4$ example units in Invariance experiments (top) and $n=4$ example units in Adversarial Attack experiments (bottom). In all reported experiments, targets were located in the readout layer, while pixel space was used as lower representation space. The ordinate axis represents the activation reduction of a readout unit of a robust or standard ResNet50 with respect to the activation produced by a reference image (MEI), when SnS is applied to synthesize either adversarial or invariant images, while the abscissa represents the $L_2$ pixel distance between these synthesized images and the reference. In the Invariance Experiments, SnS maintains a substantial fraction of the reference image activation (regardless of whether the optimization fully converges) while allowing the synthesized images to diverge markedly from the reference in pixel space. Conversely, in the Adversarial Attack setting, SnS reliably produces images that almost completely suppress the response of the target unit, yet remaining comparatively close to the MEI in the pixel space representation. Note the different scale range of the abscissa and ordinate axes between the top and bottom plots.
  • ...and 10 more figures