Skip to main content

An annotation and instance segmentation-based multiple animal tracking and behavior analysis package.

Project description

Annolid

Annolid Build Annolid Release DOI Downloads Arxiv

Annotate, segment, track, and analyze animals or other research targets in video with one reproducible toolchain.

Table of Contents

Overview

Annolid is a deep learning toolkit for behavior analysis and video annotation. It brings annotation, instance segmentation, tracking, keypoint workflows, behavior scoring, and downstream analysis into one GUI and CLI environment.

The common path is practical and iterative: label a representative frame, propagate or track instances, review difficult frames, repair identities, and export annotations or metrics for analysis. Annolid is designed for real lab data, including overlap, occlusion, variable lighting, long videos, and projects where saved annotations need to remain readable and reproducible.

Python support: Annolid runs on Python 3.10–3.14 for the default GUI/core workflow. The optional remote network video path uses ffpyplayer; install annolid[remote_video] only when you need that feature, especially on Python 3.14 where native FFmpeg development libraries may be required.

What Annolid Is For

  • Markerless multi-animal tracking from a small number of labeled frames.
  • LabelMe-compatible image and video annotation with polygons, keypoints, zones, and behavior events.
  • Foundation-model assisted segmentation and tracking workflows, including Cutie, SAM-family workflows, Grounding DINO, CoTracker-style point tracking, TAPNext ONNX, EfficientTAM, and CowTracker where installed.
  • Behavior scoring, timeline flags, zone analysis, time-budget summaries, and classifier workflows.
  • GUI-first review and correction, plus annolid-run CLI commands for reproducible model training, prediction, evaluation, and automation.
  • Optional Annolid Bot workflows for multimodal assistance, model/plugin execution, MCP tools, and lab automation integrations.
  • Large TIFF and atlas-overlay work with optional tiled backends for OME-TIFF, BigTIFF, SVG, and Illustrator/PDF-compatible overlays.

Annolid keeps heavier runtime features behind extras so a standard GUI install stays usable on common lab machines. See Installation for the maintained extras and installer profiles.

Documentation & Support

Featured Use Case

  • Tracking Four Interacting Mice with One Labeled Frame | 10-Minute Experiment See how Annolid bootstraps multi-animal tracking from a single labeled frame in a fast end-to-end workflow: https://youtu.be/PNbPA649r78
  • For more practical examples and walkthroughs, visit the Annolid YouTube channel.

Quick Start

The fastest maintained path is the one-line installer:

macOS / Linux:

curl -sSL https://raw.githubusercontent.com/healthonrails/annolid/main/install.sh | bash

Windows PowerShell:

irm https://raw.githubusercontent.com/healthonrails/annolid/main/install.ps1 | iex

After installation:

annolid --help
annolid-run --help
annolid

If you prefer Anaconda:

conda create -n annolid-env python=3.11
conda activate annolid-env
conda install git ffmpeg
git clone --recurse-submodules https://github.com/healthonrails/annolid.git
cd annolid
pip install -e ".[gui]"
annolid  # launches the GUI

For source development, use a repository-local .venv:

git clone --recurse-submodules https://github.com/healthonrails/annolid.git
cd annolid
uv venv .venv --python 3.11
source .venv/bin/activate
uv pip install -e ".[gui]"
annolid

Installation

One-Line Installation (Recommended)

Get Annolid running in minutes with the automated installer. It clones the repository, creates an isolated environment, bootstraps uv when needed, installs GUI dependencies, and validates the ONNX Runtime provider setup.

macOS / Linux:

curl -sSL https://raw.githubusercontent.com/healthonrails/annolid/main/install.sh | bash

Windows PowerShell:

irm https://raw.githubusercontent.com/healthonrails/annolid/main/install.ps1 | iex

The script will:

  • Clone the repository.
  • Detect your OS and hardware.
  • Create an isolated virtual environment.
  • Install and validate ONNX Runtime CPU/GPU providers.
  • Prompt for optional features such as SAM3 and text-to-speech when requested.
  • Offer to launch Annolid immediately.

For a full breakdown of one-line installer choices, including GPU vs CPU, interactive vs non-interactive, custom paths, Conda, and extras, see One-Line Installer Choices.

Common maintained workstation profile:

curl -sSL https://raw.githubusercontent.com/healthonrails/annolid/main/install.sh | bash -s -- --profile workstation

Other Installation Methods

For advanced users, Docker, Conda, or manual Pip installation, please see the Detailed Installation Guide.

