Skip to main content

A YOLO-based tool for ROI cropping and movement tracking of Mus musculus.

Project description

Mus Musculus Tracker 🐁

PyPI version License: MIT Python 3.13+

A custom YOLO-based tool for automated mouse (Mus musculus) detection, movement tracking, and manual keypoint labeling.

Tracking

📋 Features

  • Automated Detection: Robust mouse tracking powered by YOLO (v12).
  • Video Cropping and Compression: Automatically crops video borders to focus on the arena/cage and compresses them to 640x640 MP4.
  • Trajectory Tracking: Extracts movement coordinates and trajectory data.
  • Keypoints Labeling: Interactive script to label points p0..p9 on the first frame.
  • CLI: Command-line interface.

🚀 Installation

Via Pip (Recommended)

pip install mus-musculus-tracker

Via Conda (Development)

gh repo clone juancolonna/mouse-tracker
cd mouse-tracker
conda env create -f environment.yml
conda activate mouse-tracker
pip install -e .

🛠 Usage

1) Mouse tracking (mouse-track)

mouse-track path/to/video.mp4

2) Keypoints labeling (keypoints-labeler)

The keypoints_labeler.py script reads a CSV list of videos, opens the first frame of each video, and requests manual selection of the 10 keypoints (p0 to p9).

keypoints-labeler path/to/video_list.csv path/to/output_keypoints.csv

Expected video_list.csv format:

  • No header.
  • One video path per line.
  • Only one column is used.

Example video_list.csv:

/data/exp01/video_001.mp4
/data/exp01/video_002.mp4

Output (output_keypoints.csv):

  • path_and_file column with the original video path.
  • p0_x,p0_y,...,p9_x,p9_y columns.

Labeling behavior:

  • Left-click to select the current point.
  • Any key (e.g. ESC) other than q/Q moves to the next point.
  • If you advance without clicking (e.g. press ESC twice without a mouse click), the current video is skipped.
  • q or Q aborts the batch process.

Point order:

  • p0 is the center.
  • Points p0 -> p1 -> p2 go from the center toward the lid.
  • p3..p9 follow a counter-clockwise order according to the figure.

Keypoints reference

📑 Requirements

  • Python >= 3.13
  • ultralytics
  • opencv-python
  • moviepy
  • tqdm
  • numpy

✍️ Authors

Juan G. Colonna juancolonna@icomp.ufam.edu.br
Instituto de Computação
Universidade Federal do Amazonas

📄 License

This project is licensed under the MIT License. See LICENSE for details.

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

mus_musculus_tracker-0.1.5.tar.gz (4.9 MB view details)

Uploaded Source

Built Distribution

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

mus_musculus_tracker-0.1.5-py3-none-any.whl (4.9 MB view details)

Uploaded Python 3

File details

Details for the file mus_musculus_tracker-0.1.5.tar.gz.

File metadata

  • Download URL: mus_musculus_tracker-0.1.5.tar.gz
  • Upload date:
  • Size: 4.9 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.13

File hashes

Hashes for mus_musculus_tracker-0.1.5.tar.gz
Algorithm Hash digest
SHA256 c929c507b3e6baaa017da10bd07406d0e91e79829056fc1ff156103fb2a21992
MD5 66b1e71afaab3ab40631e45f30ce1cc5
BLAKE2b-256 5062b46f93578ce1ec2f419f9d5e3495eb6063f63359dbd0ddbc483bad5ed4df

See more details on using hashes here.

File details

Details for the file mus_musculus_tracker-0.1.5-py3-none-any.whl.

File metadata

File hashes

Hashes for mus_musculus_tracker-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 028445e5db1b201ec9f6b90bb439aff77b0164e8b4d46027fc2421a9092fd952
MD5 08bdcbb2f312914811684cccc04c7d79
BLAKE2b-256 07480510a700647b914bccd6538ff43daffb0e491a8bd11249d3f29bad7103b6

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