Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changed annotation column name/id to one required parameter when loading Raven files into BoxedAnnotations #1057

Closed
wants to merge 239 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
239 commits
Select commit Hold shift + click to select a range
dde681b
rename "raven_file" to "annotation_file"
sammlapp Jun 20, 2023
e54d207
allow initializing empty BoxedAnnotations object
sammlapp Jun 20, 2023
ed23254
remove outdated part of annotation tutorial
sammlapp Jun 20, 2023
00b83c6
add crowsetta integration
sammlapp Jun 20, 2023
ea5564b
add to_csv and from_csv for BoxedAnnotations
sammlapp Jun 20, 2023
c61cede
add crowsetta dependency
sammlapp Jun 20, 2023
01cc582
require python >=3.9
sammlapp Jun 22, 2023
ace47bb
add kwargs to Spectrogram.from_audio
sammlapp Jan 15, 2024
d278fe4
resolves #942 helpful message when index not set
sammlapp Jan 24, 2024
9d7dc5e
resolve 803 useful error if preprocessor.forward gets df
sammlapp Jan 24, 2024
7ddc1ba
resolve #865 helpful error for wrong train_df format
sammlapp Jan 24, 2024
212e7d4
handle 0-length samples scenario
sammlapp Jan 24, 2024
b89d4aa
fix input validation for SafeAudioDataloader
sammlapp Jan 24, 2024
35fd080
resolve 911 change labels of Spectrogram.plot() and add kHz arg
sammlapp Jan 24, 2024
458e4ef
remove special characters from wandb.log keys
sammlapp Feb 23, 2024
98704d4
fix extend_to resolves #972 and #948
sammlapp Apr 8, 2024
1e35014
Solved #855.
LeonardoViotti Apr 29, 2024
7b69fda
black formated.
LeonardoViotti Apr 29, 2024
d8e6c2d
Modified empty annotation behavior and changed tests.
LeonardoViotti May 1, 2024
506dcd3
Black formatted.
LeonardoViotti May 1, 2024
36229f4
bugfix resolves #930
louisfh May 2, 2024
2a01d04
resolves Many overlap_fractions don't produce results #945
sammlapp May 2, 2024
8364957
Merge branch 'develop' into issue_945_overlap
sammlapp May 13, 2024
f94832c
Merge branch 'develop' into issue_945_overlap
sammlapp May 13, 2024
a8c32fa
black
sammlapp May 13, 2024
ab7e754
Merge branch 'develop' into issue_749_crowsetta
sammlapp May 13, 2024
c35d712
Cleaned dtypes and assignemnt function in preprocessor.foward().
LeonardoViotti May 16, 2024
556a7ad
Black formatted.
LeonardoViotti May 16, 2024
b99efac
Merge branch 'develop' into patch_wandb_windows
sammlapp May 20, 2024
59906ac
check for labels outside range [0,1]
sammlapp May 20, 2024
92bd4a9
more flexible specification of overlap
sammlapp May 21, 2024
fb0256d
Merge branch 'develop' into issue_945_overlap
sammlapp May 21, 2024
e89f060
only use internal pytorch architectures
sammlapp May 21, 2024
2ceb6a9
update arg name in test
sammlapp May 21, 2024
e4723f9
don't nest wandb tables
sammlapp May 22, 2024
68d012b
Merge branch 'develop' into patch_wandb_windows
sammlapp May 22, 2024
8b90123
Merge pull request #1003 from kitzeslab/issue_876_window_step
sammlapp May 22, 2024
a1429b7
Merge pull request #1000 from kitzeslab/patch_wandb_windows
sammlapp May 22, 2024
ad0d6b8
Merge pull request #1001 from kitzeslab/issue_891_labels
sammlapp May 22, 2024
422ad3c
upgrade to pytoroch 2.1.1
sammlapp May 23, 2024
07475d1
update to grad-cam >=1.5.0
sammlapp May 23, 2024
31f9c99
Merge pull request #999 from kitzeslab/issue_889_preprocessor_futurew…
sammlapp May 23, 2024
2565b58
fix and add tests for AudioPreprocessor and audio_trim
sammlapp May 23, 2024
cf0de77
Merge pull request #1006 from kitzeslab/issue_911_spec_titles
sammlapp May 23, 2024
cd2b4bf
poetry lock
sammlapp May 23, 2024
f5e784e
Merge branch 'develop' into issue_749_crowsetta
sammlapp May 23, 2024
bc22bc7
Merge branch 'develop' into issue_945_overlap
sammlapp May 23, 2024
818446c
update arg in test to clip_overlap_fraction
sammlapp May 23, 2024
d452be9
poetry lock
sammlapp May 23, 2024
acdd7a3
Merge branch 'develop' into issue_942_wrong_index
sammlapp May 23, 2024
9fb67f1
initial working pt lightning refactor
sammlapp May 24, 2024
4172951
use .to(self.device)
sammlapp May 24, 2024
eccad08
Merge pull request #1004 from kitzeslab/issue_998_efficientnet
sammlapp May 24, 2024
741cf5e
Merge pull request #996 from kitzeslab/issue_945_overlap
sammlapp May 24, 2024
a80e8f6
before refactoring CNN to wrap LitMod
sammlapp May 27, 2024
7c0e557
add test for #930
louisfh May 28, 2024
4486d45
outline least squares optimizer for localization
louisfh May 28, 2024
dc7980e
Add least_squares optimizer for solving position from TDOAs
louisfh May 28, 2024
7cf7064
working on lightning 5/28
sammlapp May 30, 2024
90c83b0
use lxml<5.1.1 to avoid docs build error
sammlapp May 31, 2024
883b199
need docutils<0.19 to avoid error
sammlapp May 31, 2024
017e222
gitignore docs/tutorials/annotated_data
sammlapp Jun 1, 2024
facb2a4
gitignore docs/tutorials/annotated_data
sammlapp Jun 1, 2024
2dfabc0
Make localization pipeline test use least_squares as a default.
louisfh Jun 5, 2024
5eebb9b
Minor style changes to control flow if df.empty
LeonardoViotti Jun 6, 2024
6e3f609
Added _required_cols and _standard_cols as class variables for BoxedA…
LeonardoViotti Jun 6, 2024
31cb872
fixes #770, 10-fold speed up of one_hot_labels_like
louisfh Jun 6, 2024
a098b9f
delete tests for deleted function
louisfh Jun 6, 2024
d00281a
addresses #1011 incorrect dafult argument, and fixes tests.
louisfh Jun 7, 2024
f2543ec
add tests for find_overlapping_idxs_in_clip_df
louisfh Jun 7, 2024
b5f9eec
add test for no overlap
louisfh Jun 7, 2024
b817b41
refactor in progress
sammlapp Jun 18, 2024
23f4d3e
Merge branch 'master' into develop
sammlapp Jun 21, 2024
6dcecd7
upgrade dependencies and black version
sammlapp Jun 21, 2024
07a38d3
remove macos github runner
sammlapp Jun 21, 2024
d842647
use cls._standard_cols in BoxedAnnotations.from_raven_files
sammlapp Jun 21, 2024
27563ac
reformat with new black version
sammlapp Jun 21, 2024
0d2ddc6
Merge branch 'develop' into issue_855_one_hot_labels
sammlapp Jun 21, 2024
7c2b71e
Merge branch 'develop' into issue_930_localization_bug
sammlapp Jun 21, 2024
7cff5ce
Merge pull request #982 from kitzeslab/issue_855_one_hot_labels
sammlapp Jun 21, 2024
703530a
Merge branch 'develop' into issue_749_crowsetta
sammlapp Jun 21, 2024
3b39224
update test for too few recorders after filtering
sammlapp Jun 21, 2024
0da7bc5
Merge branch 'develop' into issue_749_crowsetta
sammlapp Jun 21, 2024
f3943c9
update BoxedAnnotations tests and __init__ behavior with df=None
sammlapp Jun 21, 2024
4212bd3
add note in to_csv that attributes besides .df are lost
sammlapp Jun 21, 2024
2fe1576
Merge pull request #764 from kitzeslab/issue_749_crowsetta
sammlapp Jun 21, 2024
824ee5f
Merge pull request #990 from kitzeslab/issue_930_localization_bug
sammlapp Jun 21, 2024
6565e05
working refactor for lighting + plain pytorch
sammlapp Jun 21, 2024
0ca3614
remove unused imports
sammlapp Jun 22, 2024
759eb2c
Merge branch 'develop' into feat_935_spec
sammlapp Jun 22, 2024
2dfc89d
modify get_args/get_reqd_args to not return "kwargs" as an arg
sammlapp Jun 22, 2024
fd6a2a4
implement SpectrogramClassifier.embed()
sammlapp Jun 22, 2024
3f85698
rename one_hot to multi_hot
sammlapp Jun 23, 2024
78b6660
use timestamps in localization tools
sammlapp Jul 3, 2024
3f6cfba
add test for __call__
sammlapp Jul 12, 2024
cb928ae
fix test input
sammlapp Jul 12, 2024
5c05e15
remove return_self arg from estimate_location()
sammlapp Jul 12, 2024
9d586d2
fix cam device mismatch
sammlapp Jul 12, 2024
fd07b8c
add CNN class alias
sammlapp Jul 12, 2024
109ad8a
fix channel dimension mismatch when providing architecture object
sammlapp Jul 12, 2024
ecd6407
automatic mixed precision
sammlapp Jul 13, 2024
c852767
fix inception and related tests
sammlapp Jul 13, 2024
13bcc47
fix autocasting
sammlapp Jul 15, 2024
d33856c
implement noise reduction
sammlapp Jul 23, 2024
8c70f36
add tests and fix bugs
sammlapp Jul 23, 2024
f9f83ca
reduce required ipython version
sammlapp Jul 23, 2024
6f21f85
Update preprocessing tutorial
syunkova Jul 26, 2024
222f2f4
Fix typos in metrics.py file
syunkova Jul 26, 2024
f9c1dff
Fix typos in spectrogram.py
syunkova Jul 26, 2024
b729842
implement preprocessor save and load
sammlapp Aug 14, 2024
f326362
add tests for preprocessor and action i/o
sammlapp Aug 15, 2024
a2a2700
resolve testing errors for preprocesing io
sammlapp Aug 15, 2024
e264618
update model saving/loading
sammlapp Aug 15, 2024
a5db156
rename attribute SpectrogramModule.model to .network
sammlapp Aug 15, 2024
66d0b79
Merge branch 'develop' into lightning
sammlapp Aug 15, 2024
1d3e94d
fix issues from "merge develop"
sammlapp Aug 15, 2024
acacfee
poetry lock
sammlapp Aug 15, 2024
314d9e3
expose audio.load_metadata in api
sammlapp Aug 16, 2024
9dba420
run poetry lock
sammlapp Aug 16, 2024
1085919
require lower pandera version #1017
sammlapp Aug 16, 2024
a328347
Merge branch 'develop' into 922_docs_fixes
sammlapp Aug 16, 2024
2efe9e6
Merge branch 'develop' into issue_931_metadata
sammlapp Aug 16, 2024
95e4790
Merge branch 'develop' into feat_655_noise_reduce
sammlapp Aug 16, 2024
5bc553a
fix specification for pandera version
sammlapp Aug 16, 2024
71857d5
Merge branch 'develop' into 922_docs_fixes
sammlapp Aug 16, 2024
9ab3e36
Merge branch 'develop' into feat_655_noise_reduce
sammlapp Aug 16, 2024
d4ebbaf
Merge branch 'develop' into issue_931_metadata
sammlapp Aug 16, 2024
c53580a
use fixed seed in test reduce_noise
sammlapp Aug 16, 2024
f422f02
pandera <0.20
sammlapp Aug 19, 2024
2eb8eb7
upgrade to numpy >2.0.0
sammlapp Aug 19, 2024
1e3bb7e
Merge branch 'develop' into feat_655_noise_reduce
sammlapp Aug 19, 2024
e796757
poetry locok
sammlapp Aug 19, 2024
00a52df
Merge branch 'develop' into issue_931_metadata
sammlapp Aug 19, 2024
60757ec
Merge branch 'develop' into 922_docs_fixes
sammlapp Aug 19, 2024
2d6fd04
downgrade to numpy<2.0 until other packages support it
sammlapp Aug 19, 2024
f645c7d
Merge branch 'develop' into 922_docs_fixes
sammlapp Aug 19, 2024
7fa8ad2
Merge branch 'develop' into issue_931_metadata
sammlapp Aug 19, 2024
08b9099
Merge branch 'develop' into feat_655_noise_reduce
sammlapp Aug 19, 2024
c354d20
Merge pull request #1015 from kitzeslab/feat_935_spec
sammlapp Aug 19, 2024
14e8298
Merge pull request #1029 from kitzeslab/922_docs_fixes
sammlapp Aug 19, 2024
3ad9221
poetry lock
sammlapp Aug 19, 2024
db4d4b8
fix preprocessor modifying sample and tests
sammlapp Aug 19, 2024
a688ac5
Merge pull request #1037 from kitzeslab/issue_931_metadata
sammlapp Aug 19, 2024
0480652
Merge pull request #1025 from kitzeslab/feat_655_noise_reduce
sammlapp Aug 19, 2024
cb19552
adds MultiChannelAudio class
sammlapp Aug 19, 2024
b2d0981
Merge branch 'feat_971_embed' into lightning
sammlapp Aug 19, 2024
0f471c0
Merge branch 'develop' into lightning
sammlapp Aug 19, 2024
68184f3
revert to returning self in SpatialEvent.estimate_location
sammlapp Aug 19, 2024
08d1466
add pytorch-lightning requirement
sammlapp Aug 19, 2024
9a0957a
use torch for faster Spectrogram.to_image
sammlapp Aug 19, 2024
f1d5750
trust_repo when calling model zoo wrappers
sammlapp Aug 19, 2024
a67ef14
require lightning rather than pytorch-lightning
sammlapp Aug 19, 2024
801b5ea
rename Action.go() to Action.__call__
sammlapp Aug 19, 2024
7893b9f
add n_samples_without_labels flag for resampling
sammlapp Aug 19, 2024
b29ebfe
re-add old behavior for Spectrogram.to_image
sammlapp Aug 19, 2024
e1de407
Merge branch 'develop' into issue_954_call_actions
sammlapp Aug 19, 2024
234a5d9
Merge branch 'develop' into lightning
sammlapp Aug 19, 2024
a86514e
Merge branch 'develop' into feat_305_multichannel
sammlapp Aug 19, 2024
a847436
Merge pull request #1038 from kitzeslab/feat_305_multichannel
sammlapp Aug 19, 2024
e434d67
Merge pull request #1039 from kitzeslab/issue_954_call_actions
sammlapp Aug 19, 2024
8b58401
no longer test for unexpected arg
sammlapp Aug 19, 2024
e884d8a
fix tests
sammlapp Aug 19, 2024
978fa67
Merge branch 'develop' into lightning
sammlapp Aug 23, 2024
9b0ff6f
black fmt
sammlapp Aug 23, 2024
78cb1a5
don't attempt to localize if estimate_delays failed
sammlapp Aug 23, 2024
25dda63
update and add localization tests
sammlapp Aug 23, 2024
6b34943
require start_timestamp to be time-zone aware if included in detectio…
sammlapp Aug 23, 2024
c99edc0
fix tests
sammlapp Aug 26, 2024
684cb33
avoid using default (computer's) timezone when creating datetime objects
sammlapp Aug 26, 2024
93b0c44
Merge branch 'develop' into issue_770_slow_annotations_functions
louisfh Aug 28, 2024
9dc88b7
update notebooks to run smoothly
sammlapp Aug 28, 2024
492f852
fix float64 casting error for mps
sammlapp Aug 28, 2024
e172c8b
fix logic error in checking for arch in arch_dict
sammlapp Aug 28, 2024
c3901bc
add check for save/load recover model weights
sammlapp Aug 28, 2024
2aac95b
re-add top-level CNN import
sammlapp Aug 28, 2024
11e2f11
add PCENPreprocessor
sammlapp Aug 28, 2024
5f7919e
Merge pull request #1020 from kitzeslab/loca_timestamp
sammlapp Aug 28, 2024
8b25852
add new test for fraction overlap and make requested changes
louisfh Aug 28, 2024
3a63aef
add freeze_feature_extractor() method to SpectrogramModule
sammlapp Aug 28, 2024
ce2a050
black
louisfh Aug 28, 2024
351ac7f
edit pre-commit black version
louisfh Aug 28, 2024
1e64bee
change .targets["classifier"] layer of alexnet and vgg11_bn
sammlapp Aug 29, 2024
011847d
add tests for freeze, unfreeze_layers_except, freeze_feature_extractor
sammlapp Aug 29, 2024
ddab7d5
add CNN.change_classes api and re-factor arch generators
sammlapp Aug 29, 2024
ecd5bd6
update generate_cams access of default layer
sammlapp Aug 29, 2024
fa14646
use module.requires_grad_()
sammlapp Aug 29, 2024
3b1d230
training continues even if model pickled save fails
sammlapp Aug 30, 2024
4b838f9
clean up after adding custom arch in test
sammlapp Aug 30, 2024
54daab0
Merge pull request #1036 from kitzeslab/lightning
sammlapp Aug 30, 2024
9d81dcf
documentation for using old models
sammlapp Aug 30, 2024
e36ae8c
useful error if AudioSampleDataset recieves multiple indices
sammlapp Aug 30, 2024
a892764
Merge branch 'develop' into feat_350_pcen
sammlapp Aug 30, 2024
b89be05
add tests for PCENPreprocessor
sammlapp Aug 30, 2024
c1ab610
cast label to longavoids "RuntimeError: one_hot is only applicable to…
sammlapp Aug 31, 2024
a10df73
refactor configure_optimizers to fix continued training behavior
sammlapp Sep 4, 2024
10e2fbb
in progress categorical and sparse label support
sammlapp Sep 4, 2024
70aa5a1
Merge remote-tracking branch 'origin/issue_770_slow_annotations_funct…
sammlapp Sep 5, 2024
56de667
BoxedAnnotations refactor to clip_labels() and labels_on_index()
sammlapp Sep 5, 2024
16ea52e
remove outdated test split_resnet_feat_clf
sammlapp Sep 6, 2024
249a8e8
switch from bool to int for sparse label dtype
sammlapp Sep 6, 2024
5b268c2
avoid accessing self.optimizer when lightning calls configure_optimizers
sammlapp Sep 6, 2024
51263bc
embed(): return dataframe rather than matrix
sammlapp Sep 6, 2024
d39833e
add switch for embed() to return dfs or arrays
sammlapp Sep 6, 2024
e1fa094
add tests for CategoricalLabels class
sammlapp Sep 9, 2024
4556a60
fix test for class_names=None
sammlapp Sep 9, 2024
a3d4001
Merge pull request #1048 from kitzeslab/feat_350_pcen
sammlapp Sep 9, 2024
3f7af4a
update quickstart, add model zoo example
sammlapp Sep 9, 2024
70301d5
update docstrings and move samples=[samples] to predict_dataloader()
sammlapp Sep 10, 2024
6f6198e
Merge branch 'develop' into issue_942_wrong_index
sammlapp Sep 10, 2024
52f7d76
clean up imports
sammlapp Sep 10, 2024
fdd1266
Merge pull request #1053 from kitzeslab/feat_categorical_labels
sammlapp Sep 10, 2024
19b9645
Merge branch 'develop' into issue_942_wrong_index
sammlapp Sep 10, 2024
ad84d6f
call super() without arguments
sammlapp Sep 10, 2024
59fb509
update import of get_cmap
sammlapp Sep 10, 2024
9d02de0
add lightning_logs/ dir to gitignore
sammlapp Sep 10, 2024
80b4d5d
list methods & attributes in docstrings
sammlapp Sep 10, 2024
7cb3523
better action printing
sammlapp Sep 10, 2024
341d077
specify black ~24.3
sammlapp Sep 11, 2024
d79c214
improve documentation of utils modules
sammlapp Sep 11, 2024
1265d2d
decrease pillow version requirement
sammlapp Sep 12, 2024
270dcd4
update tutorial notebook pip install
sammlapp Sep 12, 2024
b4aae3e
Merge pull request #1054 from kitzeslab/issue_942_wrong_index
sammlapp Sep 12, 2024
661aa20
add docstring for CategoricalLabels.from_multihot_df
sammlapp Sep 12, 2024
4c37f33
use num_workers=0 for colab notebooks
sammlapp Sep 12, 2024
7896c63
update predict tutorial
sammlapp Sep 12, 2024
3b89136
use model zoo tagged version
sammlapp Sep 12, 2024
1961d01
update dead links in docs
sammlapp Sep 12, 2024
abbc086
catch any exception when checking channel dimensions
sammlapp Sep 12, 2024
3118648
convert both targets and labels to float32 for eval()
sammlapp Sep 13, 2024
7a2ea1b
pass dataloader kwargs to run_validation
sammlapp Sep 13, 2024
65d6c48
changed annotation column selection format
syunkova Sep 17, 2024
a348cc6
added black formatting
syunkova Sep 17, 2024
8625726
updating to include newer changes
syunkova Sep 17, 2024
a936cbb
added tests for changes with loading annotations
syunkova Sep 17, 2024
8fdd83c
format test file
syunkova Sep 17, 2024
261215b
fixed np.nan error when setting whole column to it
syunkova Sep 17, 2024
6566aeb
quick fix for testing np nan column
syunkova Sep 17, 2024
2168f70
fixed numeric values for annotation column value
syunkova Sep 17, 2024
b2755f1
added black formatting to annotations + tests
syunkova Sep 17, 2024
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
56 changes: 29 additions & 27 deletions .github/workflows/poetry.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,33 +37,35 @@ jobs:
run: /home/runner/.local/bin/poetry run pytest
- name: Poetry run black check
run: /home/runner/.local/bin/poetry run black . --check --diff
test_macos:
runs-on: macos-latest
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11"]
# Ensure that all flavours are run to completion even if an other flavor failed
fail-fast: false
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install libsndfile
run: brew install libsndfile
- name: Install ffmpeg v4
run: brew install ffmpeg
- name: Install poetry
run: curl -sSL https://install.python-poetry.org | python
- name: Poetry install
run: /Users/runner/.local/bin/poetry install
- name: Workaround for missing pytorch dependencies during poetry install
run: /Users/runner/.local/bin/poetry run pip install torch
- name: Poetry run pytest
run: /Users/runner/.local/bin/poetry run pytest
- name: Poetry run black check
run: /Users/runner/.local/bin/poetry run black . --check --diff
# temporarily disabling macos tests as they are failing due to mps out of memory errors
# that we can't seem to fix. - SL 2024-06-21
# test_macos:
# runs-on: macos-latest
# strategy:
# matrix:
# python-version: ["3.9", "3.10", "3.11"]
# # Ensure that all flavours are run to completion even if an other flavor failed
# fail-fast: false
# steps:
# - uses: actions/checkout@v2
# - name: Set up Python ${{ matrix.python-version }}
# uses: actions/setup-python@v2
# with:
# python-version: ${{ matrix.python-version }}
# - name: Install libsndfile
# run: brew install libsndfile
# - name: Install ffmpeg v4
# run: brew install ffmpeg
# - name: Install poetry
# run: curl -sSL https://install.python-poetry.org | python
# - name: Poetry install
# run: /Users/runner/.local/bin/poetry install
# - name: Workaround for missing pytorch dependencies during poetry install
# run: /Users/runner/.local/bin/poetry run pip install torch
# - name: Poetry run pytest
# run: /Users/runner/.local/bin/poetry run pytest
# - name: Poetry run black check
# run: /Users/runner/.local/bin/poetry run black . --check --diff
## ------------------------------------------------------------------------
## The below job installs opensoundscape on a windows machine using WSL.
## It is commented out, as it keeps hanging on the final step 'Poetry run pytest'
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@ docs/tutorials/woodcock_labeled_data
docs/tutorials/annotated_data
.vscode
docs/tutorials/wandb
untracked/
docs/tutorials/annotated_data
lightning_logs/
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/psf/black
rev: 22.8.0
rev: 24.8.0
hooks:
- id: black
# It is recommended to specify the latest version of Python
Expand Down
45 changes: 26 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ Details about installation are available on the OpenSoundscape documentation at
* Most computer cluster users should follow the Linux installation instructions


### Use Audio and Spectrogram classes
### Use Audio and Spectrogram classes to inspect audio data
```python
from opensoundscape import Audio, Spectrogram

Expand All @@ -85,7 +85,27 @@ path = '/path/to/audiomoth_file.WAV' #an AudioMoth recording
Audio.from_file(path, start_timestamp=start_time,duration=audio_length)
```

### Use a pre-trained CNN to make predictions on long audio files
### 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 respository that can be accessed via `torch.hub` and are compatible with OpenSoundscape. Load up a model and apply it to your own audio right away:

```python
from opensoundscape.ml import bioacoustics_model_zoo as bmz

#list available models
print(bmz.list_models())

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

#...or BirdNET
birdnet = bmz.load("BirdNET")
scores = birdnet.predict(files)
embeddings = birdnet.generate_embeddings(files)
```

### Load a pre-trained CNN from a local file, and make predictions on long audio files
```python
from opensoundscape import load_model

Expand Down Expand Up @@ -113,7 +133,7 @@ all_annotations = BoxedAnnotations.from_raven_files(raven_file_paths,audio_file_
class_list = ['IBWO','BLJA']

# create labels for fixed-duration (2 second) clips
labels = all_annotations.one_hot_clip_labels(
labels = all_annotations.clip_labels(
cip_duration=2,
clip_overlap=0,
min_label_overlap=0.25,
Expand All @@ -125,20 +145,7 @@ train_df, validation_df = train_test_split(labels, test_size=0.3)

# create a CNN and train on the labeled data
model = CNN(architecture='resnet18', sample_duration=2, classes=class_list)
model.train(train_df, validation_df, epochs=20, num_workers=8, batch_size=256)
```

### Train a CNN with labeled audio data (one label per audio file):
```python
from opensoundscape import CNN
from sklearn.model_selection import train_test_split

#load a DataFrame of one-hot audio clip labels
df = pd.read_csv('my_labels.csv') #index: paths; columns: classes
train_df, validation_df = train_test_split(df,test_size=0.2)

#create a CNN and train on 2-second spectrograms for 20 epochs
model = CNN('resnet18', classes=df.columns, sample_duration=2.0)
model.train(train_df, validation_df, epochs=20)
#the best model is automatically saved to a file `./best.model`
```
# train the model to recognize the classes of interest in audio data
model.train(train_df, validation_df, epochs=20, num_workers=8, batch_size=256)
```
2 changes: 1 addition & 1 deletion docs/classifier_guide/guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Fig. 1. A ~15 s spectrogram containing the songs of six bird species. Some examp
## Kinds of classifiers
Many different types of classifiers for sound exist, but we typically use something called a **Convolutional Neural Network**, or **"CNN"** for short. This is a type of classifier created using machine learning. This type of classifier uses spectrograms to assign a score to sound clips based on how confident it is that a sound clip belongs in one of the classes it has been trained to recognize. CNNs can have any number of desired classes which can range from all the vocalizations produced by a bird species, to specific vocalizations of a bird species, to sounds such as gunshots. Fig. 1 could represent all of the classes in an example CNN.

CNNs are not the only solution, nor the best solution to sound classification in every case. CNNs work best when a sound is relatively complex like the songs of most songbirds and when sounds are highly variable or inconsistent. Some animal sounds are much more like simple, repeated pulses which are highly consistent but could be mistaken for other environmental sounds by a naive observer. For such purposes, this lab has also developed other classifiers which rely on the periodic structure of simple sounds to classify them, which we often refer to as **signal processing** algorithms. [RIBBIT](http://opensoundscape.org/en/latest/tutorials/RIBBIT_pulse_rate_demo.html) (which stands for "Repeat-Interval Based Bioacoustic Identification Tool") is one of these classifiers which can be used for animals such as certain frogs (see Fig. 2 below for an example). Another was created specifically to classify the accelerating pulses of Ruffed Grouse drums <a href="https://doi.org/10.1002/wsb.1395" target="_blank"> (Lapp <em>et al.</em> 2022 <em>Wildl.Soc. Bull.</em> e1395)</a>. This document focuses on the training of CNNs, but be aware that signal processing algorithms are options for sound classification.
CNNs are not the only solution, nor the best solution to sound classification in every case. CNNs work best when a sound is relatively complex like the songs of most songbirds and when sounds are highly variable or inconsistent. Some animal sounds are much more like simple, repeated pulses which are highly consistent but could be mistaken for other environmental sounds by a naive observer. For such purposes, this lab has also developed other classifiers which rely on the periodic structure of simple sounds to classify them, which we often refer to as **signal processing** algorithms. [RIBBIT](http://opensoundscape.org/en/latest/tutorials/signal_processing.html) (which stands for "Repeat-Interval Based Bioacoustic Identification Tool") is one of these classifiers which can be used for animals such as certain frogs (see Fig. 2 below for an example). Another was created specifically to classify the accelerating pulses of Ruffed Grouse drums <a href="https://doi.org/10.1002/wsb.1395" target="_blank"> (Lapp <em>et al.</em> 2022 <em>Wildl.Soc. Bull.</em> e1395)</a>. This document focuses on the training of CNNs, but be aware that signal processing algorithms are options for sound classification.

![](./media/image17.png)

Expand Down
1 change: 1 addition & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ def setup(app):
"wandb",
"pytorch_grad_cam",
"aru_metadata_parser",
"crowsetta",
"pytz",
"pillow",
"PIL",
Expand Down
2 changes: 1 addition & 1 deletion docs/intro/quick-start.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ all_annotations = BoxedAnnotations.from_raven_files(raven_file_paths,audio_file_
class_list = ['IBWO','BLJA']

# create labels for fixed-duration (2 second) clips
labels = all_annotations.one_hot_clip_labels(
labels = all_annotations.clip_labels(
cip_duration=2,
clip_overlap=0,
min_label_overlap=0.25,
Expand Down
2 changes: 1 addition & 1 deletion docs/tutorials/acoustic_localization.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"source": [
"# if this is a Google Colab notebook, install opensoundscape in the runtime environment\n",
"if 'google.colab' in str(get_ipython()):\n",
" %pip install opensoundscape"
" %pip install git+https://github.com/kitzeslab/opensoundscape@develop ipykernel==5.5.6 ipython==7.34.0 pillow==9.4.0"
]
},
{
Expand Down
Loading
Loading