Skip to main content

Templates for multi-object tracking using the CoTracker model, supporting offline, online, and visualization workflows.

Project description



Sinapsis CoTracker

Templates for multi-object tracking and visualization using the CoTracker model

🐍 Installation 🚀 Features📙 Documentation 🔍 License

The siinapsis-cotracker module provides a robust and flexible implementation for multi-object tracking using the CoTracker model. It enables users to easily configure and run tracking pipelines for video input processing and visualization tasks.

🐍 Installation

Install using your package manager of choice. We encourage the use of uv

[!WARNING] cotracker dependency is required to install sinapsis-cotracker

UV instructions

Install cotracker in your working environment as follows:

uv pip install git+https://github.com/facebookresearch/co-tracker.git

then install sinapsis-cotracker

uv pip install sinapsis-cotracker --extra-index-url https://pypi.sinapsis.tech

Raw pip instructions

Install cotracker in your working environment as follows:

pip install git+https://github.com/facebookresearch/co-tracker.git

then install sinapsis-cotracker

pip install sinapsis-cotracker --extra-index-url https://pypi.sinapsis.tech

🚀 Features

Templates Supported

The Sinapsis CoTracker module offers a set of templates for multi-object tracking and visualization using the CoTracker model. These templates enable users to perform both online and offline tracking, process video inputs, and visualize tracking results on video frames. The templates in this package include functionality for:

  • CoTrackerOffline: Handles offline multi-object tracking for short videos. It loads the entire video into memory for processing and is the simplest method for offline tasks.
  • CoTrackerOfflineLarge: Provides offline tracking for long videos by using a memory-efficient, incremental engine.
  • CoTrackerOnline: Supports real-time object tracking with advanced grid query and support grid features.
  • CoTrackerVisualizer: Visualizes tracking results with customizable trace, line width, and visualization modes.

[!TIP] Use CLI command sinapsis info --all-template-names to show a list with all the available Template names installed with Sinapsis CoTracker.

[!TIP] Use CLI command sinapsis info --example-template-config TEMPLATE_NAME to produce an example Agent config for the Template specified in TEMPLATE_NAME.

For example, for CoTrackerOffline use sinapsis info --example-template-config CoTrackerOffline to produce the following example config:

agent:
  name: my_test_agent
templates:
- template_name: InputTemplate
  class_name: InputTemplate
  attributes: {}
- template_name: CoTrackerOffline
  class_name: CoTrackerOffline
  template_input: InputTemplate
  attributes:
    device: '`replace_me:typing.Literal[''cuda'', ''cpu'']`'
    generic_key_field: CoTrackerResults
    model_cache_dir: /home/cv/.cache/sinapsis
    model_variant: '`replace_me:typing.Literal[''baseline'', ''scaled'']`'
    use_segmentation_mask: false
    grid_size: '`replace_me:<class ''int''>`'
    grid_query_frame: 0
    backward_tracking: false
📚 Example Usage

Below is an example YAML configuration for processing a video file and visualizing tracking results using Sinapsis CoTracker templates. This setup loads a video with the VideoReaderCV2, performs real-time object tracking with the CoTrackerOnline template, visualizes the results with the CoTrackerVisualizer, and saves the output as a new video file using the VideoWriterCV2.

Config
agent:
  name: cotracker_agent

templates:
  - template_name: InputTemplate
    class_name: InputTemplate
    attributes: {}

  - template_name : VideoReaderCV2
    class_name: VideoReaderCV2
    template_input: InputTemplate
    attributes:
      video_file_path : "artifacts/palace.mp4"
      batch_size: 16

  - template_name: CoTrackerOnline
    class_name: CoTrackerOnline
    template_input: VideoReaderCV2
    attributes:
      model_variant: baseline
      device: cuda
      grid_size: 15

  - template_name: CoTrackerVisualizer
    class_name: CoTrackerVisualizer
    template_input: CoTrackerOnline
    attributes:
      device : cuda
      linewidth: 3
      overwrite: true

  - template_name: VideoWriterCV2
    class_name: VideoWriterCV2
    template_input: CoTrackerVisualizer
    attributes:
      destination_path: "artifacts/result.mp4"
      height: -1
      width: -1
      fps: 30

This configuration defines an agent and a sequence of templates for video processing, object tracking, and visualization.

IMPORTANT: The VideoReaderCV2 and VideoWriterCV2 templates are part of the sinapsis-data-readers and sinapsis-data-writers packages, respectively. To use this example, ensure that you have installed these packages.

To run the config, use the CLI:

sinapsis run name_of_config.yml

📙 Documentation

Documentation for this and other sinapsis packages is available on the sinapsis website

Tutorials for different projects within sinapsis are available at sinapsis tutorials page

🔍 License

This project is licensed under the AGPLv3 license, which encourages open collaboration and sharing. For more details, please refer to the LICENSE file.

For commercial use, please refer to our official Sinapsis website for information on obtaining a commercial 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

sinapsis_cotracker-0.1.7.tar.gz (25.8 kB view details)

Uploaded Source

Built Distribution

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

sinapsis_cotracker-0.1.7-py3-none-any.whl (28.5 kB view details)

Uploaded Python 3

File details

Details for the file sinapsis_cotracker-0.1.7.tar.gz.

File metadata

  • Download URL: sinapsis_cotracker-0.1.7.tar.gz
  • Upload date:
  • Size: 25.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.16

File hashes

Hashes for sinapsis_cotracker-0.1.7.tar.gz
Algorithm Hash digest
SHA256 7cf371ac42438f4d6ae52ca648d75aab00e61b9c872cf606b65108df1fcfdee6
MD5 750a3657104232f4b2947afa650dcefd
BLAKE2b-256 a82dd46dfd40eda6b556ebb58cfe8674dbdeb7db872ed940e25be9dbb5a879e9

See more details on using hashes here.

File details

Details for the file sinapsis_cotracker-0.1.7-py3-none-any.whl.

File metadata

File hashes

Hashes for sinapsis_cotracker-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 a247574b27f360d81978a179e288560fe13633a62bae0577e8f51270fa0add8a
MD5 01f062ec3ed5a55eefc92835620018a4
BLAKE2b-256 d158792ce9c39f033e1e715dfa235d74a09c87e69aeebe9b907e43b94b33f4b0

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