pyzm – Python for ZoneMinder

pyzm is a Python library for interacting with the ZoneMinder surveillance system. It provides:

  • A typed client for the ZoneMinder REST API (monitors, events, states)

  • An ML detection pipeline supporting YOLO, Coral EdgeTPU, face recognition, ALPR, and audio recognition (BirdNET)

  • A remote ML detection server (pyzm.serve) for offloading GPU work

  • A web UI for fine-tuning YOLO models on your own data (pyzm.train)

  • Pydantic v2 configuration models and typed detection results

Source on GitHub

See Installation for detailed instructions, including notes on system-managed Python environments.

Quick example

from pyzm import ZMClient, Detector

# Connect to ZoneMinder
zm = ZMClient(api_url="https://zm.example.com/zm/api",
               user="admin", password="secret")

for m in zm.monitors():
    print(f"{m.name}: {m.function} ({m.width}x{m.height})")

# Detect objects in a local image
detector = Detector(models=["yolo11s"])
result = detector.detect("/path/to/image.jpg")

if result.matched:
    print(result.summary)       # "person:97% car:85%"
    result.annotate()           # draw bounding boxes on the image

Indices and tables