Repository navigation
test: parity of the self-contained ONNX graph against detect_birds.py - #29
Merged
Merged
Conversation
tests/onnx_graph_parity.py builds the reference BirdCallDetector from the graph's ONNX metadata (model, mapping, merge, NMS IoU, conf, gap), runs both on tests/test.wav and the parity soundscapes, and matches the merged boxes with the matcher and verdict of model_format_parity.py. On CPU, Just-Bird fp32 matches 1228/1228 boxes (mean IoU 1.0000) and the docs fp16 graph 1226/1228 (mean IoU 0.9955). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
tests/onnx_graph_parity.py: checks that a self-contained graph fromsrc/inference/onnx_export.py(the one the browser demo runs) still reproducesdetect_birds.py, the path the CLI and Streamlit use.tests/model_format_parity.pyonly covers the plain network exports, which run insidedetect_birds.py.model_format_parity.py.verify_onnxdocstring inonnx_export.pynow points to the new test.Results
Run in
birdbox-onnx(both sides on the CPU), ontests/test.wavplus the 12 parity soundscapes (13 recordings in total):docs/models)The fp32 graph matches the Python pipeline exactly. The remaining fp16 differences come from fp16 alone.
Correction to #25: the "ONNX fp32 99.7 %, mean IoU 0.999" row there came from a run where the
.ptreference was on the GPU. Those 0.3 % were GPU-vs-CPU rounding, not the graph.Test plan
python tests/onnx_graph_parity.py --onnx docs/models/Just-Bird_fp16.onnx <fp32 export>inbirdbox-onnx: both PASS, exit code 0🤖 Generated with Claude Code