Skip to content

Update for the training data preprocessing - #968

Merged
Josef-Haupt merged 5 commits into
mainfrom
training-data-processing-update
Aug 3, 2026
Merged

Update for the training data preprocessing#968
Josef-Haupt merged 5 commits into
mainfrom
training-data-processing-update

Conversation

@max-mauermann

Copy link
Copy Markdown
Member

No description provided.

@max-mauermann max-mauermann linked an issue Aug 3, 2026 that may be closed by this pull request
@Josef-Haupt
Josef-Haupt marked this pull request as ready for review August 3, 2026 16:23
Copilot AI review requested due to automatic review settings August 3, 2026 16:23
@Josef-Haupt
Josef-Haupt merged commit a61872f into main Aug 3, 2026
11 checks passed
@Josef-Haupt
Josef-Haupt deleted the training-data-processing-update branch August 3, 2026 16:24

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the training pipeline’s preprocessing and error surfacing so invalid training-folder setups are rejected earlier (before model initialization), while also refining dataset splitting and upsampling behavior and adding coverage for the new/changed logic.

Changes:

  • Add preflight validation for training folders that contain no supported audio files, and propagate localized errors with placeholder payloads to the GUI.
  • Refactor random_split, random_multilabel_split, and upsampling logic to reduce duplication/inefficiencies and adjust shuffling behavior around validation splitting.
  • Add/extend tests for training-data loading validation, split correctness, and upsampling behavior; add new localization keys for new validations.

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tests/train/test_train_loading.py Adds regression test ensuring empty class folders are detected before model loading.
tests/train/test_model.py Adds unit tests covering split and upsampling behavior.
birdnet_analyzer/train/utils.py Adds _check_input_folders and runs it before model setup; fixes validation message typo.
birdnet_analyzer/model.py Refactors split and upsampling implementations; adjusts training-data shuffling and enables shuffle=True in Keras fit.
birdnet_analyzer/gui/train.py Formats localized validation messages with payload arguments for placeholders.
birdnet_analyzer/lang/en.json Adds localization strings for new validations and multi-label upsampling restriction.
birdnet_analyzer/lang/de.json Adds localization strings for new validations and multi-label upsampling restriction.
birdnet_analyzer/lang/fr.json Adds localization strings for new validations and multi-label upsampling restriction.
birdnet_analyzer/lang/fi.json Adds localization strings for new validations and multi-label upsampling restriction.
birdnet_analyzer/lang/id.json Adds localization strings for new validations and multi-label upsampling restriction.
birdnet_analyzer/lang/pt-br.json Adds localization strings for new validations and multi-label upsampling restriction.
birdnet_analyzer/lang/ru.json Adds localization strings for new validations and multi-label upsampling restriction.
birdnet_analyzer/lang/se.json Adds localization strings for new validations and multi-label upsampling restriction.
birdnet_analyzer/lang/tlh.json Adds localization strings for new validations and multi-label upsampling restriction.
birdnet_analyzer/lang/zh_TW.json Adds localization strings for new validations and multi-label upsampling restriction.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +167 to +172
has_audio_file = any(
entry.is_file()
and not entry.name.startswith(".")
and entry.name.rsplit(".", 1)[-1].lower() in ALLOWED_FILETYPES
for entry in os.scandir(folder_path)
)
Comment thread birdnet_analyzer/model.py
Comment on lines +242 to +243
train_indices = np.concatenate(train_indices)
val_indices = np.concatenate(val_indices)
Comment thread birdnet_analyzer/model.py
Comment on lines +281 to +285
source_indices = np.flatnonzero(y == minority_label)
missing_samples = min_samples - len(source_indices)

while np.where(y == minority_label)[0].shape[0] + len(y_temp) < min_samples:
random_index = rng.choice(np.where(y == minority_label)[0], size=size)
x_app, y_app = apply(x, y, random_index)
for _ in range(max(0, missing_samples)):
random_index = rng.choice(source_indices, size=size)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Training the customized classifier gets stuck:

3 participants