Skip to main content

BNNR — Train → Explain → Improve → Prove

Project description

BNNR Logo

PyPI Python GitHub stars PyPI downloads License CI

Watch BNNR demo with audio on bnnr.dev

Full demo with audio (4K): bnnr.dev

BNNR (Bulletproof Neural Network Recipe)

BNNR automatically improves your PyTorch vision models using XAI — find what your model gets wrong, fix it with intelligent augmentation, and prove the result with structured reports and a live dashboard.

Already have a trained model? Run bnnr analyze for a full diagnostic report (metrics, XAI, failure patterns, recommendations) — no retraining. See Model analysis docs.

Supported tasks (v0.4.0): single-label classification, multi-label classification, and object detection (COCO-mini / YOLO). See Detection docs.

python3 -m bnnr analyze --model checkpoints/best.pt --data cifar10 --output ./analysis_out

XAI-driven augmentations (ICD & AICD)

BNNR uses saliency maps to guide augmentation — not random flips and crops.

ICD — mask what the model looks at

ICD — masks the regions the model already focuses on (highest saliency), forcing it to learn from context instead of shortcuts.

AICD — mask what the model ignores

AICD — masks low-saliency background and irrelevant textures, sharpening focus on discriminative features.


Benchmarks

Dataset Baseline + BNNR Gain
Coming soon

Reproducible benchmark results on CIFAR-10, STL-10, and Fashion-MNIST will be published here. Track progress in GitHub Issues.


Quickstart

pip install "bnnr[dashboard]"

python3 -m bnnr train --dataset cifar10 --preset light --with-dashboard

Interactive wizard (same built-in defaults, sample limits 128/64):

python3 -m bnnr quickstart

Open http://127.0.0.1:8080/ for the live dashboard (QR code in terminal for mobile on the same Wi-Fi).

Advanced: pass --config path.yaml to override defaults.


Live dashboard

Real metrics from a BNNR training run — branch tree, charts, XAI previews, and dataset insights.

Overview Branch Tree Metrics
Dashboard Overview Branch Tree Metrics
Samples & XAI Analysis Dataset Insight
Samples and XAI Analysis Dataset Insight

What makes BNNR different

  • XAI-driven augmentation (ICD / AICD) — augmentations guided by saliency maps; no other PyTorch toolkit combines explainability and data augmentation this way.
  • Auto-augmentation search — iterative branching keeps only augmentations that measurably improve your validation metric.
  • Auditable reports — structured JSON reports with metrics, XAI heatmaps, and branch decisions for stakeholders or compliance review.

Links

Resource URL
Website bnnr.dev
Documentation docs/README.md
Examples docs/examples.md
Colab (classification) Open in Colab
API reference docs/api_reference.md
Model analysis (bnnr analyze) docs/analyze.md

Python API

from bnnr import quick_run, BNNRConfig

result = quick_run(
    model,
    train_loader,
    val_loader,
    config=BNNRConfig(m_epochs=5, max_iterations=3, device="auto"),
)
print(result.best_metrics)

See Golden path and API reference for custom adapters and detection.


Documentation

Install from source, CLI reference, full doc index

Install from source

git clone https://github.com/bnnr-team/bnnr.git
cd bnnr
(cd dashboard_web && npm ci && npm run build)
pip install -e ".[dev,dashboard]"

The PyPI wheel ships the bnnr package only. Runnable scripts (examples/), notebooks, and the documentation tree (docs/) live in this repository.

Main CLI commands

python3 -m bnnr --help
python3 -m bnnr train --help
python3 -m bnnr analyze --help
python3 -m bnnr report --help
python3 -m bnnr list-datasets
python3 -m bnnr list-augmentations -v
python3 -m bnnr list-presets
python3 -m bnnr dashboard serve --run-dir reports --port 8080
python3 -m bnnr dashboard export --run-dir reports/run_YYYYMMDD_HHMMSS --out exported_dashboard

Doc index

Requirements

  • Python >=3.10
  • Core: torch, torchvision, numpy, typer, pydantic, pyyaml, grad-cam
  • Dashboard extra: fastapi, uvicorn, websockets, qrcode

License

MIT License — use BNNR freely in research, production, and commercial projects.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bnnr-0.4.0.tar.gz (11.4 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bnnr-0.4.0-py3-none-any.whl (1.9 MB view details)

Uploaded Python 3

File details

Details for the file bnnr-0.4.0.tar.gz.

File metadata

  • Download URL: bnnr-0.4.0.tar.gz
  • Upload date:
  • Size: 11.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for bnnr-0.4.0.tar.gz
Algorithm Hash digest
SHA256 a97d07e85e523e16802ca9d57865b1eb6a93b3c12229e3627e3f50e694d7e465
MD5 479200e24a658555e3daf9cc0ce6c1b8
BLAKE2b-256 55f892858d54898b390f5afcb201ae2af8bcd319f6a8d900b98c0bacd3a42522

See more details on using hashes here.

Provenance

The following attestation bundles were made for bnnr-0.4.0.tar.gz:

Publisher: ci.yml on bnnr-team/bnnr

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bnnr-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: bnnr-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 1.9 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for bnnr-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 95736e610f55231865e3fdce7dde85baf158ba2e8998cc3693f53307293ad627
MD5 fcde0c84a569bc5ff714f9176e09f025
BLAKE2b-256 03d7a10cda03b6bc847a1829b4ca04bd204e43dff7fbf0012c55068fa7bc3a5d

See more details on using hashes here.

Provenance

The following attestation bundles were made for bnnr-0.4.0-py3-none-any.whl:

Publisher: ci.yml on bnnr-team/bnnr

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page