Home

Awesome

annolid

Annolid Build Annolid Release DOI Downloads Arxiv

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

Annolid: Annotate, Segment, and Track Anything You Need

Annolid is a deep learning-based software package designed for the segmentation, labeling, and tracking of research targets within video files, focusing primarily on animal behavior analysis. Based on state-of-the-art instance segmentation methods, Annolid now harnesses the Cutie video object segmentation model to achieve resilient, markerless tracking of multiple animals from single annotated frames, even in environments in which they may be partially or entirely concealed by environmental features or by one another. Our integration of Segment Anything and Grounding-DINO strategies additionally enables the automatic masking and segmentation of recognizable animals and objects by text command, removing the need for manual annotation. Annolid's comprehensive approach to object segmentation flexibly accommodates a broad spectrum of behavior analysis applications, enabling the classification of diverse behavioral states such as freezing, digging, pup huddling, and social interactions in addition to the tracking of animals and their body parts.

Effortless Multiple Instance Tracking using Annolid: Beginner's Tutorial

Effortless Multiple Instance Tracking using Annolid: Beginner's Tutorial

Effortless Object Labeling with Minimal Points: Automated Polygon Generation using Segment Anything Models

Effortlessly Create Polygon Labels for Objects using Segment Anything Models

Overview of Annolid workflow

Overview of Annolid workflow

Annolid video tutorials

Annolid Youtube playlist

YouTube ChannelAnnolid documentations

User Guide

A basic user guide with installation instructions and recent documentation can be found at https://cplab.science/annolid or https://annolid.com.

Examples

Multiple Animal Tracking

Instance segmentationsBehavior prediction

Mouse behavior analysis with instance segmentation based deep learning networks

Mouse behavior analysis with instance segmentation based deep learning networks

Local Installation

First you need to install anaconda.

create a conda env

conda create -n annolid-env python=3.11
conda activate annolid-env
conda install git
conda install ffmpeg 
git clone --recurse-submodules https://github.com/healthonrails/annolid.git
cd annolid

The pip install command will attempt to determine your computer's resources (like a GPU) automatically. To control this directly, you alternatively can use the conda env command and the appropriate environment file (.yml). For alternative installation methods, see the Annolid documentation (https://cplab.science/annolid or https://annolid.com).

Recommended steps for Ubuntu 20.04 machine with GPUs

conda env create -f environment.yml

This command will create a new Conda environment with the required packages and dependencies needed to run Annolid on an Ubuntu 20.04 machine with GPUs.

conda activate annolid-env 
annolid

Note: For error NVIDIA GeForce RTX 3090 with CUDA capability sm_86 is not compatible with the current PyTorch installation, please try the following command.

 conda install pytorch==2.2.0 torchvision==0.17.0 torchaudio==2.2.0 cudatoolkit=12.1 -c pytorch -c nvidia

That's it! You should now have Annolid installed on your Ubuntu 20.04 machine with GPUs and be able to use it for video analysis and annotation tasks.

Note for Mac M1/M2 Chip users

If you encounter the folloing errors,

Intel MKL FATAL ERROR: This system does not meet the minimum requirements for use of the Intel(R) Math Kernel Library.
The processor must support the Intel(R) Supplemental Streaming SIMD Extensions 3 (Intel(R) SSSE3) instructions.
The processor must support the Intel(R) Streaming SIMD Extensions 4.2 (Intel(R) SSE4.2) instructions.
The processor must support the Intel(R) Advanced Vector Extensions (Intel(R) AVX) instructions.
[end of output]

Please try the following commands.

conda create -n annolid-env python=3.11
conda activate annolid-env 
# Please skip this git clone step, if you have already done it in the previous step
git clone --recurse-submodules https://github.com/healthonrails/annolid.git
cd annolid
pip install -e .
annolid

Note: To train instance segmentation models, please install Detectron2 in your Annolid environment by following these steps:

Activate your Annolid environment (if not already activated):

conda activate annolid-env

Install Detectron2:

