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. All previews on this page were generated with bnnr.augmentations.ChurchNoise (probability=1.0, intensity=0.5, num_lines=3).
Trains the model to handle noise that varies spatially across the frame — the kind produced by cheap cameras, low-light conditions, or mixed sensor readouts. Benchmark-proven to improve accuracy on SVHN (+4.6pp).
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}")