Skip to content

Latest commit

 

History

18 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OrniWatch: Passive Bird Species Detection via CRNN

A deep-learning system for passive acoustic monitoring of bird species. OrniWatch uses a Convolutional Recurrent Neural Network (CRNN) to detect bird vocalisations in long-form audio recordings, outputting per-frame predictions over time for each of 10 target species.


Project Overview

OrniWatch identifies bird species from raw audio recordings.

Key characteristics:

  • Input: Long-form audio recordings (field recordings, autonomous recorders)
  • Output: Per-timestep probability scores across 10 bird species (multilabel)
  • Target classes include:
    • Amazonian Grosbeak (South America)
    • Gray-fronted Dove (South America)
    • Stock-dove (Europe)
    • Thrush-like Wren (South America)
    • Eurasian Blackcap (Europe)
    • (+ 5 additional species)
  • Challenge: extreme label sparsity, positive label fraction ≈ 0.005 in the time dimension

Data pipeline:

  1. Train and validation recordings are sourced from strictly separate files to prevent leakage.
  2. 10 species classes were selected from the full dataset.
  3. Long recordings are segmented into short windows according to the main annotation file.
  4. Segments are pre-computed and cached as tensors for training efficiency.
  5. Key preprocessing parameters:
    • hop_length: STFT hop size controlling temporal resolution
    • n_mels: number of mel filterbank bins
    • window_len (seconds): segment length fed to the model
  6. Data augmentation is applied during training.

Results & Observations

Handling label sparsity

The extreme label sparsity (positive fraction ≈ 0.005) was handled with large positive-sample weights in BCEWithLogitsLoss, upweighting rare bird-call frames instead of oversampling.

Window size and overfitting

Small input windows caused the model to overfit rapidly, with validation loss diverging while training loss kept falling. Increasing the window to about 50 s kept validation loss stable.

Demonstration results

Thrush-like Wren was the best-detected class, though some background noise remains in the predictions.

Thrush

Two more examples from the manually gathered dataset:

  • Amazonian Grosbeak: detections are reasonably clean and correlate well with actual vocalisations.
  • Gray-fronted Dove (South America): shows detectable activations despite not being one of the 10 training classes, suggesting the model picked up some generalizable acoustic features.

Grosbeak Dove


Architecture

OrniWatch uses a CNN + GRU hybrid (CRNN) for sequence-aware audio classification:

Raw Audio
    │
    ▼
Mel Spectrogram (hop_length, n_mels, window_len)
    │
    ▼
CNN Encoder  ─── extracts local spectro-temporal features per frame
    │
    ▼
GRU (Recurrent) ─── models temporal context across frames
    │
    ▼
Time Head (per-frame)   ←── primary training target
    │
    ▼
Sigmoid  ─── multilabel output (one score per class, per timestep)

Key design decisions:

Decision Rationale
GRU over LSTM GRU size was the dominant factor in convergence speed; simpler architecture converged faster
Sigmoid over Softmax Bird calls are not mutually exclusive; multiple species may vocalise simultaneously
Per-timestep (time head) training Temporal label data was extremely sparse (pos fraction ≈ 0.005); clip-level head provided weaker signal
Positive sample weighting via BCEWithLogitsLoss Directly counteracts class imbalance without requiring oversampling
Large input windows (~50 s) Small windows caused rapid overfitting; longer context kept validation loss stable

More target classes made training less stable, since GRU capacity has to scale with class count. Detection quality wasn't uniform: Amazonian Grosbeak was particularly clean, while other classes showed higher false-positive rates.

Training


Installation & Setup

Requirements

  • Python ≥ 3.9
  • PyTorch ≥ 2.0
  • torchaudio
  • librosa
  • numpy, pandas, matplotlib

About

Project for Deep Learning subject 7th semester of Data Engineering course at Gdansk Tech

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages