What is BANOS?
BANOS is a set of metrics for evaluating algorithmic behavior annotations against a ground truth (typically human annotations). It is designed for ethology and computer vision workflows where researchers annotate behaviors in video data.
Traditional frame-based metrics (precision/recall/F1) capture detection accuracy but miss important temporal qualities: does the predicted segment overlap well with the ground-truth bout? Does the prediction start and end at the right time? Is the prediction internally consistent, or does it flicker on and off inside the bout?
BANOS addresses these questions with four complementary metrics.
The 4 BANOS Metrics
-
Detection Accuracy (DA) — Precision, Recall, and F1 score over matched behavioral segments (TP/FP/FN at the bout level).
-
Segment Overlap (SO) — Temporal Intersection over Union (tIoU) between each matched predicted segment and its ground-truth counterpart.
-
Temporal Precision (TP) — Penalizes start/end time errors:
1 / (1 + |start deviation| + |end deviation|). -
Intra-bout Continuity (IC) — Measures label stability inside each ground-truth bout:
1 - (label switches / bout length).
Installation
pip install banos
Requires Python 3.11+. Core dependency: pandas. Optional: scipy (for
matching='optimal').
Quick Start
import banos
import pandas as pd
# Load annotations as DataFrames (rows=frames, columns=behaviors, values=0/1)
pred = pd.read_csv("machine_annotations.csv")
gt = pd.read_csv("human_annotations.csv")
# Score a single recording
metrics = banos.score(pred, gt)
# {'behavior1': {'precision': 0.9, 'recall': 0.85, 'f1_score': 0.87,
# 'so': 0.76, 'tp': 0.82, 'ic': 0.91}, ...}
# Score multiple recordings
group_metrics, overall_metrics = banos.score({
'recording_1': (pred_1, gt_1),
'recording_2': (pred_2, gt_2),
})
banos.score() returns:
- Single recording:
dict[behavior → dict[metric → float]] - Multiple recordings:
(per-recording metrics, overall averaged metrics)
Absent-behavior scoring (v0.2.0): when a behavior has no ground-truth bouts, BANOS checks whether the machine also predicted nothing — if so, all metrics = 1.0 (correct absence); if the machine predicted bouts that don't exist in GT, all metrics = 0.0 (false detection). This is excluded from NaN-averaging correctly.
Examples & Tutorials
| Resource | Description |
|---|---|
demo/quickstart.py |
Minimal Python example — score annotations in two lines |
demo/quickstart.m |
Minimal MATLAB example |
demo/tutorial_python.ipynb |
Full Python tutorial: classic BANOS usage + frame F1 vs BANOS comparison |
demo/tutorial_matlab.m |
Full MATLAB tutorial mirroring the Python notebook |
demo/tutorial_calms21_task1.ipynb |
Human vs machine: CalMS21 Task 1 baseline, F1 + BANOS (Python only) |
Advanced Usage
Optimal Matching
By default, predicted segments are matched to ground-truth bouts greedily (by overlap). For a globally optimal assignment, use the Hungarian algorithm:
metrics = banos.score(pred, gt, matching='optimal')
Requires scipy (pip install scipy).
Lower-level API
from banos import preprocess_data, calculate_banos_for_each_file, aggregate_metrics
data_dict = {
'file1': (pred_df_1, gt_df_1),
'file2': (pred_df_2, gt_df_2),
}
preprocessed, dropped = preprocess_data(data_dict)
per_file_metrics = calculate_banos_for_each_file(preprocessed)
group_metrics, overall = aggregate_metrics(per_file_metrics)
MATLAB
A MATLAB implementation is provided in matlab/BANOS/. Usage mirrors the Python API.
% Add toolbox to path
run('matlab/BANOS/setup.m');
% Score a single recording (pred/gt = cell arrays: row 1 = headers, rows 2+ = binary data)
metrics = BANOS_score(pred, gt);
% Score multiple recordings
dataStruct.Recording_1 = {pred1, gt1};
dataStruct.Recording_2 = {pred2, gt2};
[groupMetrics, overallMetrics] = BANOS_score(dataStruct);
See demo/tutorial_matlab.m for a full walkthrough.
Also available on MATLAB File Exchange.
Contributing
BANOS is functionally complete by design. We welcome bug reports and documentation improvements. See CONTRIBUTING.md for details on how to report issues, submit fixes, and the project's maintenance lifecycle.
To report a security vulnerability, see SECURITY.md — please do not use public GitHub Issues for security reports.
Citation
If you use BANOS, please cite:
Chindemi G., Bellone C., Girard B. From eye to AI: studying rodent social behavior in the era of machine learning. arXiv:2508.04255 (2025). https://doi.org/10.48550/arXiv.2508.04255
@article{chindemi2025eye,
title = {From eye to {AI}: studying rodent social behavior in the era of machine learning},
author = {Chindemi, Giuseppe and Bellone, Camilla and Girard, Benoit},
journal = {arXiv preprint arXiv:2508.04255},
year = {2025},
doi = {10.48550/arXiv.2508.04255}
}
Changelog
See CHANGELOG.md for release history.
License
MIT — see LICENSE.
Metadata
Release files for banos 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| banos-1.0.0.tar.gz | 1.2 MB | With provenance | Details for banos-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| banos-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for banos-1.0.0-py3-none-any.whl |
Total release size: 1.2 MB
Release files / banos-1.0.0.tar.gz
| Download URL | banos-1.0.0.tar.gz |
|---|---|
| Size | 1.2 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b5b1f299531d8182a2188c106bca7f9ee5742245bb24be77217094aef96ce07a
|
|
BLAKE2b-256 checksum How to use checksums |
20b562e1ee33b75b0976432b0ef9fe35f3f392f510d7f28bdeb77479864e26d2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 10, 2026.
Transparency logRelease files / banos-1.0.0-py3-none-any.whl
| Download URL | banos-1.0.0-py3-none-any.whl |
|---|---|
| Size | 11.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
956de0c490855e98a3412c08b8070481b1b54ecd8644648fb7cec731ab91e75d
|
|
BLAKE2b-256 checksum How to use checksums |
644b1e58e6995f545c82642a5cee7a25bc4c9a40efcf19301c463e2d018cb359
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 10, 2026.
Transparency logSecurity for banos 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for banos-1.0.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 10, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.