Skip to main content

Khoroos: poultry behavior analysis

Tests PyPI version PyPI publishing workflow Python 3.12 and newer PolyForm Noncommercial License 1.0.0

Khoroos turns poultry videos into bird tracks, behavior timelines, and descriptive statistics. Use it to measure how observed birds spend their time, compare activity across a recording, and export data for further analysis.

Developed at the UT Smart Agriculture Lab.

Features

  • Detection and tracking: locate chickens and follow their trajectories across frames.
  • Behavior recognition: classify single-bird clips into 15 behaviors, or select a subset such as feeding and drinking.
  • Descriptive statistics: time budgets, behavior bouts, detection counts, activity heat maps, and per-track measurements.
  • Interactive review: inspect tracks, routes, heat maps and behavior timelines over the video in a browser.
  • Exports: save JSON, CSV tables, and an optional annotated video.
  • Replaceable components: bring your own detector, classifier, tracker, or statistics functions. Convert bounding-box annotations between YOLO and COCO formats.

Get started

Requires Python 3.12+ and FFmpeg. A GPU is recommended for inference.

python3 -m venv .venv
source .venv/bin/activate
python -m pip install "khoroos[web]"
khoroos models download
khoroos ui

The default models are public; no Hugging Face login is required. Downloads are cached for later runs, including offline use. Other action models and lighter weight formats (FP16, INT8 and 4-bit ONNX) can be selected with --action-model and --action-format, and other detectors with --detector-model and --detector-format; see action models and formats and detectors and formats. Besides its own SORT tracker, Khoroos can link detections with ByteTrack, OC-SORT, BoT-SORT, C-BIoU or McByte (--tracker); see trackers.

Open http://127.0.0.1:8000, select a video, choose a detail level, and start the analysis. Use the timeline to seek through the recording, select a track to follow one bird, and download the results when the run finishes.

Docker

With Docker and the NVIDIA Container Toolkit installed:

git clone https://github.com/amirivojdan/khoroos.git
cd khoroos
docker compose up --build

Open http://localhost:8000. Startup downloads the models automatically and reuses them on later starts. Model files and results persist in a volume; the web job list resets on restart. See the Docker guide for requirements and storage details.

Command line

Start with a short section of video:

khoroos analyze farm.mp4 -o results/ --max-seconds 60

Analyze a full recording and save an annotated video:

khoroos analyze farm.mp4 -o results/ --overlay

Analyze every video in a folder, loading the models once:

khoroos analyze recordings/ -o results/

Report selected behaviors:

khoroos analyze farm.mp4 -o results/ --set action_classes=feeding,drinking

Choose --preset fast, balanced (default), or thorough to adjust sampling detail. With more than one GPU, --device all splits each analysis across them; batch sizes stay totals across the devices. If GPU memory runs out, reduce --action-batch-size first. See the CLI guide for all options.

Python

Analyze a video directly:

from khoroos import analyze_video

result = analyze_video("farm.mp4", preset="balanced")
print(result.metrics["time_budget"])

Reuse the models across recordings and save each export bundle:

from pathlib import Path
from khoroos import AnalysisRunner

runner = AnalysisRunner()
for video in Path("videos").glob("*.mp4"):
    runner.run(video, output_dir=Path("results") / video.stem)

See the Python guide for parameters and progress callbacks.

Results

Each exported analysis includes:

File Contents
result.json Tracks, predictions, run parameters, and metadata
metrics.json Behavior budgets, bouts, detection counts, and timelines
predictions.csv One row per classified clip
time_budget.csv Duration and proportion per behavior
per_bird.csv Statistics per track
heatmap.png, heatmaps.npz Where birds spent their time, as a picture and as arrays per behaviour
annotated.mp4 Video with boxes and labels, when --overlay is enabled

Statistics describe model-assigned labels. Uncertain predictions are reported separately, and track IDs represent trajectories rather than verified animal identities. See Outputs for field definitions and duration calculations.

Extend Khoroos

Subclass Detector, VideoClassifier, or Tracker to use your own algorithms. VideoAnalyzer accepts custom models, and PipelineComponents configures the reader, tracker, cropper, and metrics. Class labels and behavior groups are configurable.

Follow the extension guide for working examples, or the configuration guide for devices, model sources, and cache paths.

Development

From a source checkout:

uv sync --locked --extra web --extra dev --extra docs
uv run pytest
uv run ruff check src tests
uv run mkdocs serve

Tests use stub models and generated videos; no model download is needed.

Resources and licenses

Metadata

Release files for khoroos 0.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for khoroos 0.5.0
File Size Uploaded Provenance Actions
khoroos-0.5.0.tar.gz 685.9 kB With provenance Details for khoroos-0.5.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for khoroos 0.5.0
File Interpreter ABI Platform Actions
khoroos-0.5.0-py3-none-any.whl Python 3 none any Details for khoroos-0.5.0-py3-none-any.whl

Total release size: 1.4 MB

Release files / khoroos-0.5.0.tar.gz

Download URL khoroos-0.5.0.tar.gz
Size 685.9 kB
Tags Source
SHA-256 checksum
How to use checksums
0a07e04a600dfa3df7853231cd7f0a399abc9054db472621696a4283de73d998
BLAKE2b-256 checksum
How to use checksums
efb6f9c7d06e828fd5c75521351cbc77b749ab47994b3be45ae720655450e62a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.

Transparency log

Release files / khoroos-0.5.0-py3-none-any.whl

Download URL khoroos-0.5.0-py3-none-any.whl
Size 710.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
53473f5e2b48e4145f417a0c45221fe24962e647cc8302494256b04c3575ca0e
BLAKE2b-256 checksum
How to use checksums
868941e8cb53b99abac62f09e1d2623d2ac22c16e16dc3e29acf7e4275e733ec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.

Transparency log

Security for khoroos 0.5.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for khoroos-0.5.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page