Skip to main content

scenesense

A Python library for 3D spatial scene monitoring. Point a camera at any space, build a baseline, and get notified when objects are added, removed, or moved — with timestamps.

Install

pip install .

Or for development:

pip install -e .

Quick Start

Compare two videos

from scenesense import Scene

scene = Scene()

# Build baseline from first video
scene.baseline("room_before.mp4", save_path="baseline.json")

# Compare against second video
changes = scene.compare("room_after.mp4")

for c in changes:
    print(c)
# {"status": "missing", "object": "cup", "last_position": [...]}
# {"status": "new",     "object": "bag", "position": [...]}
# {"status": "moved",   "object": "chair", "from": [...], "to": [...]}

Load a saved baseline

scene = Scene()
scene.load_baseline("baseline.json")
changes = scene.compare("room_after.mp4")

Live camera monitoring

from scenesense import Scene

def on_event(event):
    print(f"[{event['timestamp']}] {event['event'].upper()} — {event['object']}")
    # event keys: event, object, timestamp, stream_offset_seconds
    # + last_position (missing), position (new), from/to (moved)

scene = Scene()

scene.watch(
    source=0,                  # webcam index or RTSP URL
    baseline_duration=15,      # seconds to build baseline
    interval=30,               # seconds between checks
    on_event=on_event
)

Configuration

scene = Scene(
    model_size="n",        # yolo model: 'n' (fast), 's', 'm' (accurate)
    confidence=0.4,        # detection confidence threshold
    sample_rate=1.0,       # frames per second to sample from video
    move_threshold=0.3,    # distance to consider an object moved
    match_threshold=0.5    # distance to consider two detections the same object
)

How it works

  1. Frame extraction — samples frames from video at a controlled rate
  2. Object detection — runs YOLOv8 on each frame to find objects and bounding boxes
  3. Depth estimation — runs MiDaS to estimate per-pixel depth
  4. 3D projection — combines detection center + depth to get XYZ coordinates
  5. Scene graph — collapses per-frame detections into a stable list of unique objects
  6. Registration — aligns new video coordinate frame to baseline using ORB feature matching
  7. Delta detection — compares scene graphs to find missing, moved, and new objects

Use cases

  • Warehouse shelf auditing
  • Museum artifact monitoring
  • Security and facility management
  • Construction site progress tracking
  • Retail planogram compliance
  • Manufacturing FOD detection

Requirements

  • Python 3.10+
  • opencv-python
  • numpy
  • ultralytics (YOLOv8)

Models are downloaded automatically on first use (~30MB total).

Testing

pytest tests/unit/ -v

Metadata

Release files for scenesense 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for scenesense 0.1.1
File Size Uploaded Provenance Actions
scenesense-0.1.1.tar.gz 16.5 kB Without provenance Details for scenesense-0.1.1.tar.gz

Built distribution (wheel)

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

Total release size: 35.3 kB

Release files / scenesense-0.1.1.tar.gz

Download URL scenesense-0.1.1.tar.gz
Size 16.5 kB
Tags Source
SHA-256 checksum
How to use checksums
ec7e1dd172066a94b99a6672664daee1f9a2cf6ec22a2f52ba30dafe24fd8217
BLAKE2b-256 checksum
How to use checksums
0ac609b306ef974eb7bdeff5dae61bf10852e7a9d2e84c9ef447ecb6efdebd69
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.2

Release files / scenesense-0.1.1-py3-none-any.whl

Download URL scenesense-0.1.1-py3-none-any.whl
Size 18.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0f16b4589001353d9fa0785514114cb58221be392c040d732d8cf20fd70e83be
BLAKE2b-256 checksum
How to use checksums
08d13c0ae806916febda6e4e57007bd401014c9647e0be7d4c072f6213eb9b3c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.2

Security for scenesense 0.1.1

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

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