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 Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

trace_tad-0.2.2-py3-none-any.whl (955.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: trace_tad-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 955.5 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 11674ab849735ad3c9a2f7d77bd1952480d044110afd455ac0963b19e128514f
MD5 937afdc99ff2cbf056aa8b9155394f6c
BLAKE2b-256 55e159deaa0d6602110f798bbfb926e39ac233369e3168ebbf2dc010f4bfd579

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