Skip to main content

FERAL: Feature Extraction for Recognition of Animal Locomotion

Project description

Documentation Colab Website

FERAL

FERAL is an open-source toolkit for supervised animal behavior segmentation that leverages state-of-the-art video-understanding models.

  • No pose estimation
  • Install and start training in 3 commands
  • Scale a small set of manual labels to terabytes of video

Quickest Start (Google Colab)

The easiest way to run FERAL is directly in your browser through Google Colab, but you'll need a Colab Pro subscription to access good GPUs. Good news: Colab Pro is free for academics with an institutional email.

Open in Google Colab

Use with an A100 or L4 GPU.

Manual Installation

pip install feral

That's it. Now you should be able to run everything.

System Requirements

  • Preferably Linux. Windows should work too. We haven't tested on Mac.
  • Python 3.10+
  • PyTorch 2.5+ (with a compatible CUDA version)
  • NVIDIA GPU with Ampere architecture or newer (compute capability 8.0+) and 24+ GB VRAM. FERAL uses bfloat16 and flash attention, which require newer architectures.

If PyTorch 2.5 is awkward to get in your environment, 2.4 works for everything except the VideoPrism backbones (which need torch.nn.attention.flex_attention, added in 2.5). The V-JEPA backbones run fine on 2.4.

Older GPUs like V100 (Volta) and T4 (Turing) — including free Google Colab T4 instances — will not work. Supported GPUs include: A100, H100, A10, L4, L40, RTX 3000/4000/5000 series, and newer.

Windows Notes

  • triton-windows is installed automatically as a drop-in replacement for the official triton package, which has no Windows build.
  • PyTorch 2.8-2.9 has a known bug on Windows where torch.compile crashes with OverflowError: Python int too large to convert to C long (pytorch#162430). Use PyTorch 2.7 or 2.10+ to avoid this. See issue #11 for details.

We've used RunPod extensively to run experiments. It's very easy to set up.

Troubleshooting

  • V-JEPA 2.1 backbone download fails with URLError: [Errno 111] Connection refused. Upstream's facebookresearch/vjepa2 torch.hub repo currently ships a leftover test URL (VJEPA_BASE_URL = "http://localhost:8300"). Point it back at the public CDN in the cached copy:
    sed -i 's|http://localhost:8300|https://dl.fbaipublicfiles.com/vjepa2|' \
      ~/.cache/torch/hub/facebookresearch_vjepa2_main/src/hub/backbones.py
    
    This only affects the vjepa2_1_* (V-JEPA 2.1) backbones.

Running FERAL

1. Re-encode Videos

FERAL needs videos in a format that supports random frame access, so we recommend re-encoding your videos with the provided tool. It will install FFmpeg if it doesn't find it on your system.

feral reencode path/to/videos path/for/reencoded/videos

2. Start Training

feral train path/to/videos path/to/labels

This will prompt you about logging options — you can select what fits you. You'll be able to see per-epoch metrics either way. If you select W&B, you'll also get automatically generated ethograms, per-step loss, and system utilization info.

Results will be saved to answers/_inference_{run_name}_{timestamp}.json.

3. Training from a Config

If you don't want to run this in an interactive terminal, you can start training with:

feral train-config path/to/config

This requires a config in the same format as the packaged feral/default_config.yaml.

4. Inference

You can run inference through the train command by removing the train partition from your config. But you can also run inference standalone without a config:

feral infer path/to/checkpoint path/to/videos

Example Datasets

FERAL has been validated on multiple datasets:

  • CalMS21 - mouse social interactions
  • MaBE - multi-species benchmark (mice, beetles, ants, flies)
  • C. elegans - locomotor states (forward/reverse/turn/pause)
  • Ooceraea biroi - self vs. allogrooming and collective raids

Access details and converters are documented at getferal.ai.

Citation

Please contact us at jacopo.razza@gmail.com or peter.skovorodnikov@gmail.com for instructions on how to cite our work.

Authors

Peter Skovorodnikov (Rockefeller University) Jacopo Razzauti (Vosshall Lab, Rockefeller University; Price Family Center for the Social Brain)

Equal contribution Contact: jacopo.razza@gmail.com | peter.skovorodnikov@gmail.com


FERAL = Feature Extraction for Recognition of Animal Locomotion

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

feral-1.0.0.tar.gz (66.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

feral-1.0.0-py3-none-any.whl (51.2 kB view details)

Uploaded Python 3

File details

Details for the file feral-1.0.0.tar.gz.

File metadata

  • Download URL: feral-1.0.0.tar.gz
  • Upload date:
  • Size: 66.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.10

File hashes

Hashes for feral-1.0.0.tar.gz
Algorithm Hash digest
SHA256 ebeea9947182cb7e2fe9a020545b7b9487c7494b281b27a3f24e75af31015359
MD5 eb6bba062b261bad2902c959f33751ba
BLAKE2b-256 a0111f4165e0bc363e8e4ec40aeabf24c905ec4bdafd2c9981e1107474acc0f3

See more details on using hashes here.

File details

Details for the file feral-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: feral-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 51.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.10

File hashes

Hashes for feral-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f5d73676e81fc339c81a4b27eff4138abae5ad82fb868ccaa98e6343b8ee5934
MD5 3d90bf82e131136616f48f82e0ec17d4
BLAKE2b-256 30fade8de471351ddc3d54197c60f97721413ab1f6081e69f8bb67824cc2061f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page