Skip to main content

Frames2Py

CI License: Apache-2.0 Python: 3.11 to 3.14, and 3.14t Platforms: Linux, macOS arm64 Version on PyPI

Live, decoupled observation of event-camera state.

Documentation: https://siddiquifaras.github.io/frames2py/

An event camera reports per-pixel brightness changes as a stream of events, often millions a second. The loop that consumes that stream (tracking, inference, control) has to keep up, while something else usually wants to look at what the sensor sees right now: a display, a monitor, a second algorithm. Put the looking inside the loop and the loop slows to its speed.

Frames2Py separates the two. Your producer feeds events to Engine.ingest(), which accumulates them through a kernel and publishes snapshots. Any number of consumers read the latest snapshot at their own pace, and the producer never waits for them.

event stream                 your producer: a camera SDK, a file adapter, your own code
    ↓  Engine.ingest()       EVENT_DTYPE arrays, on the producer's thread
Frames2Py
    ↓
accumulation / kernel        counts, polarity, time surface, decays, time bins
    ↓
Engine                       publishes at most once per snapshot_interval_ms
    ↓
immutable snapshot           a fresh frame + metadata, shared, never written again
    ↓
independent consumers        engine.snapshot() or wait_for_newer(): any thread, any number
  • Engine: the live runtime. One producer thread calls ingest(); consumers call snapshot(), or block in wait_for_newer() until a newer snapshot is published. ingest() does its CPU work on the caller's thread and never waits on a consumer or on I/O.
  • Accumulator: the same accumulation without publication or threads, for offline processing, tests and loops you drive yourself.
  • Kernels: event_count and polarity (windowed counts: each snapshot holds only the events since the previous publication), time_surface (latest timestamp per pixel), ExpDecay(decay) (decays once per call) and TimestampDecay(tau_us) (decays with event time, independent of how events are batched); and two temporal kernels for models, StackedHistogram(bins=..., bin_us=...) (per-polarity counts in time bins) and VoxelGrid(bins=..., bin_us=...) (a signed linear voxel grid).
  • Snapshots: a frame and its metadata (watermark, sequence) from one publication. The frame is shared by every consumer and read-only; snapshot.copy() gives you your own.

Quickstart

import numpy as np

import frames2py

# 10,000 synthetic events on a 640x480 sensor, one every microsecond.
rng = np.random.default_rng(seed=0)
events = np.zeros(10_000, dtype=frames2py.EVENT_DTYPE)
events["t"] = np.arange(10_000)              # timestamps, µs
events["x"] = rng.integers(0, 640, 10_000)   # column
events["y"] = rng.integers(0, 480, 10_000)   # row
events["p"] = rng.integers(0, 2, 10_000)     # polarity: 0 is OFF, anything else ON

engine = frames2py.Engine((640, 480), "event_count")  # sensor_size is (width, height)
engine.ingest(events)                                 # the first ingest() always publishes

snapshot = engine.snapshot()  # the latest publication: shared, read-only
print(snapshot.frame.shape, snapshot.frame.dtype)
print("events counted:", int(snapshot.frame.sum()))
print("watermark:", snapshot.meta.watermark, "sequence:", snapshot.meta.sequence)
print("ingested:", engine.stats.events_ingested, "out of bounds:", engine.stats.events_out_of_bounds)
(480, 640) uint32
events counted: 10000
watermark: 9999 sequence: 1
ingested: 10000 out of bounds: 0

In a live program, ingest() runs in the producer's own loop on its own thread, and consumers read snapshot() elsewhere. The viewer, for example, needs the viewer extra and runs on the main thread: from frames2py import viewer, then viewer.run(engine.snapshot).

Installation

CPython 3.11+, NumPy 2.4+:

pip install frames2py
pip install "frames2py[hdf5,recorder,viewer]"   # with extras

The core needs NumPy only. The extras are evt, aedat4, hdf5, recorder and viewer.

What each extra pulls in, and installing the development version from Git: Installation.

