Skip to main content

Build Status DOI PyPI version License

koumura

Functions for working with data from the following repository: https://figshare.com/articles/BirdsongRecognition/3470165

The repository contains .wav files of Bengalese finch song from ten birds and annotation for the songs in .xml files.

This repository provides a great resource, and was used to benchmark a sliding window-based neural network for segmenting and labeling the elements of birdsong, as described in the following paper:
Koumura, Takuya, and Kazuo Okanoya.
"Automatic recognition of element classes and boundaries in the birdsong with variable sequences."
PloS one 11.7 (2016): e0159188.
https://journals.plos.org/plosone/article?id=10.1371/journal.pone.0159188

The code for the network can be found here:
https://github.com/takuya-koumura/birdsong-recognition

The original code was released under the GNU license:
https://github.com/takuya-koumura/birdsong-recognition/blob/master/LICENSE

The koumura module is used with the crowsetta package to make the repository a dataset available in the hybrid-vocal-classifier and vak libraries.

It's called koumura because that's the last name of the first author on the paper, and because I am too lazy to type PyBirdsongRecognition.

Installation

$ pip install koumura

Usage

The main thing that koumura gives you is easy access to the annotation, without having to deal with the .xml file format.

To access the annotation in the Annotation.xml files for each bird, use the parse_xml function.

>>> from koumura import parse_xml
>>> seq_list = parse_xml(xml_file='./Bird0/Annotation.xml', concat_seqs_into_songs=False)
>>> seq_list[0]
Sequence from 0.wav with position 32000 and length 43168
>>> seq_list[0].syls[:3]
[Syllable labeled 0 at position 2240 with length 2688, Syllable labeled 0 at position 8256 with length 2784, Syllable labeled 0 at position 14944 with length 2816]  

Notice that this package preserves the abstraction of the original code, where syllables and sequences of syllables are represented as objects. This can be helpful if you are trying to replicate functionality from that code.
Importantly, each song is broken up into a number of "sequences". You can set the flag concat_seqs_into_songs to True if you want parse_xml to concatenate sequences by song (.wav file), so that each Sequence is actually all the sequences from one song.
If you are using the annotation to work with the dataset for some other purpose, you may find it more convenient to work with some other format. For that, please check out the crowsetta tool, that helps with building datasets of annotated vocalizations in a way that's annotation-format agnostic.

The koumura package also provides a convenience function to load the annotation for an individual song, load_song_annot. This is basically a wrapper around parse_xml that filters out the songs you don't want.

>>> from koumura import load_song_annot
>>> wav1 = load_song_annot(wav_file='1.wav')
>>> print(wav1)                                                                                                  
Sequence from 1.wav with position 32000 and length 214176  

Getting Help

Please feel free to raise an issue here:
https://github.com/NickleDave/koumura/issues

License

BSD License.

Citation

If you use this package, please cite the DOI: DOI

Metadata

Release files for koumura 0.2.1.post1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for koumura 0.2.1.post1
File Size Uploaded
koumura-0.2.1.post1.tar.gz 11.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for koumura 0.2.1.post1
File Interpreter ABI Platform
koumura-0.2.1.post1-py3-none-any.whl Python 3 none any Details

Total release size: 21.2 kB

Release files / koumura-0.2.1.post1.tar.gz

Download URL koumura-0.2.1.post1.tar.gz
Size 11.0 kB
Tags Source
SHA-256 checksum
How to use checksums
742e8b9056cb5c99cef27ff5e44463c980450f866eedf8bac0b64a4271522cab
BLAKE2b-256 checksum
How to use checksums
a46bf324f58eba54d7e605cfe77c3222b890c52300e0b9d192ea6d11a372ecb2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.4 CPython/3.6.13 Linux/5.4.0-7634-generic

Release files / koumura-0.2.1.post1-py3-none-any.whl

Download URL koumura-0.2.1.post1-py3-none-any.whl
Size 10.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5e0cc4642c32b43f98b8f7d2f65992ce959ee977d35f1515d6f633f991fe427b
BLAKE2b-256 checksum
How to use checksums
3bbf055f125d21dd5e7fd8252ffa4b9811356f8d9dfcd05d6e85f097833838e2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.4 CPython/3.6.13 Linux/5.4.0-7634-generic

Release history Release notifications | RSS feed

This release

0.2.1.post1 This release

2 release files

0.2.1

2 release files

0.2.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page