Fixing corrupt rows#50
Draft
Josef-Haupt wants to merge 2 commits into
Draft
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses data corruption and inconsistent duration calculations in the acoustic inference pipeline by making duration derivation deterministic (frames / samplerate) and by fixing tensor growth to preserve masking for unwritten segments.
Changes:
- Compute audio duration from
frames / samplerateinstead of relying onsf_info.duration. - Replace in-place
ndarray.resize()growth with explicit reallocation + copy to ensure newly added segments remain masked/uninitialized as intended. - Add focused regression tests for duration computation and tensor resize/masking behavior (including the “initial pointer = 0” case).
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
src/birdnet/acoustic/inference/core/producer.py |
Derives duration from sample frames and samplerate to avoid inaccurate sf_info.duration. |
src/birdnet/acoustic/inference/core/prediction/prediction_tensor.py |
Reworks segment capacity growth to keep unwritten prediction segments masked; adjusts initial allocation for zero pointer. |
src/birdnet/acoustic/inference/core/encoding/encoding_tensor.py |
Mirrors the prediction tensor resize fix for embeddings; adjusts initial allocation for zero pointer. |
src/birdnet_tests/acoustic_models/inference/producer_py/test_get_file_segments_with_overlap.py |
Adds regression test ensuring duration uses frames/samplerate rather than sf_info.duration. |
src/birdnet_tests/acoustic_models/inference/predictions/prediction_tensor_py/test_prediction_tensor.py |
Adds tests verifying resize preserves masking and that zero-pointer initialization starts empty. |
src/birdnet_tests/acoustic_models/inference/encoding/encoding_tensor_py/test_encoding_tensor.py |
Adds tests verifying resize preserves masking and that zero-pointer initialization starts empty. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
No description provided.