[Feature]: Model Behavior Analysis under Kornia Augmentations (kornia.contrib)
#3,626 建立於 2026年3月17日
描述
🚀 Feature Description
Kornia provides powerful differentiable augmentations, but there is currently no built-in tooling to analyze how vision models behave internally when exposed to these augmentations.
I propose adding a small diagnostic utility that applies Kornia augmentations to an input image and analyzes how intermediate model representations change across layers. The goal is to measure layer sensitivity and representation stability under augmentation-induced perturbations.
The feature would primarily target research and debugging workflows and could live under kornia.contrib as experimental tooling.
📂 Feature Category
Augmentation
💡 Motivation
When training or evaluating vision models with augmentations, it is often unclear how those perturbations affect internal representations of the network. If model performance changes under augmentations, it is difficult to determine which layers are sensitive to the perturbations and whether the learned representations remain stable.
Currently, Kornia provides powerful augmentation operators, but there is no direct way within the ecosystem to inspect how models respond internally to those transformations.
Providing a lightweight analysis utility could help users better understand representation robustness, debug model behavior under augmentations, and study invariance properties of vision models.
💭 Proposed Solution
One possible approach would be to implement a small analysis utility that applies Kornia augmentations to an input image and measures how model representations change under those perturbations.
The workflow could look roughly as follows:
image ↓ Kornia augmentation pipeline ↓ model forward pass ↓ capture intermediate layer activations ↓ compute layer sensitivity scores ↓ analyze representation stability for selected layers ↓ evaluate robustness of the final embedding
Intermediate activations could be captured using PyTorch forward hooks, allowing the tool to remain model-agnostic and compatible with common PyTorch vision architectures.
Since this functionality is primarily intended for analysis and experimentation rather than core vision operators, it could potentially live under kornia.contrib.
🔄 Alternatives Considered
The same type of analysis can technically be performed using ad-hoc scripts by applying augmentations and manually inspecting intermediate activations. However, this approach usually requires implementing forward hooks, feature comparison logic, and analysis pipelines from scratch for each experiment.
While there are external robustness and interpretability libraries, they are generally designed around their own augmentation frameworks and do not integrate naturally with Kornia’s differentiable augmentation pipeline.
Providing a small utility within the Kornia ecosystem would make this type of representation analysis easier to perform while keeping the workflow fully compatible with Kornia-based augmentation pipelines.
🎯 Use Cases
• Robustness analysis – Evaluate how sensitive different layers of a vision model are to common augmentations such as rotations, blur, or brightness changes.
• Model debugging – Identify layers where representations change significantly under small perturbations, which can help diagnose instability or brittleness in trained models.
• Representation analysis – Study how internal feature representations evolve across layers when inputs are perturbed using Kornia augmentations.
• Research workflows – Support experiments related to invariance, robustness, and representation stability in vision models using Kornia-based augmentation pipelines.
📝 Additional Context
The analysis would rely on PyTorch forward hooks to capture intermediate activations and would remain model-agnostic so it can work with common PyTorch vision architectures.
The augmentation stage would leverage existing Kornia augmentation pipelines (e.g., AugmentationSequential), allowing users to analyze model behavior under the same transformations used during training or evaluation.
Since this functionality is primarily intended for experimentation and diagnostics rather than core operators, it would likely fit best under kornia.contrib.
🤝 Contribution Intent
- I plan to submit a PR to implement this feature
- I'm requesting this feature but not planning to implement it