similari

Library Listed Dormant

Machine learning framework for building object trackers and similarity search engines

Checked · Sources

Downloads
10
Dependents
0
Stars
267
Forks
24
Contributors
7
Commits
384
Latest release
0.26.2 ·

About

From the project README ·

Newer versions (renamed):

Older versions:

:star: Star us on GitHub — it motivates us a lot!

Similari is a Rust framework with Python bindings that helps build sophisticated tracking systems. With Similari one can develop highly efficient parallelized SORT, DeepSORT, and other sophisticated single observer (e.g. Cam) or multi-observer tracking engines.

Introduction

The primary purpose of Similari is to provide means to build sophisticated in-memory multiple object tracking engines.

The framework helps build various kinds of tracking and similarity search engines - the simplest one that holds vector features and allows comparing new vectors against the ones kept in the database. More sophisticated engines operate over tracks - a series of observations for the same feature collected during the lifecycle. Such systems are often used in video processing or other systems where the observer receives fuzzy or changing observation results.

Out-of-The-Box Stuff

Similari is a framework to build custom trackers, however it provides certain algorithms as an end-user functionality:

Read the full README

Bounding Box Kalman filter, that predicts rectangular bounding boxes axis-aligned to scene, supports the oriented (rotated) bounding boxes as well.

2D Point Kalman filter, that predicts 2D point motion.

2D Point Vector Kalman filter, that predicts the vector of independent 2D points motion (used in the Keypoint Tracker).

Bounding box clipping, that allows calculating the area of intersection for axis-aligned and oriented (rotated) bounding boxes.

Non-Maximum Suppression (NMS) - filters rectangular bounding boxes co-axial to scene, and supports the oriented bounding boxes.

SORT tracking algorithm (axis-aligned and oriented boxes are supported) - IoU and Mahalanobis distances are supported.

Batch SORT tracking algorithm (axis-aligned and oriented boxes are supported) - IoU and Mahalanobis distances are supported. Batch tracker allows passing multiple scenes to tracker in a single batch and get them back. If the platform supports batching (like Nvidia DeepStream or Intel DL Streamer) the batch tracker is more beneficial to use.

VisualSORT tracking - a DeepSORT-like algorithm (axis-aligned and oriented boxes are supported) - IoU and Mahalanobis distances are supported for positional tracking, euclidean, cosine distances are used for visual tracking on feature vectors.

Batch VisualSORT - batched VisualSORT flavor;

Applicability Notes

Although Similari allows building various tracking and similarity engines, there are competitive tools that sometimes may fit better. The section will explain where it is applicable and what alternatives exist.

Similari fits best for the tracking tasks where objects are described by multiple observations for a certain feature class, not a single feature vector. Also, their behavior is dynamic - you remove them from the index or modify them as often as add new ones. This is a very important point - it is less efficient than tools that work with growing or static object spaces.

Fit: track the person across the room: person ReID, age/gender, and face features are collected multiple times during the tracking and used to merge tracks or provide aggregated results at the end of the track;

Not fit: plagiarism database, when a single document is described by a number (or just one) constant ReID vectors, documents are added but not removed. The task is to find the top X most similar documents to a checked.

If your task looks like Not fit, can use Similari, but you're probably looking for HNSW or NMS implementations:

Similari objects support following features:

Track lifecycle - the object is represented by its lifecycle (track) - it appears, evolves, and disappears. During its lifetime object evolves according to its behavioral properties (attributes, and feature observations).

Observations - Similari assumes that an object is observed by an observer entity that collects its features (uniform vectors) and custom observation attributes (like GPS or screen box position)multiple times. Those features are presented by vectors of float numbers and observation attributes. When the observation happened, the track is updated with gathered features. Future observations are used to find similar tracks in the index and merge them.

Track Attributes - Arbitrary attributes describe additional track properties aside from feature observations. Track attributes is crucial part when you are comparing objects in the wild, because there may be attributes disposition when objects are incompatible, like animal_type that prohibits you from comparing dogs and cats between each other. Another popular use of attributes is a spatial or temporal characteristic of an object, e.g. objects that are situated at distant locations at the same time cannot be compared. Attributes in Similari are dynamic and evolve upon every feature observation addition and when objects are merged. They are used in both distance calculations and compatibility guessing (which decreases compute space by skipping incompatible objects).

