Przejdź do treści

Test Set Evaluation

A small labelled test set and an evaluation that runs both shipped models on it. It answers "did this change make detections better or worse, and by how much" for a model update, a change to the score blacklist, the location filters, temporal pooling, or decoding.

The set is 18 one-minute soundscapes from around the world with human labels (101 bird species, 711 labelled species-windows) and 58 noise clips without birds. 37 of the noise clips are trigger clips: app recordings in which the model scores one class of the score blacklist high although a listener heard neither a bird nor that sound. That is enough to compare one build with another. It is too small for accuracy claims, and 12 of the soundscapes come from WABAD, a common evaluation set: do not train or tune a model on it, and treat a threshold or blacklist value that looks good here as a hint to check on field recordings, not as a result.

Where it lives

Path Content
assets/test_fixtures/birdnet_live_testset_v1.zip The test set, one file in Git LFS. Its README.md describes the files, sources, and licenses.
assets/test_fixtures/birdnet_live_testset_v1/ Unpacked working copy. Ignored by git.
integration_test/testset_eval_test.dart Runs the models and writes the report
test/support/testset/ Manifest reader, metrics, report comparison
test/testset/ Unit tests; part of flutter test
test/fixtures/testset_v1_baseline.json The committed baseline report
tools/testset_report.dart Unpack, show, compare, accept

Unpack the zip after git lfs pull:

dart tools/testset_report.dart unpack

flutter test does the same when the copy is missing or the zip changed. The audio files keep the license of their source (CC BY 4.0, CC0, CC BY-SA 4.0, public domain); ATTRIBUTION.md inside the zip must stay with them. The test set is not part of the app and is never bundled into a build.

Running the evaluation

On Windows, from the repository root (about five minutes including the build):

flutter test integration_test/testset_eval_test.dart -d windows \
  --dart-define=TEST_FIXTURES_DIR=D:/path/to/repo/assets/test_fixtures \
  --dart-define=TESTSET_REPORT_PATH=D:/path/to/repo/build/testset/report.json
dart tools/testset_report.dart show build/testset/report.json
dart tools/testset_report.dart compare build/testset/report.json

To try other blacklist values without touching the shipped file, add --dart-define=TESTSET_BLACKLIST_PATH=<candidate.json>. Such a run differs from the baseline by setup and is for reading with compare, not for passing.

compare prints every headline number next to the baseline. It exits with 1 when one is worse beyond its tolerance or missing, and with 2 when the two reports were made with different models or tuning.

On an Android device the scores differ slightly, because arm64 runs the convolutions in half precision. The test reads the models and the pushed fixtures and writes nothing into the app's data, so it may run on a phone that carries real Sessions, installed the way AGENTS.md describes under Device Testing (never through flutter test or flutter drive, which uninstall the app):

dart tools/testset_report.dart unpack
adb shell rm -rf /data/local/tmp/test_fixtures
adb push assets/test_fixtures /data/local/tmp/test_fixtures
adb push test/fixtures/testset_v1_baseline.json /data/local/tmp/test_fixtures/
flutter build apk --debug --target-platform android-arm64 \
  --target integration_test/testset_eval_test.dart
# confirm the signing certificate matches the installed app, then:
adb install -r build/app/outputs/flutter-apk/app-debug.apk
adb logcat -c
adb shell monkey -p de.tu_chemnitz.mi.kahst.birdnet_live -c android.intent.category.LAUNCHER 1
# wait for "All tests passed" or "Some tests failed"
mkdir -p build/testset
adb logcat -d -s flutter:V > build/testset/logcat.txt
dart tools/testset_report.dart logcat build/testset/logcat.txt build/testset/report_device.json
dart tools/testset_report.dart compare build/testset/report_device.json

Afterwards build the normal debug APK and adb install -r it again.

What the report contains

Only birds are scored: bird detections per 3 s window against the species labelled in that window. The model's other classes have no labels in the set; they are counted and never scored. A false positive of a species that is labelled elsewhere in the same file is counted separately (fpSameFile), because many of those are faint calls or calls on a window boundary.

Score variants: raw is the model output. blacklist has the score blacklist applied. geoExclude, geoAdaptive, and geoMerge have the blacklist and that location filter applied, with the geo-model asked for the file's place and week. Files without a place or a date are not filtered.

Section Use
summary Headline numbers at the default confidence threshold. This is what compare and the baseline check look at.
window.sweep Precision, recall, and F1 per variant at twelve thresholds, with bird detections on noise clips. For judging a different default threshold.
window.averagePrecision Threshold-free ranking quality of the audio model.
calibration How often a bird score in each 0.1-wide band is correct, and the expected calibration error. Shows what a displayed confidence means.
geo Geo-model score and Explore tier of every labelled species at its place and week, the share that clears each geo threshold, and the labelled species the default threshold would exclude.
blacklist Bird species reported at the default threshold in files where they are not labelled, with their true detections and current sensitivity, and what each existing blacklist entry does on the set. A species marked candidate is never right here and wrong more than once.
triggers For each trigger clip: the highest score of the class it sets off, that score with the class's current sensitivity, the sensitivity that would bring it below the default threshold, and whether the full pipeline reported the class. The direct measure of a blacklist entry.
pipeline Bird species per file from the full inference path (batching, temporal pooling, blacklist, location filter) with default settings, for the adaptive filter and for no filter.
noise Strongest bird score of each noise clip.

The evaluation never changes the blacklist, a threshold, or a filter constant. The blacklist stays hand-curated: use the blacklist section as a list of species to listen to, and confirm with field recordings before adding or changing an entry (see Updating the Models).

Baseline

test/fixtures/testset_v1_baseline.json is a full report from a Windows x86-64 run. Two checks use it:

  • flutter test fails when the baseline was recorded with a different audio model, geo-model, default thresholds, pooling defaults, or score blacklist than the repository ships. Changing any of them therefore requires a new evaluation run.
  • The integration test fails when a headline number is worse than the baseline beyond its tolerance (0.03 for precision, recall, F1, average precision, and calibration error; a few detections for counts). The tolerances are in test/support/testset/testset_report.dart and cover the difference between x86-64 and arm64.

When a change is intended, review it and record the new baseline in the same commit, so the diff of the baseline file shows what the change did:

dart tools/testset_report.dart compare build/testset/report.json
dart tools/testset_report.dart accept build/testset/report.json

Record baselines from a Windows x86-64 run only, so they stay comparable.

Replacing the test set

A new version is a new zip with a new name (…_v2.zip) and its own baseline; update testsetName in test/support/testset/testset_manifest.dart and the ignore rule in .gitignore. Do not edit a released zip in place: reports name the test set they were made with.