Adapters, recorder, viewer

  • File adapters yield EVENT_DTYPE arrays from EVT 2.0 / 3.0 (Prophesee RAW), AEDAT 4.0 and HDF5 recordings:

    # Sketch (not runnable): needs a recording of your own.
    import frames2py
    from frames2py.adapters import evt
    
    with evt.open("recording.raw") as reader:   # pass sensor_size=(w, h) if the header has no geometry
        engine = frames2py.Engine(reader.sensor_size, "event_count")
        for events in reader:
            engine.ingest(events)
    
  • Recorder: writes events to HDF5, next to ingest() in your loop; the Engine never calls it.

  • Replay: frames2py.replay.paced() yields a recording's batches at their recorded pace; frames2py.replay.windows() turns a recording into a frame every N µs of event time.

  • Viewer: render() turns a snapshot into an RGB image; run() shows an Engine in a window.

Frames2Py ships no vendor SDK adapters: convert your SDK's buffers to EVENT_DTYPE and call ingest().

PyTorch is not a dependency. To hand snapshots to a model, copy them first; the tested recipe, with dtypes and devices, is Handing snapshots to PyTorch.

Performance

On one Apple M4 (16 GB), the v1 performance gate measured all 150 of its cells above 20M events/s, on CPython 3.11.14 and free-threaded 3.14.2t, both with NumPy 2.4.6. No other hardware has been measured, and 3.14.5 or later has not been measured. The two temporal kernels added in 1.1 have a gate of their own, which they don't meet in every cell: see Throughput.

The cells, the method, the live (paced) figures and the caveats: Performance.

Python and platforms

CPython 3.11 to 3.14 and free-threaded 3.14t (GIL disabled), on Linux x86_64, Linux ARM64 and macOS ARM64, tested in CI (3.12 and 3.13 on Linux x86_64 only). Windows is not supported. Details: Supported Python and platforms.

Project status

Stable: the 1.x public API changes only compatibly. Maintained on a best-effort basis. Known limitations, among them no Windows support, no live camera adapters, no cross-process snapshots and performance figures from one machine, are collected under Known limitations.

Documentation

The full documentation, with the event contract, kernel semantics, the snapshot and lifecycle model, adapters, the API reference and the benchmark methodology, is at https://siddiquifaras.github.io/frames2py/.

An end-to-end notebook, examples/live_observation.ipynb, runs a live Engine on a synthetic event stream with a tracker, a deliberately slow consumer and a monitor, and shows what each of them saw. It runs from a checkout of the repository.

Development

git clone https://github.com/siddiquifaras/frames2py.git
cd frames2py
uv sync --all-extras
uv run pytest

See CONTRIBUTING.md and Testing. To report a security problem privately, see SECURITY.md.

License

Copyright 2026 Muhammad Faras Siddiqui. From 1.1.0, Frames2Py is licensed under the Apache License, Version 2.0: see LICENSE. Releases 1.0.0rc1 and 1.0.0 were published under the MIT License, which still applies to them.

Metadata

Release files for frames2py 1.1.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 frames2py 1.1.0
File Size Uploaded Provenance Actions
frames2py-1.1.0.tar.gz 46.9 kB With provenance Details for frames2py-1.1.0.tar.gz

Built distribution (wheel)

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

Total release size: 106.1 kB

Release files / frames2py-1.1.0.tar.gz

Download URL frames2py-1.1.0.tar.gz
Size 46.9 kB
Tags Source
SHA-256 checksum
How to use checksums
3dcbac1029e7627477809653fc65f43f66f72d4a43f9034696335d7a289ea9d8
BLAKE2b-256 checksum
How to use checksums
6b03d20a4c9dcae348db82e67333130af6cf1c042c4beac8811efa0936b2bb2e
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 7, 2026.

Transparency log

Release files / frames2py-1.1.0-py3-none-any.whl

Download URL frames2py-1.1.0-py3-none-any.whl
Size 59.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
be5d541582ccb8167eb7809bea45d6695400cb73d4939537051dfbbc4fa855b9
BLAKE2b-256 checksum
How to use checksums
7cf90a565c4d65d637166b010423479b02fb3e3ec47fb8e4f40949da3b85f763
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 7, 2026.

Transparency log

Security for frames2py 1.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

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

Select from 2 files

Attestation for frames2py-1.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 7, 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