tarsius
Local, training-free state detection for a region of a camera image: is the car in the garage, is the mailbox flag up, is the gate open.
You confirm a few frames per state, tarsius compares new frames against them and answers with a state or "unsure". Nothing leaves the machine and nothing gets trained.
from tarsius import Classifier, NcnnBackend, Roi, extract_features, load_image
backend = NcnnBackend()
spot = Roi(0.10, 0.10, 0.60, 0.50)
classifier = Classifier.for_backend(backend)
car = extract_features(backend, load_image(car_jpeg), spot)
empty = extract_features(backend, load_image(empty_jpeg), spot)
classifier.add("ref-1", car, state="occupied")
classifier.add("ref-2", empty, state="free")
result = classifier.classify(extract_features(backend, load_image(new_jpeg), spot))
result.status # Status.CONFIDENT, Status.UNSURE or Status.NOT_READY
result.state # "occupied" or "free" when confident
result.candidate # best guess, also when unsure
Store features.reference().to_bytes() next to each confirmed frame and restore it with Reference.from_bytes(). On FeaturesError, extract again from the stored frame.
Backends
NcnnBackend: SqueezeNet 1.1 ImageNet features on ncnn, install withtarsius[ncnn]. Tolerates clutter and lighting changes, a rough region is enough.EdgeBackend: numpy only, a baseline. Needs a tight region that still shows some static structure when the object is gone.
NcnnBackend is the intended default. It stays an optional extra until ncnn ships a release that no longer requires opencv-python, which has no musllinux wheels. Without that, tarsius cannot install on Alpine (musl) systems such as Home Assistant OS, whose Core container is Alpine based. ncnn master already made opencv optional (Tencent/ncnn@0ca5a4b), so the next ncnn release should unblock it.
Results so far
One household, two garage cameras, 24 days of recorded history, day and IR night. References come from older frames, the test is the newest week. The table is the harder camera: a dark car and clutter that gets moved around in front of it (459 frames, 164 in the test week). The other camera scores 100 % with both backends.
| Backend | Region | 2 confirmed segments per state | 5 per state |
|---|---|---|---|
| ncnn | tight | 0 % wrong, 0 % unsure | 0 % wrong, 0 % unsure |
| ncnn | wide, with clutter | 0 % wrong, 0 % unsure | 0 % wrong, 0 % unsure |
| edges | tight | 1.8 % wrong, 3.5 % unsure | 0 % wrong, 1.8 % unsure |
| edges | wide, with clutter | 27 % wrong, 7.6 % unsure | 20 % wrong, 8.5 % unsure |
About 20 ms per 4 MP frame including JPEG decoding, for either backend, on an x86 desktop with one thread.
A small sample, not a guarantee. scripts/history_split.py runs the same evaluation on your own recordings.
Development
scripts/build_model.sh # once, builds the ncnn model into src/tarsius/models
uv sync --extra ncnn
uv run pytest
uvx prek run --all-files
The ncnn model is not stored in git. scripts/build_model.sh converts the original SqueezeNet 1.1 release with the ncnn tools. Inputs and outputs are checked against pinned sha256 sums, so CI and a local run produce the same files. It needs x86_64 Linux with curl, unzip, libgomp1 and libprotobuf32t64 (Ubuntu 24.04).
Releases: every PR gets a label, Release Drafter collects them into a draft, publishing the GitHub release builds and uploads to PyPI.
License
Apache-2.0. The bundled SqueezeNet model is BSD-2-Clause, see NOTICE.
Metadata
Release files for tarsius 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| tarsius-0.1.0.tar.gz | 2.3 MB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| tarsius-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 4.6 MB
Release files / tarsius-0.1.0.tar.gz
| Download URL | tarsius-0.1.0.tar.gz |
|---|---|
| Size | 2.3 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d41c8bc965c7c0a3a0ca1443c9aa2b84c186ef10ee6a072df2e43e3f4407fb11
|
|
BLAKE2b-256 checksum How to use checksums |
4894acfeb2d4788039faca2e6fa1a9a6c5659cecf767f91ad1360b0db7a3ee53
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Oct 19, 2026.
Transparency logRelease files / tarsius-0.1.0-py3-none-any.whl
| Download URL | tarsius-0.1.0-py3-none-any.whl |
|---|---|
| Size | 2.3 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fa7a73023e03a2c4d3452fed02cbfb8777390c49bb0e6fe036c9e0b7edb786f6
|
|
BLAKE2b-256 checksum How to use checksums |
4dab6a8131dc3ceccc19b21aa8e1022b240c84a44048a3cd13b0572e9662ca25
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Oct 19, 2026.
Transparency logSecurity for tarsius 0.1.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
All 2 files in this release have been uploaded with provenance metadata.
Attestation for tarsius-0.1.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 Oct 19, 2026.
Transparency logA 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.