Training Workflow

Make sure you have the correct environment and data layout before running the training pipeline (see Getting Started). This workflow includes preprocessing, feature extraction, and classifier training.

1. Extract annotated segments

Use the Raven export to cut annotated segments from the original recordings using the raven_to_wav module:

./bioacoustics/wav_processing/raven_to_wav/raven_to_wav.sh

This creates .wav segments in data/processed_wav_files/.

2. Condense recordings for faster annotation

The condensation workflow is optional. It extracts energetic regions from long recordings to reduce manual review time:

./bioacoustics/wav_processing/condensation/extract_chimps.sh

Use this when you still need to create or extend annotations and want to focus attention on likely vocal events. Note that this step may need some tuning of parameters for your specific dataset. The condensed files are written to data/condensed_wav_files/.

3. Generate synthetic training data

Synthetic data mixes known vocalizations with target-environment background recordings to improve robustness in these target environments:

./bioacoustics/wav_processing/synthetic_data/synth_pipeline_vocalizations.sh
./bioacoustics/wav_processing/synthetic_data/synth_pipeline_background.sh

The generated files are written to data/synth_data/.

4. Extract features

Two feature extraction routes are available.

SVM features

The SVM pipeline extracts 1,140 acoustic features per frame from statistics based on MFCC, RASTA-PLP, and automatic analysis architecture (Malfante et al., 2018).

./bioacoustics/feature_extraction/run_feature_extraction_svm.sh

The relevant configuration lives in config/ and can define reusable extraction jobs, frame lengths, hop lengths, filter settings, and paths.

CNN features

The deep learning pipeline constructs three-channel mel spectrogram inputs with PCEN normalization, per-file z-normalization, and delta features.

./bioacoustics/feature_extraction/run_feature_extraction_dl.sh

Train a classifier

Modify the configuration file to choose the training dataset, model type, and hyperparameters. The repository provides a sample configuration for testing.

Run the training pipeline using:

python bioacoustics/classifier/train.py --config_file config/testdata.yml

The SVM workflow performs embedded feature selection and keeps the 50 most informative features before fitting the classifier.

Evaluate a trained model

Use the evaluation script on labeled test data:

python bioacoustics/classifier/evaluate.py --config_file config/testdata.yml

This reports standard classification metrics for the trained model.

Practical notes

  • The full training workflow assumes shell scripts point to the correct dataset locations.
  • Feature extraction can take hours; run it on a machine with multiple cores when possible.
  • On Ubuntu systems, errors related to sndfile can usually be fixed with sudo apt-get install libsndfile-dev.

References

  • Automatic Analysis Architecture, 2018, Malfante, M., Mars, J., Dalla Mura, M., DOI: 10.5281/zenodo.126028