Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
108 commits
Select commit Hold shift + click to select a range
491e8b8
add support for frequency-restricted GCC
sammlapp Oct 28, 2024
7d017c9
expose frequency_range arg in tdoa, audio.estimate_delay
sammlapp Oct 28, 2024
38aff4e
refactor SpatialEvent for frequency_range arg to audio.estimate_delay
sammlapp Oct 28, 2024
06c998c
Merge branch 'develop' into gcc_with_bandpass
sammlapp Nov 3, 2024
6e10126
import .ml.shallow_classifier into api
sammlapp Jul 31, 2025
149f5ca
implement proper save/load of MLPClassifier
sammlapp Aug 1, 2025
a1f3402
implement batching for shallow_classifier fit
sammlapp Aug 1, 2025
ef9e54b
implement early stopping and best-model selection in shallow classifi…
sammlapp Aug 1, 2025
a109112
change MLP init argument order for backwards compatability, and fix t…
sammlapp Aug 1, 2025
8c1f6c8
remove debugging file
sammlapp Aug 1, 2025
95830f2
update references to `quick_fit`, renamed to `fit`
sammlapp Aug 1, 2025
94551e2
add support for creating/replacing cnn classifier with MLPClassifier
sammlapp Aug 1, 2025
d3a857f
fix bug in test_cnn
sammlapp Aug 1, 2025
341d7de
remove outdated tests script
sammlapp Aug 1, 2025
0fba819
allow audio_root arg in shallow_classifier methods
sammlapp Aug 1, 2025
77f74d9
improve metrics returned by shallow_classifier.fit
sammlapp Aug 1, 2025
464d47c
fix issue of missing return value in fit()
sammlapp Aug 1, 2025
7f15217
Apply suggestions from code review
sammlapp Aug 4, 2025
33db3df
Merge branch 'develop' into gcc_with_bandpass
sammlapp Sep 20, 2025
5f5bd72
fix tests for gcc
sammlapp Sep 25, 2025
018d898
Merge pull request #1159 from kitzeslab/gcc_with_bandpass
sammlapp Sep 29, 2025
7b5da37
Avoid samples>1 when creating audio playback widget
sammlapp Oct 7, 2025
68b4e5a
use 'phat' as default cc_filter for SpatialEvent
sammlapp Oct 7, 2025
1e3ec7b
refactor Spectrogram to use torchaudio
sammlapp Oct 7, 2025
e78f93a
add utility functions for plotting grids of spectrograms or audio clips
sammlapp Oct 7, 2025
dfa82fd
Change default localization algorithm in Spatial Event to least squares
sammlapp Oct 7, 2025
0033549
expose sample_rate arg for SpectrogramPreprocessor
sammlapp Oct 7, 2025
815e772
improve docstring for initialization of CNN with desired sample shape
sammlapp Oct 7, 2025
ff4657a
CategoricalLabels.from_categorical_labels_df should treat string as a…
sammlapp Oct 7, 2025
9be53ca
update default localization algorithm to least squares
sammlapp Oct 7, 2025
7427e16
improve show_tensor_grid and show_tensor
sammlapp Oct 9, 2025
7f110d6
expose CNN docstrings
sammlapp Oct 9, 2025
7315f62
improve audio_time_mask with adaptive level
sammlapp Oct 9, 2025
0660613
update transfer learning tutorial with fine tuning
sammlapp Oct 9, 2025
bff8470
expose `batch_size` argument in the docstring of CNN.embed() to make …
sammlapp Oct 9, 2025
1e206f1
add/restore ribbit and Ruffed Grouse specific tutorials
sammlapp Oct 9, 2025
bab8c8c
add helpful warning if .predict() or .embed() will require large memory
sammlapp Oct 9, 2025
8c6205d
stop using unsupported pin_memory for mps
sammlapp Oct 9, 2025
1323b67
add adaptive random gain and adaptive random noise waveform augmentat…
sammlapp Oct 20, 2025
f434814
Merge branch 'develop' into spec_refactor
sammlapp Oct 23, 2025
05b929f
add random lowpass augmentation
sammlapp Oct 24, 2025
629ae5d
Initial plan
Copilot Oct 27, 2025
bc0e7ba
Fix FutureWarning in utils.py by using .values for Series assignment
Copilot Oct 27, 2025
476f0be
improve show_tensor_grid layout
sammlapp Oct 28, 2025
8f48ada
stop warning user when architecture # channels cannot be checked
sammlapp Oct 28, 2025
c3f0a39
add arg docstrings and flipud to CAM.plot()
sammlapp Oct 28, 2025
9cafde2
allow passing single file in CNN.generate_cams()
sammlapp Oct 28, 2025
18b1e4b
demo of gradcam
sammlapp Oct 28, 2025
822fa46
Add device arg to SpectrogramClassifier init
sammlapp Oct 28, 2025
d29766c
Merge branch 'develop' into copilot/fix-futurewarning-in-sample-py
sammlapp Oct 28, 2025
f3f3f41
Merge pull request #1172 from kitzeslab/copilot/fix-futurewarning-in-…
sammlapp Oct 28, 2025
264e9f4
use self.predict_dataloader() in generate_cams()
sammlapp Oct 28, 2025
4176578
improve error message when samples dataframe is not correct format
sammlapp Oct 28, 2025
9f306dc
expose load_model in top-level api
sammlapp Oct 28, 2025
a52f6d0
add spectrogram.rms calculation
sammlapp Oct 28, 2025
fc864a2
finish spec refactor
sammlapp Oct 28, 2025
b11d9d3
update ribbit demo
sammlapp Oct 28, 2025
73c1d85
update BMZ readme section
sammlapp Oct 28, 2025
27239d4
Re-add per-class metrics and wandb charts in training
sammlapp Oct 28, 2025
881cd00
move warning about unknown architecture from init to save
sammlapp Oct 28, 2025
ccd51e0
add early stopping
sammlapp Oct 29, 2025
7854d33
add option to reload best model at end of train()
sammlapp Oct 29, 2025
a1d4318
Apply suggestions from code review
sammlapp Oct 29, 2025
d6a2a84
avoid modifying original power spec when computing rms
sammlapp Oct 29, 2025
5e02b79
add torchaudio dependency
sammlapp Oct 29, 2025
ca2f010
fix logic for checking labels
sammlapp Oct 30, 2025
730ef55
adjust PCEN preprocessing for Spectrogram refactor
sammlapp Oct 30, 2025
26554d2
remove outdated test
sammlapp Oct 30, 2025
f1940ba
update spectrogram tests with new expected values
sammlapp Oct 30, 2025
6773f84
add Spectrogram.pcen() and allow using linear values in .plot() and .…
sammlapp Oct 30, 2025
ff4fcee
Merge branch 'develop' into spec_refactor
sammlapp Oct 30, 2025
1ff1c7a
fix bug in make_clip_df for files = single file path
sammlapp Oct 30, 2025
610a528
automatic self-profiling in train and predict
sammlapp Oct 30, 2025
e63bb22
remove outdated AMP code from InceptionV3 training_step
sammlapp Oct 30, 2025
cfb30a6
avoid using removed arg in tutorial
sammlapp Oct 30, 2025
59c295f
Merge branch 'develop' into issue_1143_mplclassifier
sammlapp Oct 30, 2025
542dcbd
UserWarning during shallow classifier training
sammlapp Oct 30, 2025
c9f6444
train_test_split error when no annotation file is provided in BoxedAn…
sammlapp Oct 30, 2025
6f6eded
expose args and docstring for fit()
sammlapp Oct 30, 2025
e116946
document arguments of EmbeddingDataset
sammlapp Oct 30, 2025
809ea10
Merge pull request #1148 from kitzeslab/issue_1143_mplclassifier
sammlapp Oct 30, 2025
1b3d818
add file-wise train_test_split helper function
sammlapp Nov 10, 2025
7417c46
fix invalid sample handling with >0 workers
sammlapp Nov 17, 2025
4550310
allow passing overlay_files to SpectrogramPreprocessor
sammlapp Nov 18, 2025
e58800b
update preprocessing tutorial
sammlapp Nov 18, 2025
bf3834b
catch any error on crowsetta import
sammlapp Nov 20, 2025
a3e31e0
fix tutorial download links
sammlapp Dec 1, 2025
f8535a3
change default final clip behavior to "extend" with silence rather th…
sammlapp Dec 5, 2025
7de9f75
update spectrogram docstring
sammlapp Dec 17, 2025
96637b1
Merge pull request #1174 from kitzeslab/spec_refactor
sammlapp Dec 17, 2025
70c430c
Refactor warnings handling during audio loading
rhine3 Dec 22, 2025
c56d2d8
Standardize receiver arrays after removing bad receivers
rhine3 Dec 22, 2025
7581a1a
update failing tests to match new defaults and api
sammlapp Jan 19, 2026
f29b7b2
small test fixes to reflect new defaults
sammlapp Jan 19, 2026
1518491
Merge branch 'develop' into issue_1207_loca_receiver_removal_fix
sammlapp Jan 19, 2026
d9f6ee8
Merge branch 'develop' into issue_1205_audio_warn_context
sammlapp Jan 19, 2026
6b70c90
more test fixes for default final clip behavior
sammlapp Jan 19, 2026
91e6073
remove weights downloading from unit tests
sammlapp Jan 19, 2026
d0b479b
fix test for loading specific weights
sammlapp Jan 20, 2026
ba93e4b
Merge branch 'develop' into issue_1205_audio_warn_context
sammlapp Jan 20, 2026
3b99701
Merge branch 'develop' into issue_1207_loca_receiver_removal_fix
sammlapp Jan 20, 2026
ebeb2c1
Merge pull request #1206 from kitzeslab/issue_1205_audio_warn_context
sammlapp Jan 20, 2026
9f9596d
add test for #1207
sammlapp Jan 20, 2026
034af03
Merge pull request #1208 from kitzeslab/issue_1207_loca_receiver_remo…
sammlapp Jan 20, 2026
2da9a01
implement Audio.apply()
sammlapp Jan 22, 2026
a861a8a
add Audio.pad and Audio.pad_to methods
sammlapp Jan 23, 2026
5ae6870
fix bug where Audio.noise returns one too few samples
sammlapp Jan 23, 2026
fca207f
avoid userwarning if features/labels/preds are already tensors
sammlapp Jan 24, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ lightning_logs/
docs/tutorials/*.ckpt
docs/tutorials/BirdNET*
docs/tutorials/*.WAV
docs/tutorials/*.csv

docs/tutorials/ruffed_grouse_validation_set
docs/tutorials/great_plains_toad_dataset
docs/tutorials/annotation_Files.zip
docs/tutorials/mp3_Files.zip
docs/tutorials/rana_sierrae_2022.zip
Expand Down
27 changes: 20 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,11 @@ Audio.from_file(path, start_timestamp=start_time,duration=audio_length)

### Load and use a model from the Bioacoustics Model Zoo
The [Bioacoustics Model Zoo](https://github.com/kitzeslab/bioacoustics-model-zoo) hosts models in a repository that can be installed as a package and are compatible with OpenSoundscape. To install, use
`pip install bioacoustics-model-zoo==0.12.0`
`pip install --upgrade bioacoustics-model-zoo`

To install additional dependencies for specific models, use patterns like

`pip install --upgrade bioacoustics-model-zoo[hawkears]`

Load up a model and apply it to your own audio right away:

Expand All @@ -105,15 +109,24 @@ import bioacoustics_model_zoo as bmz
#list available models
print(bmz.utils.list_models())

#generate class predictions and embedding vectors with Perch
perch = bmz.Perch()
scores = perch.predict(files)
embeddings = perch.generate_embeddings(files)
#generate class predictions and embedding vectors with HawkEars...
hawkears = bmz.HawkEars()
scores = hawkears.predict(files)
embeddings = hawkears.embed(files)

#...or BirdNET
#...or BirdNET...
# (you'll need ai-edge-litert in your environment, run `pip install bioacoustics-model-zoo[birdnet]`)
birdnet = bmz.BirdNET()
scores = birdnet.predict(files)
embeddings = birdnet.generate_embeddings(files)
embeddings = birdnet.embed(files)

# or Perch2
# `pip install bioacoustics-model-zoo[perch]` will install tensorflow and tensorflow-hub
#...or BirdNET...
# (you'll need ai-edge-litert in your environment, run `pip install bioacoustics-model-zoo[birdnet]`)
perch2 = bmz.Perch2()
scores = perch2.predict(files)
embeddings = perch2.embed(files)
```

See the tutorial notebooks for examples of training and fine-tuning models from the model zoo with your own annotations.
Expand Down
1 change: 1 addition & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ def setup(app):
"librosa",
"ray",
"torch",
"torchaudio",
"sklearn",
"numpy",
"schema",
Expand Down
3 changes: 2 additions & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ Suggested citation:
tutorials/customize_cnn_training
tutorials/preprocess_audio_dataset
tutorials/acoustic_localization
tutorials/signal_processing
tutorials/RIBBIT_pulse_rate_demo
tutorials/ruffed_grouse_detector

.. toctree::
:maxdepth: 2
Expand Down
1,242 changes: 1,242 additions & 0 deletions docs/tutorials/RIBBIT_pulse_rate_demo.ipynb

Large diffs are not rendered by default.

1,440 changes: 785 additions & 655 deletions docs/tutorials/predict_with_cnn.ipynb

Large diffs are not rendered by default.

737 changes: 435 additions & 302 deletions docs/tutorials/preprocess_audio_dataset.ipynb

Large diffs are not rendered by default.

946 changes: 946 additions & 0 deletions docs/tutorials/ruffed_grouse_detector.ipynb

Large diffs are not rendered by default.

1,196 changes: 0 additions & 1,196 deletions docs/tutorials/signal_processing.ipynb

This file was deleted.

2 changes: 1 addition & 1 deletion docs/tutorials/spectrogram.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@
"\n",
"Using higher overlap percentages can sometimes yield better time resolution in a spectrogram, but will take more computational time to generate. \n",
"\n",
"As an alternative to specifying window overlap using `overlap_samples`, you can instead specify overlap using `overlap_fraction`.\n",
"As an alternative to specifying window overlap using `overlap_samples`, you can instead specify overlap using `overlap_fraction` or `hop_samples`. \n",
"\n",
"#### Spectrogram parameter tradeoffs\n",
"\n",
Expand Down
379 changes: 305 additions & 74 deletions docs/tutorials/train_cnn.ipynb

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions docs/tutorials/training_birdnet_and_perch.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"|Link to tutorial|How to run tutorial|\n",
"| :- | :- |\n",
"| [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/kitzeslab/opensoundscape/blob/master/docs/tutorials/train_cnn.ipynb) | The link opens the tutorial in Google Colab. Uncomment the \"installation\" line in the first cell to install OpenSoundscape. |\n",
"| [![Download via DownGit](https://img.shields.io/badge/GitHub-Download-teal?logo=github)](https://minhaskamal.github.io/DownGit/#/home?url=https://github.com/kitzeslab/opensoundscape/blob/master/docs/tutorials/train_cnn.ipynb) | The link downloads the tutorial file to your computer. Follow the [Jupyter installation instructions](https://opensoundscape.org/en/latest/installation/jupyter.html), then open the tutorial file in Jupyter. |"
"| [![Download via DownGit](https://img.shields.io/badge/GitHub-Download-teal?logo=github)](https://minhaskamal.github.io/DownGit/#/home?url=https://github.com/kitzeslab/opensoundscape/blob/master/docs/tutorials/train_birdnet_and_perch.ipynb) | The link downloads the tutorial file to your computer. Follow the [Jupyter installation instructions](https://opensoundscape.org/en/latest/installation/jupyter.html), then open the tutorial file in Jupyter. |"
]
},
{
Expand Down Expand Up @@ -73,7 +73,7 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": null,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -105,7 +105,7 @@
"%config InlineBackend.figure_format = 'retina'\n",
"\n",
"# opensoundscape transfer learning tools\n",
"from opensoundscape.ml.shallow_classifier import MLPClassifier, quick_fit, fit_classifier_on_embeddings\n"
"from opensoundscape.ml.shallow_classifier import MLPClassifier, fit_classifier_on_embeddings\n"
]
},
{
Expand Down Expand Up @@ -297,7 +297,7 @@
"\n",
"The BirdNET and Perch models provided in the Bioacoustics Model Zoo have a `.tf_model` attribute containing the TensorFlow inference model and a `.network` attribute containing a trainable PyTorch classification head, specifically an instance of the MLPCLassifier class. To train a custom classifier on the embeddings extracted by these models, we just need to (1) embed the training and validation samples, then (2) pass the embeddings and labels to the `.network.fit()` method. \n",
"\n",
"This is equivalent to passing the `.network` to the the `opensoundscape.ml.shallow_classifier.quick_fit()` method, so you can also experiment with generating your own classification heads (e.g. various instances of MLPClassifier) and fitting each of them on the embeddings. See the transfer learning tutorial for further examples. "
"This is equivalent to passing the `.network` to the the `opensoundscape.ml.shallow_classifier.fit()` method, so you can also experiment with generating your own classification heads (e.g. various instances of MLPClassifier) and fitting each of them on the embeddings. See the transfer learning tutorial for further examples. "
]
},
{
Expand Down Expand Up @@ -1639,7 +1639,7 @@
"\n",
"- fit_classifier_on_embeddings(): this function wraps together the embedding step with the classifier fitting step into a single operation, with support for generating augmented variations of training samples. It returns the embeddings and labels, in case you want to train additional classifiers on them\n",
"\n",
"- MLPClassifier: this class creates a neural network with one or more fully connected layers. This object can be trained by passing it to quick_fit() or fit_classifier_on_embeddings(), or by running the MLPClassifier.fit() method (equivalent to quick_fit()). The input size should match the embedding size of the embedding model, and the output size should match the number of classes your model predicts on. "
"- MLPClassifier: this class creates a neural network with one or more fully connected layers. This object can be trained by passing it to fit() or fit_classifier_on_embeddings(), or by running the MLPClassifier.fit() method (equivalent to fit(model)). The input size should match the embedding size of the embedding model, and the output size should match the number of classes your model predicts on. "
]
}
],
Expand Down
Loading