Supervised and Unsupervised Behavioral Analysis

The open‑source toolkit for

pypi CodeFactor Funding

What is DeepOF?

DeepOF is a python library for analyzing mouse tracking data. Reproducible behavior patterns are extracted and visualized from Deep Lab Cut and Social LEAP inputs.

  • Open-source and extensible
  • CLI + Python API + Notebook-friendly
  • 15 different supervised behaviors
  • Support for adding custom behaviors
  • Expansive unsupervised pipeline
Loading…
Multi-mouse rectangular arena

Any arena, any cohort

DeepOF works with any arena shape and any number of mice, as long as you can keep track of all of them. Behaviors are detected based on user‑defined regions of interest—between pairs of mice or for individuals— and then aggregated accordingly.

Example setup

A large rectangular arena with two mice interacting with each other

Features you might love

Fast processing speeds

Define a project, detect behaviors, and plot results within minutes.

Composable workflows

Chain analysis steps, plots and more as executable blocks in notebook environments.

Pythonic API

Clean, typed APIs with informative errors; best used in notebooks.

Memory optimized

Analyze multi-day recordings, evaluate them by hours, minutes or seconds.

Raw In, Structured Out

Preprocess your data, detect behavior, and extract it in clearly structured tables.

Numerous visualization options

Compare behaviors between groups, over time, in relation to each other, and more.

Loading…
Supervised behavior example

Supervised analysis

DeepOF offers pipelines for the detection and annotation of 15 different supervised behaviors. Measure general activity, explorative behavior or social interaction.

Included behaviors (selection)
Stationary-active
Stationary-passive
Moving
Stationary-lookaround
climb-arena
nose2nose
nose2tail
sidebyside
following
More supervised behaviors
sniff-arena
sniffing
nose2body
immobility
sidereside
missing

Show examples

Unsupervised analysis

DeepOF offers three different unsupervised models to detect behavior-like patterns and an extensive array of functions to analyze detection results.
And yes, it may not appear that way, but the results to the right were actually achieved with 100% unsupervised models.

Vade Vade
VADE
Best for individual mouse behavior patterns
Vqvae Vqvae
VQVAE
Best for complex behavior subdivision
Contrastive Contrastive
Contrastive
best for interactive behavior between mice

Show examples

Single-mouse VADE embedding space
Loading…
Single-mouse VADE embedding space
Loading…
Annotated behavior video

Validation and Verification

DeepOF does not only tell you when, where and for how long a behavior occurs, it also allows you to export videos with extensive behavior annotations.

Annotated video exports
Overlay labels, markers, timestamps.
Structured outputs
Clean tables for analysis.
Visual summaries
Gantt plots, spider plots, more.
MP4 overlays Pandas tables Pdf export

Show more examples

Quickstart

Install with pip, conda, or clone, then launch the CLI or import the API.

python -m venv ${HOME}/Path/to/directory/virtual_environment_name
.\virtual_environment_name\Scripts\activate
pip install deepof
conda create -n deepof python=3.10
conda activate deepof
pip install deepof
git clone https://github.com/mlfpm/deepof.git deepof
cd deepof
poetry install
python -m venv ~/Path/to/directory/virtual_environment_name
source ~/Path/to/directory/virtual_environment_name/bin/activate
pip install deepof
conda create -n deepof python=3.10
conda activate deepof
pip install deepof
git clone https://github.com/mlfpm/deepof.git deepof
cd deepof
poetry install
python -m venv ~/Path/to/directory/virtual_environment_name
source ~/Path/to/directory/virtual_environment_name/bin/activate
pip install deepof
conda create -n deepof python=3.10
conda activate deepof
pip install deepof
git clone https://github.com/mlfpm/deepof.git deepof
cd deepof
poetry install

How to set up DeepOF and start behavioral analysis.

Research papers featuring DeepOF:

Review papers featuring DeepOF:

Other works related to DeepOF:

Cite DeepOF

If DeepOF helps your research, please cite:

@article{Miranda2023deepof,
  title = {DeepOF: a Python package for supervised and unsupervised pattern recognition in mice motion tracking data},
  author = {Lucas Miranda, Joeri Bordes, Benno PĂĽtz,  Mathias V Schmidt, Bertram MĂĽller-Myhsok},
  journal = {The Journal of Open Source Software},
  year = {2023},
  url = {https://joss.theoj.org/papers/10.21105/joss.05394}
}