Catch package theft with Porch Pirate

Run a 5-class package detection model in Frigate on the AI HAT+ NPU and publish an MQTT alert when a package disappears after someone new entered the porch zone.

Works with

AI HAT+Product overviewonRaspberry Pi 5

Not security product

Porch Pirate flags; it does not prevent theft. The listener logs and publishes an MQTT message, and nothing else is wired. Theft is a rule on Frigate’s tracked-object events, not something the detector sees, and the rule cannot tell a resident, a returning courier and a thief apart.

How it works

Frigate package detection needs a model with a package class, which COCO-80 models lack. Porch Pirate runs a custom 5-class model, people-and-cardboxes.dxnn, on the NPU of the Sixfab AI HAT+ for Raspberry Pi 5 (DEEPX DX-M1M) and a Python listener, porch_watch.py, on the Raspberry Pi 5 CPU. “Porch pirate” is US slang for someone who steals delivered packages.

The data flows in 5 steps:

  1. An RTSP stream of the porch reaches Frigate on the Raspberry Pi 5.
  2. Frigate sends frames to the DEEPX NPU, which runs the 5-class model.
  3. Frigate tracks each package and person and records whether it is inside frontdoor_zone.
  4. Frigate publishes tracked-object events to frigate/events.
  5. porch_watch.py reads those events and, when the rule matches, publishes an alert to porch_pirate/theft_alert.

When it works, the porchpirate camera in Frigate shows boxes around packages and people, the listener’s log has one line per step of the rule, and a theft scenario produces a message on porch_pirate/theft_alert. Each alert is one JSON line with the camera, package ID, suspect ID, dropper IDs, score and timestamp. Explore in Frigate lists each package and each person as its own tracked object, the same objects Frigate reports on frigate/events.

Requirements

Finish these pages first, in order: mount the Sixfab AI HAT+ for Raspberry Pi 5 with the Sixfab AI HAT+ Quickstart, set up Frigate NVR on Raspberry Pi 5 with the DEEPX NPU, then Camera feeds and MQTT for Frigate projects.

Required

Hardware

  • Raspberry Pi 5Runs Frigate and the listener.
  • Sixfab AI HAT+ (DEEPX DX-M1M)Already set up with Frigate’s DEEPX detector. This project was tested on this board.
  • Porch-facing RTSP cameraAny RTSP camera or stream at [RTSP_URL].

Software

  • Frigate with the DEEPX NPU detectorSet up with Frigate NVR on Raspberry Pi 5 with the DEEPX NPU. That page holds the one Frigate docker run command and pulls ghcr.io/blakeblackshear/frigate:af0ba19-standard-arm64.
  • MQTT brokerAny broker on port 1883 that accepts connections without credentials, such as Mosquitto; the listener sends no credentials. Frigate must publish MQTT events to the same broker the listener uses: follow Camera feeds and MQTT for Frigate projects.
  • Python 3 with venvinstall.sh creates a virtual environment and installs paho-mqtt.
  • Other toolsgit, curl, sha256sum, Docker, ffprobe, mosquitto_sub, systemd user services.

DEEPX support is not in a stable Frigate release

