Skip to main content

TRACE: Temporal action detection for animal behavior analysis

Project description

TRACE — Temporal Recognition of Animal Behaviors Captured from Video

TRACE is a temporal action detection system for animal behavior analysis in untrimmed video.

TRACE Annotator

Documentation

kunmings.github.io/TRACE

Install

Create a Python 3.9+ environment first. Choose one:

conda create -n trace-tad python=3.11 pip
conda activate trace-tad
mamba create -n trace-tad python=3.11 pip
mamba activate trace-tad
uv venv --python 3.11 --seed .venv
source .venv/bin/activate

Then install TRACE and download the model weights:

python -m pip install trace-tad
trace prepare --weights all

Training, evaluation, and prediction require a CUDA-capable PyTorch environment. The annotation app can still be used for labeling workflows without running model jobs locally.

Usage

Start with the UI for the normal workflow:

trace app

The UI can annotate videos, train models, run inference, and generate matching CLI commands for reproducible runs or batch jobs.

For command-line workflows, use the generated commands or write them directly:

# Check whether PyPI has a newer TRACE release
trace update

# Train from selected video/annotation pairs
trace train --model large --work-dir /my/dataset --pairs video01.mp4=video01_final.csv video02.mp4=video02.csv

# Evaluate the training artifact, or evaluate on held-out video/annotation pairs
trace eval --model-dir /my/dataset/model_YYYYMMDD_HHMMSS
trace eval --model-dir /my/dataset/model_YYYYMMDD_HHMMSS --work-dir /my/testset --pairs video03.mp4=video03.csv

# Predict on new videos and write annotation drafts
trace predict --model-dir /my/dataset/model_YYYYMMDD_HHMMSS --input /path/to/video.mp4 --annotated-video --threshold 0.25

# Run a configured end-to-end workflow
trace pipeline configs/small.py --export csv

--pairs is explicit: each item is VIDEO_PATH=CSV_PATH. A source video can have multiple annotation CSVs beside it, such as video01_draft.csv, video01_final.csv, or a model-generated video01_predictions.csv; each training or evaluation pair chooses the annotation file to use for that video. Relative paths are resolved against --work-dir, so video01.mp4=video01_final.csv means both files are inside the work directory. Training creates a self-contained model_YYYYMMDD_HHMMSS/ folder under --work-dir.

TRACE annotation CSVs are time-based:

labelId,timestamp,endTimestamp
grooming,12.430,18.970
rearing,42.100,45.650

Prediction creates a predict_YYYYMMDD_HHMMSS/ folder beside the selected input video or input video directory, unless --output is provided. The CSV output uses the annotation format, so a reviewer can treat model predictions as draft annotation files. Use --annotated-video to render MP4 overlays with the same confidence threshold as the JSON/CSV outputs.

Development

# Start backend and Vite dev servers
trace dev serve

# Build the frontend and bundle it into the Python package
trace dev build-frontend

The committed public website in site/ is intentionally small and publishable; deeper engineering notes stay under docs/.

License

Apache 2.0. See 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

trace_tad-0.2.1.tar.gz (917.7 kB view details)

Uploaded Source

Built Distribution

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

trace_tad-0.2.1-py3-none-any.whl (948.3 kB view details)

Uploaded Python 3

File details

Details for the file trace_tad-0.2.1.tar.gz.

File metadata

  • Download URL: trace_tad-0.2.1.tar.gz
  • Upload date:
  • Size: 917.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for trace_tad-0.2.1.tar.gz
Algorithm Hash digest
SHA256 40b4bb7f5dd31b95f7a041819aadf27fed54b24d63998512d82c4bedc204fc9a
MD5 e5bedffb9661365a411cd8315937093b
BLAKE2b-256 89d42cb0ebf0dd313bd8998585e3175c8d5fa8b4fb52d0eeb24633b4483ae27c

See more details on using hashes here.

File details

Details for the file trace_tad-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: trace_tad-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 948.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for trace_tad-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 bcaaeb58a1aceeda1b18424d7d4283edbc327274ec41199e86c0d5b0aaccc8c1
MD5 12f7d3f5d6dec900f8ec385ed4b45836
BLAKE2b-256 fe86e66af3db552c2e94f3460ccb7112e4e7c466242c798ac2f32ebe551d6f5a

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