1 Star 0 Fork 1

David Gao / birdbrain

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README

BirdBrain

This repo contains code to search the Xeno-canto bird sound database, and train a machine learning model to classify birds according to those sounds.

Setup

FFMPEG is required for audio processing.

On OS X this can be downloaded and installed using Homebrew:

$ brew install ffmpeg

Clone this repo and cd into the repositories root directory.

Install python libraries. (This repo has bee tested using python 3.6.5.)

$ pip install -r requirements.txt

To use the shell scripts for downloading and processing data, and training a model, set these environment variables:

  • BIRDBRAIN_ROOT should point to this repositories root directory.
  • TENSORFLOW_SRC_ROOT should point to the tensor flow source code root directory.
  • BACKGROUND_NOISE should point to the _background_noise_ directory which is downloadable here: download.tensorflow.org/data/speech_commands_v0.02.tar.gz.

Download recordings

bin/search_xeno_canto.py --help shows command line options:

usage: search_xeno_canto.py [-h] [-q QUERY] [-d] [-m MAXSIZE]
                            [-n MAXNDOWNLOADS] [-p DIRECTORY]

Search for bird song recordings from https://www.xeno-canto.org that match a
query.

optional arguments:
  -h, --help            show this help message and exit
  -q QUERY, --query QUERY
                        Query. See https://www.xeno-canto.org/help/search for
                        details. Example: "gen: columba sp: palumbus q > : C"
  -d, --download        Download records that match the query.
  -m MAXSIZE, --max-file-size MAXSIZE
                        Only download files smaller than max-file-size bytes.
  -n MAXNDOWNLOADS, --max-number-downloads MAXNDOWNLOADS
                        Maximum number of files to download.
  -p DIRECTORY, --directory DIRECTORY
                        Directory to save downloads.

An example search:

src/search_xeno_canto.py --download \
                         --query "Wood pigeon" \
                         --max-file-size 600000 \
                         --directory data/downloads \
                         --max-number-downloads 1000

A batch of queries can be searched using bin/download.sh batch.txt. Here batch.txt is a text file containing one query per line. See common.txt for an example.

Convert and split

Recording have to be converted to 16-bit little-endian PCM-encoded WAVE format. This is done by bin/mpeg-to-wav.sh which converts mpeg files in data/downloads and puts them in data/wav.

Recordings are then split into 3 second segments using bin/split-wav.sh. This is a constraint of the machine learning model that is used, which requires training samples of a similar length of time. Segmented files are saved to data/samples/GEN_SP where GEN_SP corrseponds to the genus and species of each recording.

Model training

Training uses TensorFlow, and specifically the model outlined and implemented in this tutorial. Training is run by using bin/run_training.sh. To understand the output of the model, follow training progress, and produce a simple app for android smartphones, see more details on the TensorFlow tutorial, linked above.

Run "$TENSORFLOW_SRC_ROOT"/tensorflow/examples/speech_commands/train.py --help to see command line options available.

空文件

简介

Code for searching the www.xeno-canto.org bird sound database, and training a machine learning model to classify birds according to their sounds. 展开 收起
Python 等 3 种语言
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
1
https://gitee.com/davidgao7/birdbrain.git
git@gitee.com:davidgao7/birdbrain.git
davidgao7
birdbrain
birdbrain
master

搜索帮助