python -m pip install --user 'git+https://github.com/facebookresearch/detectron2.git'

Note: if you got this error: ERROR: Could not find a version that satisfies the requirement decord>=0.4.0 try to install ffmpeg or you can install it in conda with conda install -c conda-forge ffmpeg.

FYI: it is helpful to compress videos to reduce diskspace using ffmpeg using ffmpeg -i my_video.mp4 -vcodec libx264 my_video_compressed.mp4

Tip: to fix the error like objc[13977]: Class QCocoaPageLayoutDelegate is implemented in both /Users/xxx/anaconda3/envs/annolid-env/lib/python3.7/site-packages/cv2/.dylibs/QtGui (0x10ebd85c0) and /Users/xxx/anaconda3/envs/annolid-env/lib/python3.7/site-packages/PyQt5/Qt/lib/QtPrintSupport.framework/Versions/5/QtPrintSupport (0x10fc9d540, please try the command conda install qtpy.

Launch annolid user interface based on labelme

source activate annolid-env
annolid
#or you can provide a label.txt file as follows.
annolid --labels=/path/to/labels_custom.txt

Annolid UI based on labelme

If you want to learn more about labelme, please check the following link.

Read more about annotations

How to label animals and behaviors?

Polygons & keypoints(e.g. Vole_1, nose, tail_base, rearing…...)

annolid config file

The first time you run annolid, it will create a config file in the user's home directory ~/.labelmerc (C:\Users<username>.labelmerc on Windows). You can edit this file, and the changes will take effect the next time you launch annolid. To set the auto_save option to true, open the labelmerc file in a text editor and add the line auto_save: true. Save the changes, and labelme will automatically save your annotations when you make them. If you prefer to use a config file from a different location, you can specify the file path by using the --config flag followed by the path to your desired config file.

Instructions for labeling behaviors with timestamps using keys:

Efficient Timestamp Labeling and Editing of Behaviors: Streamlined Key Shortcuts and Video Slider Controls

To label behaviors, use the following key shortcuts:

To edit the predicted timestamps provided by Annolid:

Once you have finished labeling the behaviors, follow these steps:

To enable frame-level labels in Annolid using a multi-select component:

To save the selected frame-level labels in Annolid, you can follow either of these methods:

How many frames do you need to label?

Tracking and re-identification

Docker

Please make sure that Docker is installed on your system.

# on Linux
cd annolid/docker
docker build .
xhost +local:docker
docker run -it -v /tmp/.X11-unix:/tmp/.X11-unix/ -e DISPLAY=$DISPLAY  <Image ID>

Citing Annolid

If you use Annolid in your research, please use the following BibTeX entry.

@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, Jeremy Forest, Matthew Einhorn, Thomas Cleland},
  title =        {Annolid:  an instance segmentation-based multiple animal tracking and behavior analysis package},
  howpublished = {\url{https://github.com/healthonrails/annolid}},
  year =         {2020}
}

Other open-access pre-prints related to Annolid

@article{pranic2022rates,
  title={Rates but not acoustic features of ultrasonic vocalizations are related to non-vocal behaviors in mouse pups},
  author={Pranic, Nicole M and Kornbrek, Caroline and Yang, Chen and Cleland, Thomas A and Tschida, Katherine A},
  journal={bioRxiv},
  year={2022},
  publisher={Cold Spring Harbor Laboratory}
}

For more information: https://cplab.science/annolid .

SfN 2021 poster

Annolid: an instance segmentation-based multiple-animal tracking and behavior analysis package

SfN 2023 posters

Datasets

New An example dataset annotated by Annolid and converted to COCO format dataset is now available from this Google Drive link https://drive.google.com/file/d/1fUXCLnoJ5SwXg54mj0NBKGzidsV8ALVR/view?usp=sharing.

Pretrained models

The pretrained models will be shared to the Google Drive folder.

Feature requests and bug reports

To request a new feature or report bugs, please use the link https://github.com/healthonrails/annolid/issues here.

Annolid Google groups

annolid@googlegroups.com

Videos