Skip to main content

Telekinesis trackers

Deployment visual trackers backed by ONNX Runtime.

Runtime Task Bundle graphs
CutieTracker Multi-object mask propagation image, mask, read, decode
Sam3Tracker Multi-object mask propagation seed, step
TapirTracker Point tracking offline or seed + step
McByteTracker Detection association with masks SAM encoder/decoder + CUTIE

Contributor setup, model exporting, S3 publishing, and tests are documented in DEVELOPMENT.md.

Install

Python 3.11 or newer is required. Choose one runtime extra (the base package includes NumPy, Pillow, and requests):

pip install ".[cpu]"

# NVIDIA GPU: CUDA 12 runtime libraries, cuDNN 9, and CuPy
pip install ".[gpu]"

# Optional OpenCV examples
pip install ".[cpu,examples]"

# McByte association and detection data dependencies
pip install ".[cpu,mcbyte]"

PyTorch, Transformers, CUTIE, and TAPIR are not runtime dependencies.

Use a fresh environment when switching runtimes, or uninstall both onnxruntime and onnxruntime-gpu before installing the chosen extra. They provide the same Python module and must not be installed together. The GPU extra needs a CUDA 12-compatible NVIDIA driver; it installs the user-space CUDA libraries. Its ONNX Runtime upper bound keeps it on CUDA 12. See the ORT requirements and CuPy installation guide.

Automatic model loading

CUTIE and RITM download their pretrained bundles on first use:

from telekinesis.trackers import CutieTracker, MaskInitializer

cutie = CutieTracker()
ritm = MaskInitializer()

Models are fetched from https://assets.telekinesis.ai/trackers/, validated, and extracted under:

~/.cache/telekinesis/trackers/cutie/480x864-dynamic
~/.cache/telekinesis/trackers/ritm/480x864-20

The cached bundle is reused without another network request. The asset origin, cache location, progress display, and network settings are fixed. Pass model_dir only to use a local bundle instead.

CUTIE mask tracking

Frames are uint8 RGB arrays shaped (H,W,3). Seed labels are integer arrays shaped (H,W) where zero is background and values 1–255 are object IDs.

from telekinesis.trackers import CutieTracker

tracker = CutieTracker()
tracker.seed(seed_labels, first_rgb)
labels, alive_fraction = tracker.execute(next_rgb)

Use CutieTracker(device="cuda") (or "cuda:N") to select a GPU explicitly, and device="cpu" to force CPU execution. The default "auto" selects CUDA when ONNX Runtime advertises it, otherwise CPU. A selected CUDA backend that cannot initialize raises an error; it does not silently run the tracker on CPU. tracker.device reports the selected device.

On CUDA, graph features and recurrent state stay on the GPU through I/O binding; CuPy performs memory attention and output resizing there. Input validation and frame preprocessing remain on CPU; returned labels are NumPy arrays. Existing float32 bundles work without re-exporting. Unsupported graph operators may still use ONNX Runtime's CPU provider.

The pretrained graph has 480x864 padded dimensions and a dynamic object axis. Frames can be reduced with max_internal_size; objects are selected from the IDs present in the seed mask. Use correct(image_rgb, labels) to replace the current mask and memory state, and reset_session() to clear the tracker.

RITM mask initialization

MaskInitializer creates one object's mask from positive and negative (x, y) clicks:

from telekinesis.trackers import MaskInitializer

initializer = MaskInitializer()
probability = initializer.predict_proba(
    image_rgb,
    positive_points=[[320, 200]],
)
mask = initializer.predict(
    image_rgb,
    positive_points=[[320, 200]],
    negative_points=[[20, 20]],
    previous_mask=probability,
)

Images and previous-mask probabilities are resized internally, and results are returned at the original image size. Calls are stateless; pass the preceding probability map when refining the same object. The pretrained bundle accepts up to 20 positive and 20 negative clicks.

Live camera

Install the example dependencies and run:

python examples/track_live.py

# Use RITM click-assisted initialization
python examples/track_live.py --ritm

# After installing .[gpu,examples]
python examples/track_live.py --device cuda

Use 19 or n/p to select an object ID. Press Enter after defining the objects, c during tracking to correct the current masks, and q to stop. Left-click adds a positive RITM point and right-click adds a negative point.

Camera frames preserve aspect ratio with letterboxing. Use --resize-mode cover to crop or --resize-mode stretch to distort. CUTIE memory settings can be evaluated with --mem-every, --max-mem-frames, and --top-k.

SAM3

SAM3 requires a compatible local recurrent ONNX bundle:

from telekinesis.trackers import Sam3Tracker

tracker = Sam3Tracker("bundles/sam3/1080x1080-4", device="cpu")
tracker.seed(seed_labels, first_rgb)
labels, alive_fraction = tracker.execute(next_rgb)

The adapter accepts device="auto", "cpu", "cuda", or "cuda:N". The cpu and gpu extras select the ONNX Runtime installation. See DEVELOPMENT.md for the required bundle contract.

Run a video with an existing bundle:

python examples/track_video.py --tracker sam3 \
  --model-dir bundles/sam3/1080x1080-4 \
  --video clip.mp4 --masks object-a.png object-b.png \
  --resize 1080 1080 --out tracked.mp4

TAPIR point tracking

from telekinesis.trackers import TapirTracker

tracker = TapirTracker("bundles/tapir/causal-2")
tracks = tracker.seed(first_rgb, query_points_xy)
tracks = tracker.step(next_rgb)

Bundle mode, frame count, resolution, and query count are fixed in its manifest.

McByte association

from telekinesis.trackers import McByteTracker

tracker = McByteTracker(
    "bundles/mcbyte/sam/vit-b",
    "bundles/mcbyte/cutie/480x864",
)
tracked_detections = tracker.update(detections, frame_rgb)

McByte does not include a detector. Supply supervision.Detections on every frame. Its CUTIE bundle must use the dynamic-object graph layout.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

telekinesis_trackers-0.1.0.tar.gz (62.0 kB view details)

Uploaded Source

Built Distribution

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

telekinesis_trackers-0.1.0-py3-none-any.whl (31.0 kB view details)

Uploaded Python 3

File details

Details for the file telekinesis_trackers-0.1.0.tar.gz.

File metadata

  • Download URL: telekinesis_trackers-0.1.0.tar.gz
  • Upload date:
  • Size: 62.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.11.15

File hashes

Hashes for telekinesis_trackers-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c86ea164fd69f58d425bf17c86c147fe80776ac200e8c7a6a6177b3d17b12768
MD5 96fa33c7b79f8277e56806b3bb56784e
BLAKE2b-256 2fff85ae5b022ee96b3162a65ad4561991e55536abe6e967f3d5ef32827c0ec5

See more details on using hashes here.

File details

Details for the file telekinesis_trackers-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for telekinesis_trackers-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5861eaf842fbba34f096572c5e4202e87dd2d354a0ac733b876262f05f096bf5
MD5 046cf03707622df0d9fd04b109407095
BLAKE2b-256 154502f22fdea8cdc141e634f4dec12c8cd1057a5f9050e20b15b568ed55cffb

See more details on using hashes here.

Release history Release notifications | RSS feed

0.1.1

2 files

This release

0.1.0 This release

2 files

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