DEEPX support was merged into Frigate’s dev branch on September 21, 2026 (PR #24336). The latest stable release is v0.18.0 (September 12, 2026). This project uses the ghcr.io/blakeblackshear/frigate:af0ba19-standard-arm64 image, built from commit af0ba19 of the dev branch. Sixfab develops and maintains DEEPX support in Frigate; see Frigate’s DEEPX NPU detector docs.

Install

Run the install on the Raspberry Pi 5 that runs Frigate. Both methods copy the model and label map into the Frigate config directory, merge the model entry and the porchpirate camera into your Frigate config.yaml, install the listener and its service, and restart Frigate; the files in the repository stay unchanged.

To run this camera next to other projects’ cameras and models on one NPU, see Can one DEEPX NPU run several cameras and models? on the setup page.

Verify

  1. Check that the listener runs

    systemctl --user status porch-pirate-automation.service --no-pager -n 30

    The unit reports active (running), followed by its latest log lines.

  2. Subscribe to alert topic

    mosquitto_sub -h [BROKER_HOST] -t porch_pirate/theft_alert -v

    The command stays quiet until an alert fires.

  3. Check that Frigate answers

    docker exec frigate curl -s http://localhost:5000/api/stats

    Frigate returns its stats as JSON. Reach the Frigate web interface only through https://[PI_IP]:8971.

  4. Follow rule in listener log

    journalctl --user -u porch-pirate-automation.service -n 50 --no-pager

    The listener writes one line per step of the rule:

    Log lineMeaning
    PERSON_ENTERED_ZONEA person entered frontdoor_zone
    PACKAGE_DROPPEDA package was seen for the first time; the log lists the dropper IDs
    SECONDARY_PERSON_NEAR_PACKAGEA person outside the dropper set entered the zone while the package was active
    THEFT_ALERT_SUSPECTEDThe package event ended after a secondary person was seen; the alert was published
    PACKAGE_REMOVEDThe package event ended and no unrelated person was seen

    A theft scenario logs PACKAGE_DROPPED, then SECONDARY_PERSON_NEAR_PACKAGE, then THEFT_ALERT_SUSPECTED. The dropper picking the package back up while still in the frame logs PACKAGE_REMOVED and publishes nothing. A dropper who leaves the frame and comes back gets a new track ID, so the alert fires.

Results

Tested on a Raspberry Pi 5 (8 GB) with the Sixfab AI HAT+ (DEEPX DX-M1M), Raspberry Pi OS Trixie 64-bit, RT driver v2.6.0, PCIe driver v2.5.0, DX-RT v3.4.2 on the Raspberry Pi 5 and v3.4.0 in Frigate’s DEEPX detector, firmware v2.7.4, ghcr.io/blakeblackshear/frigate:af0ba19-standard-arm64 and a live IP camera over RTSP; last tested October 5, 2026.

Frigate’s System page showed a detector inference speed of 18.35 ms for deepx:PCIe:0 in the test (the figure below): one reading of Frigate’s own statistic, not a benchmark. No alert delay or false-alarm rate has been measured. To measure your own setup, read the detector stats with the Frigate stats command under Verify, and compare the time you remove a package with the time the message reaches porch_pirate/theft_alert; add a timestamp to your test runs so you can report the delay. Frigate’s System page lists the deepx:PCIe:0 detector with charts for inference speed, CPU and memory, which confirms that the NPU does the detection. System Monitoring shows how to check NPU load with dxtop.

Details

Parts

Porch Pirate has 3 parts:

PartFileJob
Modelmodel/people-and-cardboxes/people-and-cardboxes.dxnn, labelmap.txtDetects package, person, car, truck and motorcycle on the NPU
Zone and cameraconfig/fragment.yaml (porchpirate camera, model, frontdoor_zone)Limits the rule to the porch deck
Listenerautomation/porch_watch.py, run by porch-pirate-automation.serviceReads frigate/events and publishes the theft alert

Terms

TermMeaning
NPUNeural processing unit, a chip that runs neural-network inference so the CPU does not have to
Frigate NVRAn open-source network video recorder that runs object detection and publishes events over MQTT
MQTT, broker, topicMQTT is a lightweight publish-subscribe protocol; a broker such as Mosquitto passes messages between programs, and each message goes to a named topic
RTSPThe protocol IP cameras use to stream live video
COCO-80A common set of 80 object classes that many pretrained detectors use; it has no package class
.dxnnDEEPX’s compiled model format
Label mapA text file that lists the class names in the order the model outputs them
ZoneA polygon on the camera image; Frigate reports which zones each tracked object is in
Track IDThe ID Frigate gives an object while it stays in view; a person who leaves and returns gets a new one

Models with package class

Frigate detects packages without Frigate+, Frigate’s paid model service, only if its model has a package class. Porch Pirate does not use Frigate+:

ModelPackage labelClassesTheft logic
yolov8n-ppu-coco80.dxnn, a COCO-80 reference modelNo80No
people-and-cardboxes.dxnn, this project’s custom modelYes (package, class 0)5Provided by porch_watch.py, not by the model

people-and-cardboxes.dxnn detects 5 classes, in this order: package, person, car, truck, motorcycle. It takes a 640 × 640 input, was trained on a custom dataset balanced with COCO person images, and was compiled with DX-COM as a PPU model. It ships as a ready-compiled .dxnn file, so you compile nothing. The install downloads it from the project’s GitHub release into model/people-and-cardboxes/, next to labelmap.txt.

To compile your own model to .dxnn, see the Sixfab Deployment Workflow and the DX-COM configuration reference; for ready-made models, see the Sixfab Model Zoo.

Porch zone

porch_watch.py counts only people inside the Frigate zone named frontdoor_zone, but it tracks every package event on the camera, whichever zone the package is in. The shipped polygon follows the porch deck of the project’s reference frame: door frame, railing, pillar, deck corner, bottom edge. It does not fit your camera, so draw your own and keep the name frontdoor_zone. The coordinates in the fragment are x,y pairs between 0 and 1.

porch_watch.py does not filter by camera name. If another project on the same Frigate, such as face recognition, defines a zone also named frontdoor_zone, a person at that camera can trigger a false theft alert. Rename one of the 2 zones before you run both.

Theft rule

The alert fires when a package’s tracked-object event ends after someone new entered the zone: a person who was not in the zone when the package appeared. porch_watch.py applies 4 steps:

  1. Subscribes to frigate/events and reads the event type, ID, label, camera and current zones.
  2. When a new package event appears, takes a snapshot of every person in the zone at that moment as that package’s dropper set (the presumed droppers: a courier, or you). The set does not change, and it stays until the package event ends.
  3. While the package is active, flags the first person in the zone who is not in the dropper set as the secondary person.
  4. When the package event ends, logs a warning and publishes the alert if a secondary person was flagged; otherwise logs PACKAGE_REMOVED and publishes nothing.

A “different person” is a different Frigate track ID. The rule reacts to Frigate ending the package event and does not check why it ended. See Limitations.

MQTT topics

Porch Pirate uses 2 MQTT topics. Frigate’s own MQTT topics are documented upstream.

TopicPublished byRead byPayload
frigate/eventsFrigateporch_watch.pyTracked-object events
porch_pirate/theft_alertporch_watch.pyAny subscriberJSON, published with QoS 1, not retained

The alert payload has these fields; the example is schematic, not a captured alert. timestamp is Unix time in seconds, and dropped_score is the package’s detection score when it first appeared. The listener also logs THEFT_ALERT_SUSPECTED at warning level when it publishes.

{"camera": "<camera-name>", "box_id": "<package-event-id>", "suspect_person_id": "<person-event-id>", "dropped_by": ["<person-event-id>"], "dropped_score": 0.0, "timestamp": 0.0}

Limitations

  • No re-identification. Anyone who leaves and re-enters the frame gets a new track ID, so “different person” means “different track ID”. A real identity check would need a face_recognition sub_label comparison, which this project does not use.
  • No resident, courier or thief distinction. The rule does not check who picks the package up. It alerts whenever someone other than the dropper entered the zone first, so collecting your own package alerts when you were not in the zone as it appeared.
  • The rule reacts to the end of the package event. It does not check why Frigate ended the event, so a package track that Frigate loses while the package is still there counts as removed.
  • One flagged person per package. The listener records the first secondary person only.
  • State lives in memory. Restarting the listener clears active packages.
  • No broker security. The listener connects to port 1883 without credentials.
  • One camera and one zone. The fragment defines one camera and one zone, and the listener does not filter by camera: see Porch zone.
  • Frigate chooses the DX-RT version its DEEPX detector uses. The tested build pins DX-RT v3.4.0, and this page cannot change it.
  • Restart after a runtime restart. If the DX-RT daemon (the DEEPX runtime) restarts, restart the Frigate container too.
  • Frigate in Docker only. Porch Pirate was set up with Frigate in Docker; Home Assistant OS and the Frigate add-on were not tested.

Privacy

The camera records people, so set it up with their privacy in mind.

  • Aim the camera at your porch, not the street, and check local rules on recording public areas.
  • Delivery workers and visitors are recorded. Set recording and snapshot retention deliberately.
  • Detection runs on the NPU, and no cloud service is needed. The listener connects only to the MQTT broker you configure and contacts nothing else. Frigate itself downloads the DX-RT Python bindings once at first start, and again when a release pins a new version.
  • Never add traps, sprays or anything that could hurt someone, and never confront anyone.

Troubleshooting

Check the listener log with journalctl --user -u porch-pirate-automation.service -n 50 --no-pager. Confirm that mosquitto_sub -h [BROKER_HOST] -t frigate/events -v shows events; if it does not, revisit the Frigate MQTT setup. Then confirm that BROKER in porch_watch.py points at the same broker.

The listener filters by zone name and label only. Check that the zone is named frontdoor_zone and that Frigate tracks person and package.

Run sudo loginctl enable-linger $USER.

The installer runs ffprobe against the RTSP URL you gave it and exits with ERROR: cannot read <rtsp-url> - is the stream running and reachable from this Pi? if it cannot read the stream. Confirm the feed is running and the URL is reachable from the Raspberry Pi 5.

The installer looks for a Docker container named frigate. Pass --container [NAME] to the install script, or set CONTAINER=[NAME] for the manual install.

Run docker restart frigate yourself, or rerun the installer with --yes. The new camera and model load only after the restart.

The installer places the listener and its virtual environment in ~/sixfab-apps/porch-pirate and points the unit file at your user and home directory. Check it with systemctl --user status porch-pirate-automation.service --no-pager -n 30, and confirm ~/sixfab-apps/porch-pirate/porch_watch.py exists.

The rule expects this when you were not in the porch zone as the package appeared, or when you left the frame and came back (a new track ID). See Limitations.

Next steps

See also

License and credits

The code is licensed under the MIT License. Each model file has its own license: people-and-cardboxes.dxnn is licensed under AGPL-3.0. The license and other details of every model are in the release notes at https://github.com/sixfab/sixfab-dx-frigate/releases/tag/porch-pirate-v1.0.0.