Using Annolid

  • Launch the GUI:
    conda activate annolid-env
    annolid
    
  • Provide custom labels:
    annolid --labels=/path/to/labels_custom.txt
    
  • Draw shapes on a seed frame, often frame 0, and use stable instance names when cross-frame identity matters.
  • Mark zones directly in the label popup with Zone type, or use Video Tools → Zones for bulk zone management, presets, and zone JSON save/load.
  • Use View → Show Zones On All Frames to control whether saved zone overlays are displayed across the full timeline.
  • Open Video Tools → Zone Analysis to export legacy place-preference CSVs, generic zone metrics, or profile-aware assay summaries. See Zone Analysis and Zone Analysis Workflow.
  • For behavior scoring with shared behavior names across Flags, Timeline, and Annolid Bot, see Behavior labeling with Timeline, Flags, and Annolid Bot.
  • Use annolid-run list-models, annolid-run help train, and annolid-run help predict for CLI model workflows.
  • Open AI & Models → Annolid Bot… when you need multimodal chat, typed model/plugin execution, MCP integrations, or optional lab-automation channels. See Agent and Automation, MCP, and Annolid Agent and annolid-run.
  • Summarize annotated behavior events into a time-budget report (GUI: File → Behavior Time Budget; CLI example with 60 s bins and a project schema):
    python -m annolid.behavior.time_budget exported_events.csv \
        --schema project.annolid.json \
        --bin-size 60 \
        -o time_budget.csv
    
  • Compute aggression-bout counts (for example slap_in_face, run_away, and fight_initiation) and export a _bouts.csv sidecar:
    python -m annolid.behavior.time_budget exported_events.csv \
        --bout-profile aggression \
        --bout-gap-seconds 2 \
        -o time_budget.csv
    
  • Compress videos when storage is limited:
    ffmpeg -i input.mp4 -vcodec libx264 output_compressed.mp4
    

Core Workflows

Annotation Guide

Annolid UI based on LabelMe

  • Label polygons and keypoints clearly. Give each animal a unique instance name when tracking across frames (for example, vole_1, mouse_2). Use descriptive behavior names (rearing, grooming) for polygons dedicated to behavioral events, and name body-part keypoints (nose, tail_base) consistently.
  • Tune instance colors for review. In the GUI, right-click a label in Labels or a shape row in Label Instances, then choose Change color. Annolid applies the color to every visible instance with that label and remembers the preference in app settings without changing LabelMe JSON files. Use Reset color to return to the automatic palette or project-schema color.
  • Accelerate timestamp annotation. While scoring behaviors, press s to mark the start, e to mark the end, f/b to step ±10 frames, and r to remove events directly from the video slider.
  • Enable frame-level flags. Launch Annolid with --flags "digging,rearing,grooming" to open a multi-select list of behaviors. Save selections with Ctrl+S or the Save button; remove events by pressing R.
  • Customize configuration. The first run creates ~/.labelmerc (or C:\Users\<username>\.labelmerc on Windows). Edit this file to change defaults such as auto_save: true, or supply an alternative path via annolid --config /path/to/file.
  • Control video-frame storage. Video annotations keep the frame in the sidecar PNG and do not duplicate the full frame inside every JSON by default. Set store_video_frame_data: true only when self-contained video-frame JSON files are required.
  • Learn more. Additional annotation tips live in annolid/annotation/labelme.md.

Labeling Best Practices

  • Label 20–100 frames per video to reach strong performance; the curve in docs/imgs/AP_across_labeled_frames.png shows how accuracy scales with annotation volume.
  • Close the loop with human-in-the-loop training (see docs/imgs/human_in_the_loop.png): train on initial annotations, auto-label, correct, and retrain until predictions align with human expectations.
  • Draft labeling guidelines up front—start with this template and adapt it to your species and behaviors.
  • Treat each animal instance as its own class when you need cross-frame identity. Use generic class names only when identity consistency is unnecessary, or when you are aggregating across many individuals.
  • To generalize to new animals or videos, include diverse examples of each behavior and adjust the training set iteratively.

Tutorials & Examples

Effortlessly Create Polygon Labels for Objects using Segment Anything Models

Annolid Youtube playlist

YouTube Channel Annolid documentations

Multiple Animal Tracking

Instance segmentations Behavior prediction

Mouse behavior analysis with instance segmentation based deep learning networks