If you plan to use Similari to search in a large index, consider object attributes to split the lookup space. If the attributes of the two tracks are not compatible, their distance calculations are skipped.

Performance

The Similari is fast. It is usually faster than trackers built with Python and NumPy.

To run visual feature calculations performant the framework uses ultraviolet - the library for fast SIMD computations.

Parallel computations are implemented with index sharding and parallel computations based on a dedicated thread workers pool.

Vector operations performance depends a lot on the optimization level defined for the build. On low or default optimization levels Rust may not use f32 vectorization, so when running benchmarks take care of proper optimization levels configured.

Rust optimizations

Use RUSTFLAGS="-C target-cpu=native" to enable all cpu features like AVX, AVX2, etc. It is beneficial to ultraviolet.

Alternatively you can add build instructions to .cargo/config:

[build]
rustflags = "-C target-cpu=native"

Take a look at benchmarks for numbers.

Performance Benchmarks

Some benchmarks numbers are presented here: Benchmarks

You can run your own benchmarks by:

rustup default nightly
cargo bench

Apple Silicone Build Notes

You may need to add following lines into your ~/.cargo/config to build the code on Apple Silicone:

[build]
rustflags = "-C target-cpu=native"

# Apple Silicone fix
[target.aarch64-apple-darwin]
rustflags = [
    "-C", "link-arg=-undefined",
    "-C", "link-arg=dynamic_lookup",
]

Python API

Python interface exposes ready-to-use functions and classes of Similari. As for now, the Python interface provides:

  • the Kalman filter for axis-aligned and oriented (rotated) boxes prediction;
  • the Kalman filter for 2D point motion prediction;
  • the 2D Point Vector Kalman filter, that predicts the vector of independent 2D points motion (used in the Keypoint Tracker);
  • NMS (Non-maximum suppression);
  • the Sutherland-Hodgman clipping, intersection area for oriented (rotated) boxes;
  • SORT with IoU and Mahalanobis metric;
  • BatchSORT with IoU and Mahalanobis metric;
  • VisualSORT - DeepSORT-like tracker with euclidean/cosine metric for visual features and IoU/Mahalanobis metric for positional tracking (VisualSort).
  • BatchVisualSORT - batched VisualSORT flavor;

Python API classes and functions can be explored in the python documentation and tiny examples provided.

There is also MOTChallenge evaluation kit provided which you can use to simply evaluate trackers performance and metrics.

Install Python API from PyPi

Please, keep in mind that the PyPi package is built to conform broad range of platforms, so it may not be as fast as the one you build locally for your platform (see the following sections).

Platforms:

  • Linux: X86_64, ARM64, ARMv7;
  • Windows: X86_64;
  • MacOS: X86_64, ARM64.
pip3 install similari-trackers-rs
Build Python API in Docker

You can build the wheel in the Docker and if you want to install it in the host system, copy the resulting package to the host system as demonstrated by the following examples.

Rust 1.67 Base Image

If you use other rust libraries you may find it beneficial to build with base Rust container (and Python 3.8):

docker build -t similari-trackers-rs -f docker/rust_1.67/Dockerfile .

