birdwatcher

A Python computer vision library for animal behavior


Keywords
animal, behavior, computer-vision, data-science, ffmpeg, opencv, python, science
License
BSD-1-Clause
Install
pip install birdwatcher==0.4.0

Documentation

Birdwatcher

Github CI Status PyPi version Docs Status Project Status: Active – The project has reached a stable, usable state and is being actively developed. Codecov status

docs/images/banner.gif

Birdwatcher is a Python computer vision library for analyzing animal behavior in a Python scientific computing environment.

Birdwatcher should help you getting up and running quickly when building analysis code or tools for specific measurements. It provides functionality that is common in video analysis, such as reading and writing videos into and from numpy arrays, applying processing algorithms such as background subtraction, morphological transformation, resizing, drawing on frames etc. Much of the underlying video and image processing is based on FFmpeg and OpenCV, but Birdwatcher is easier to use for many tasks because its higher-level implementation of functionality.

In addition to video analysis tools, Birdwatcher has high-level functions for behavioral analysis based on such tools, although currently these are limited to movement/location detection of single animals.

Despite its name, Birdwatcher is not only for birds. We also successfully analyzed dog behavior, and it could be used on anything that moves. It is being used in our lab but still under heavy development, and should be considered alpha software.

Code can be found on GitHub: https://github.com/gbeckers/Birdwatcher .

Documentation can be found at https://birdwatcher.readthedocs.io .

It is developed by Gabriel Beckers and Carien Mol, at Experimental Psychology, Utrecht University. It is open source, freely available under the New BSD License terms.

Installation Birdwatcher package

Birdwatcher officially supports Python 3.9 or higher, but older Python 3 versions may also work.

User installation

  1. We recommend using Anaconda for installation. Install Anaconda from https://www.anaconda.com/ .

  2. Open Anaconda prompt in terminal.

  3. Create new environment for Birdwatcher (name is up to you, in example here 'mybirdwatcher'). We install Jupyter lab and ffmpeg at the same time:

    $ conda create -n mybirdwatcher python=3.9 jupyterlab ffmpeg git
  4. Switch to this new environment:

    Linux and MacOS:

    $ source activate mybirdwatcher

    Windows:

    $ conda activate mybirdwatcher
  5. Install Birdwatcher:

    Stable latest official release from PyPi:

    $ pip install Birdwatcher

    If instead you want the latest version of the git master branch from, use:

    $ pip install git+https://github.com/gbeckers/birdwatcher@master

Dependencies

The following dependencies are automatically taken care of when you install Birdwatcher using the pip method above:

  • numpy
  • pandas
  • matplotlib
  • seaborn
  • darr
  • opencv-python
  • opencv-contrib-python

It further depends on:

  • ffmpeg (including ffprobe)

If you do not use the conda way above to install ffmpeg, you need to install it yourself (https://www.ffmpeg.org/).

Run notebooks tutorial

To quickly learn the fundamentals of Birdwatcher, please walk through our notebooks. First, you need to download the notebooks and example videos from github. Then, navigate to the directory of the notebooks and activate the 'mybirdwatcher' environment. Type jupyter lab which opens in your browser. You can now open the notebooks and run the tutorial.

Test

To run the test suite:

>>>import birdwatcher as bw
>>>bw.test()
..................................................
----------------------------------------------------------------------
Ran 50 tests in 75.858s

OK

<unittest.runner.TextTestResult run=50 errors=0 failures=0>

Documentation

https://birdwatcher.readthedocs.io

Examples

See jupyter notebook directory.

Contributions

Sita ter Haar and Dylan Minekus helped exploring the application of movement detection algorithms.