wytham-songtype-validation
Code to train a classifier to check the robustness of a manual classification of song types following McGregor & Krebs 1982
Science Score: 67.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
✓DOI references
Found 4 DOI reference(s) in README -
✓Academic publication links
Links to: biorxiv.org, wiley.com -
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (17.6%) to scientific vocabulary
Repository
Code to train a classifier to check the robustness of a manual classification of song types following McGregor & Krebs 1982
Basic Info
- Host: GitHub
- Owner: nilomr
- License: mit
- Language: Python
- Default Branch: main
- Size: 587 MB
Statistics
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
- Releases: 0
Metadata Files
README.md
This repository contains the code to to train a classifier to check the robustness of a manual classification of Great Tit song types following McGregor & Krebs (1982). For more information on the preprocessing of the data, see this paper. Model training follows the steps described in this article.
A narrative code notebook including outputs can be found here.
Installation
Create a new environment, e.g. using miniconda:
bash conda create -n wytham-songtype-validation python=3.9Clone this repository to your local machine, navigate to its root and install using pip:
bash
git clone https://github.com/nilomr/wytham-songtype-validation.git
cd wytham-songtype-validation
pip install .
GPU installation
One of the steps to reproduce this example involves training a deep neural network, which requires compatible GPU resources.
If you want to reatrain the model, you will need a few more libraries that are not installed automatically with pykanto. The reason for this is that the are a bit finicky: which exact installation you need depends on which version of CUDA you have and the like.
I recommend that, if this is the case, you first create a fresh environment with conda:
bash
conda create -n wytham-songtype-validation python=3.9
And then install torch, pykanto and this example including the extra libraries.
```bash
conda install -c pytorch pytorch torchvision
pip install pykanto
Navigate to the root of this repository, then:
pip install ."[torch]" # see the pyproject.toml file for other options ```
User guide
First, make sure that you have activated this project's environment (conda
activate wytham-songtype-validation if you followed the instructions above). Then,
navigate to /notebooks. This is where the scripts are located. They can
all be run from the terminal, python <script-name>.
Expand user guide
| Script | Description | Use | | --------------------------- | ----------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `1_prepare-dataset.py` | Ingests, creates spectrograms, and segments the dataset[^1] | To run: `python 1_prepare-dataset.py`.
Requires the output of [this repository](https://github.com/nilomr/great-tit-hits-setup). | | `3_export-training-data.py` | Exports the data required to train the deep learning model | `python 3_export-training-data.py` | | `4_train-model.ipynb` | Model definition and training step | A separate, self-contained jupyter notebook. This is to make it easier to run interactively on a GPU-enabled HPC. If you don't want to retrain the model, you can skip this step. | | `5_save_labels.py` | Saves the checked labels to a csv file | `python 5_save_labels.py` | [^1]: If you want to run this in a HPC you can use `pykanto`'s tool for this, which makes it very easy (see [Docs](https://nilomr.github.io/pykanto/_build/html/contents/hpc.html) for more info).
© Nilo M. Recalde, 2021-present
Owner
- Name: Nilo
- Login: nilomr
- Kind: user
- Location: Oxford, UK
- Company: Edward Grey Institute, Department of Zoology
- Website: https://www.biology.ox.ac.uk/people/nilo-merino-recalde-0
- Twitter: nilomr
- Repositories: 3
- Profile: https://github.com/nilomr
PhD student @OxfordUniversity working on bird song learning and cultural evolution.
Citation (CITATION.cff)
cff-version: 1.2.0 message: "If you use this software, please cite it as below." authors: - family-names: "Merino Recalde" given-names: "Nilo" orcid: "https://orcid.org/0000-0003-3903-1288" title: "pykanto-example" version: 1.0 doi: 10.5281/zenodo.7941355 date-released: 2023-05-16 url: "https://github.com/nilomr/pykanto-example"
GitHub Events
Total
- Watch event: 1
Last Year
- Watch event: 1
Dependencies
- pykanto *
- pyrootutils *
- typer *