# optional: copy and install to host system
docker run --rm -it -v $(pwd)/distfiles:/tmp similari-trackers-rs cp -R /opt/dist /tmp
pip3 install --force-reinstall distfiles/dist/*.whl
Python 3.8 Base Image

Python 3.8 is still a very frequently used. Here is how to build Similari with it:

docker build -t similari-trackers-rs -f docker/python_3.8/Dockerfile .

# optional: copy and install to host system
docker run --rm -it -v $(pwd)/distfiles:/tmp similari-trackers-rs cp -R /opt/dist /tmp
pip3 install --force-reinstall distfiles/dist/*.whl
Python 3.10 Base Image

If you use the most recent Python environment, you can build with base Python container:

docker build -t similari-trackers-rs -f docker/python_3.10/Dockerfile .

# optional: copy and install to host system
docker run --rm -it -v $(pwd)/distfiles:/tmp similari-trackers-rs cp -R /opt/dist /tmp
pip3 install --force-reinstall distfiles/dist/*.whl

NOTE: If you are getting the pip3 error like:

ERROR: similari-trackers-rs-0.26.4-cp38-cp38-manylinux_2_28_x86_64.whl is not a supported wheel on this platform.

It means that the Python version in the host system doesn't match to the one that is in the image used to build the wheel.

Build Python API in Host System
Linux Instruction
  1. Install up-to-date Rust toolkit:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source $HOME/.cargo/env
rustup update
  1. Install build-essential tools apt install build-essential -y.

  2. Install Python3 (>= 3.8) and the development files (python3-dev).

  3. Install Maturin:

pip3 install --upgrade maturin~=0.15
  1. Not in VENV. Build the python module:
RUSTFLAGS=" -C target-cpu=native -C opt-level=3" maturin build --release --out dist
pip3 install --force-reinstall dist/*.whl
  1. In VENV. Build the python module:
RUSTFLAGS=" -C target-cpu=native -C opt-level=3" maturin develop
  1. Usage examples are located at python.
  2. MOT Challenge Docker image for Similari trackers and conventional trackers is here. You can easily build all-in-one Docker image and try ours trackers.

Manuals and Articles

Collected articles about how the Similari can be used to solve specific problems.

Medium.com

Usage Examples

Take a look at samples in the repo:

Runs on
GPU support unknown
What shows it
  • no dependency or feature matches a backend row
Native code
None found
  • No native code found
Python bindings
Has Python bindings
  • similari needs Python
  • similari-trackers-rs needs Python only with feature python
License
Apache-2.0

Compare with similar projects

Order: strongest tier first, then most downloads, then name, with unmeasured values last. A library counts downloads over 30 days. An app counts binary downloads per release. An app with none counts its crate downloads over 30 days.

similari beside the projects that share a topic with it
ProjectDownloadsDependentsStarsLatest releaseRuns on (GPU)Native codeLicense
similari This page Listed Dormant

Machine learning framework for building object trackers and similarity search engines

Python bindings

10 downloads over 30 days 0 267 0.26.2 GPU support unknown No native code found Apache-2.0
imageproc Featured

Image processing operations

1,165,048 downloads over 30 days 370 986 0.27.0 GPU support unknown Binds native code: sdl2-sys (feature display-window) MIT
opencv-rust Featured

Rust bindings for OpenCV

262,425 downloads over 30 days 96 2,500 0.101.1 GPU support unknown Build uses a native toolchain: cc, pkg-config, vcpkg MIT
inference Listed

Ultralytics YOLO inference library and CLI for Rust

2,609 downloads over 30 days 1 217 0.0.56 CUDA, WebGPU, ROCm Binds native code: ort-sys, ffmpeg-sys-next (feature video), openvino-sys (feature intel) AGPL-3.0
pipeless Listed Dormant

An open-source computer vision framework to build and deploy applications in minutes

Python bindings

1 downloads over 30 days 0 855 1.11.0 GPU support unknown Binds native code: gio-sys, glib-sys, gobject-sys, gstreamer-app-sys, gstreamer-base-sys and 5 more Apache-2.0
image-ssd App Listed Dormant

A Rust library for object detection via SSD MobileNet.

Not measured Not applicable 5 Not measured Not measured Not measured MIT
Why ListedNo archive, New or Featured rule places it, so it is Listed.

What it lacks for Featured

  • It has 0 active dependents and 0 new dependents in 365 days. Featured needs 11 active dependents or 9 new dependents in 365 days. The repository route reads 267 stars, 24 forks and 7 contributors. It needs 4,539 stars, 434 forks and 79 contributors together.
  • The project is dormant and not finished. Dormancy rule

What else the check found

  • The last activity is on 26 Mar 2025, 593 days ago. That reaches the 365 days the rules expect, so the project is dormant. Dormancy rule
  • The oldest outside issue waits 801 days for a reply, past the limit of 270. No maintainer replied in 365 days. Rot signals rule

Not measured: Latest release fails cargo check.

Exact rules: Listed, Featured library. The check on applied thresholds version 9.

Every rule outcome, as the check records it
  • expected-interval: version 0.26.2 base 300, raised to the 365-day floor: E = 365 days
  • dormancy: last activity 2025-03-26, 593 days ago, E = 365: dormant
  • rot: oldest unanswered issue 801 days (limit 270), no maintainer reply in 365 days
  • featured: not featured: active_users 0 < 11 and new_adopters 0 < 9 and repository route stars 267 (needs 4539), forks 24 (needs 434), contributors 7 (needs 79); dormant and not stable
  • listed: listed: no archive, new or featured rule applies
Crates2 crates

Measurements and sources

Each signal row shows the raw value, its source and the fetch date. The Sources list gathers every distinct source on this page. Movement needs more history.

Sources6 sources
Adoption0 active dependents, 0 new dependents in 365 days1 not measured
Adoption measurements
SignalValueSourceFetchedCounts
Active dependents0crates.io database dumpYes
New dependents (365 days)0crates.io database dumpYes
Peak active dependents0crates.io database dumpYes
Active dependents as a share of the peak1crates.io database dumpYes
Binary downloads per releaseNot measuredYes
MaintenanceLatest human commit: 19 months ago3 not measured
Maintenance measurements
SignalValueSourceFetchedCounts
Latest human commit2025-03-26GitHub repositoryYes
Latest release2025-03-09crates.io database dumpYes
First release2022-07-15crates.io database dumpYes
Latest version0.26.2crates.io database dumpYes
Days the oldest outside issue waits for a reply801GitHub repositoryYes
Maintainer replies over 365 days0GitHub repositoryYes
Repository archivedfalseGitHub repositoryYes
Repository gonefalseGitHub repositoryYes
Release commit or manifest in the repotruecrates.io packageYes
Published docstruecrates.io database dumpYes
Latest release fails cargo checkNot measuredYes
Build check dateNot measuredYes
Build check toolchainNot measuredYes
SecurityUnpatched vulnerabilities: none
Security measurements
SignalValueSourceFetchedCounts
Unpatched vulnerabilities past the grace windownoneRustSec advisory databaseYes
RustSec unmaintained advisorynoneRustSec advisory databaseYes
Deprecation noticenonecrates.io database dumpYes
Deprecated requirementnonecrates.io database dumpYes
Distribution50 releases, 10 downloads over 30 days5 not measured
Distribution measurements
SignalValueSourceFetchedCounts
Releases50crates.io database dumpYes
Downloads over 30 days10crates.io database dumpYes
Binary downloads over the last 3 releasesNot measuredYes
Homebrew installs on request over 365 daysNot measuredYes
Repology repository familiesNot measuredYes
Docker pull growth over 90 daysNot measuredYes
Docker pulls at the growth baselineNot measuredYes
Every version a prereleasefalsecrates.io database dumpYes
Every version 0.0.xfalsecrates.io database dumpYes
Every version yankedfalsecrates.io database dumpYes
Crate deleted from crates.iofalsecrates.io database dumpYes
Repository267 stars, 24 forks, 7 contributors, 384 commits. Stars alone never qualify a project.
Repository measurements
SignalValueSourceFetchedCounts
GitHub stars267GitHub repositoryYes — one part of the repository route
GitHub forks24GitHub repositoryYes — one part of the repository route
Contributors with a GitHub account7GitHub contributorsYes — one part of the repository route
Commits on the default branch384GitHub repositoryNo
Repository's main crate left out of the entrynonecrates.io database dumpYes
Facts that never count
Facts that never count measurements
SignalValueSourceFetchedCounts
LicenseApache-2.0crates.io database dumpNo
Runs on, from listed crates and their direct dependenciesGPU support unknowncrates.io database dumpNo
What shows each backendno dependency or feature matches a backend rowcrates.io database dumpNo
Native code, from listed crates and their dependenciesNo native code foundcrates.io database dumpNo
Python bindings, from direct dependencies of listed cratesHas Python bindings: similari needs Python, similari-trackers-rs needs Python only with feature pythoncrates.io database dumpNo
Crates that depend on a listed crate directly0crates.io database dumpNo

Corrections and review history

Report a correction

No correction applies to this entry.

Judgments

A judgment enters only through an approved issue and a merged pull request.

No judgment applies to this entry.