Playground
Explore every BNNR augmentation visually — including XAI-driven ICD and AICD — then grab ready-to-run code templates.
ChurchNoise
Spatially-varying sensor noise


Partitions the image into regions using random lines, then applies a different noise profile (white, Gaussian, or pink) per region with configurable strength. Intensity blending controls how much of the augmented image replaces the original. Previews on this page use a stronger marketing preset: bnnr.augmentations.ChurchNoise (probability=1.0, intensity=1.0, num_lines=5, noise_strength_range=(12, 32)).
Helps models tolerate noise that varies spatially across the frame — typical of cheap cameras, low-light capture, or mixed sensor readouts — without assuming a single global noise profile.
Code Playground
Copy-paste ready templates for every BNNR workflow. Each example is self-contained and runnable as-is.
Full classification pipeline with XAI explainability. Trains a baseline, then iteratively searches for the best augmentation stack.
# pip install "bnnr[dashboard]"
from bnnr import quick_run, BNNRConfig
import torch.nn as nn
model = nn.Sequential(
nn.Conv2d(3, 32, 3, padding=1),
nn.BatchNorm2d(32),
nn.ReLU(),
nn.AdaptiveAvgPool2d(1),
nn.Flatten(),
nn.Linear(32, 10),
)
from torchvision import datasets, transforms
from torch.utils.data import DataLoader
transform = transforms.Compose([
transforms.Resize(96),
transforms.ToTensor(), # [0, 1] range — do NOT normalize
])
train_ds = datasets.STL10("data", split="train", download=True, transform=transform)
val_ds = datasets.STL10("data", split="test", download=True, transform=transform)
train_loader = DataLoader(train_ds, batch_size=64, shuffle=True)
val_loader = DataLoader(val_ds, batch_size=64)
result = quick_run(
model, train_loader, val_loader,
config=BNNRConfig(
m_epochs=5,
max_iterations=3,
device="auto",
xai_enabled=True,
report_preview_size=512,
report_xai_size=512,
)
)
print(f"Best accuracy: {result.best_metrics}")
print(f"Aug path: {result.best_path}")Photo credits (base images). Urban Traffic: © Countryball mys123, CC BY 4.0; cropped to 512×512; original on Wikimedia Commons. Underwater Marine: Jim Maragos, U.S. Fish and Wildlife Service, public domain; cropped; original on Wikimedia Commons. Augmented previews are generated with BNNR; saliency uses torchvision ResNet-18 weights.
Full detail: playground/ATTRIBUTION.md.