Troubleshooting

  • Video playback errors (OpenCV: FFMPEG: tag ... or missing codecs): Install FFmpeg via your package manager or conda install -c conda-forge ffmpeg to extend codec support.
  • macOS Qt warning (Class QCocoaPageLayoutDelegate is implemented in both ...): conda install qtpy resolves the conflict between OpenCV and PyQt.
  • If the GUI does not launch, confirm the correct environment is active and run annolid --help for CLI usage.
  • If you see qtpy.QtBindingsNotFoundError, install GUI dependencies in the active environment: pip install -e ".[gui]" (source) or pip install "annolid[gui]" (PyPI).
  • For model training/inference from the terminal, use annolid-run list-models, annolid-run help train, annolid-run help predict, annolid-run help train <model>, and annolid-run help predict <model>. Older --help-model forms still work.
  • Built-in model plugins now show curated quick-reference groups such as Required inputs, Model and runtime, and Training controls before the full flag list.
  • Shared YAML run-configs are supported for multiple training plugins (for example dino_kpseg, maskrcnn_detectron2, yolo, behavior_classifier): annolid-run train <model> --run-config annolid/configs/runs/<template>.yaml (CLI flags still override YAML fields).
  • YOLOE-26 prompting (text, visual, prompt-free) is available via annolid-run predict yolo_labelme and in the GUI video inference workflow (see https://annolid.com/portal/workflows/).
  • For an interactive TensorBoard embedding projector view of DinoKPSEG DINOv3 patch features, run annolid-run dino-kpseg-embeddings --data /path/to/data.yaml [--weights /path/to/best.pt] and then tensorboard --logdir <run_dir>/tensorboard (some DINOv3 checkpoints require a Hugging Face token).

Docker

Ensure Docker is installed, then run:

cd annolid/docker
docker build .
xhost +local:docker  # Linux only; allows GUI forwarding
docker run -it -v /tmp/.X11-unix:/tmp/.X11-unix/ -e DISPLAY=$DISPLAY <IMAGE_ID>

Replace <IMAGE_ID> with the identifier printed by docker build.

Citing Annolid

If you use Annolid in your research, please cite:

@misc{yang2024annolid,
      title={Annolid: Annotate, Segment, and Track Anything You Need},
      author={Chen Yang and Thomas A. Cleland},
      year={2024},
      eprint={2403.18690},
      archivePrefix={arXiv},
      primaryClass={cs.CV}
}

@article{yang2023automated,
  title={Automated Behavioral Analysis Using Instance Segmentation},
  author={Yang, Chen and Forest, Jeremy and Einhorn, Matthew and Cleland, Thomas A},
  journal={arXiv preprint arXiv:2312.07723},
  year={2023}
}

@misc{yang2020annolid,
  author = {Chen Yang and Jeremy Forest and Matthew Einhorn and Thomas Cleland},
  title = {Annolid: an instance segmentation-based multiple animal tracking and behavior analysis package},
  howpublished = {\url{https://github.com/healthonrails/annolid}},
  year = {2020}
}

Publications

Additional Resources

Acknowledgements

Annolid's tracking module integrates Cutie for enhanced video object segmentation. If you use this feature, please cite Putting the Object Back into Video Object Segmentation (Cheng et al., 2023) and the Cutie repository.

The counting tool integrates CountGD; cite the original CountGD publication and repository when you rely on this module in your research.

Contributing

Contributions are welcome! Review the guidelines in CONTRIBUTING.md, open an issue to discuss major changes, and run relevant tests before submitting a pull request.

License

Annolid is distributed under the Creative Commons Attribution-NonCommercial 4.0 International License.

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

annolid-1.6.9.tar.gz (8.5 MB view details)

Uploaded Source

Built Distribution

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

annolid-1.6.9-py3-none-any.whl (8.9 MB view details)

Uploaded Python 3

File details

Details for the file annolid-1.6.9.tar.gz.

File metadata

  • Download URL: annolid-1.6.9.tar.gz
  • Upload date:
  • Size: 8.5 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for annolid-1.6.9.tar.gz
Algorithm Hash digest
SHA256 26cce87fa62bfa9f072afa4d55af53ba076921aafeb53da3f8cbb23e3c9a085f
MD5 152672f49ef26ada1615de9a8d22fadf
BLAKE2b-256 778e1d982ba1ada2d864eb0f9602c09944a3b9a40a2ed546c910cb9637a09be0

See more details on using hashes here.

File details

Details for the file annolid-1.6.9-py3-none-any.whl.

File metadata

  • Download URL: annolid-1.6.9-py3-none-any.whl
  • Upload date:
  • Size: 8.9 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for annolid-1.6.9-py3-none-any.whl
Algorithm Hash digest
SHA256 1ced6b6462537ce4ef4d119b713f57e1e65bb0b2b8c32e65034c58f67a0df16b
MD5 428f0e17318fd2805d63c374f27a6457
BLAKE2b-256 7ed74edbe6917f8bc6175878b55b114f23833f1ae62839502803eecf34852aa6

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