UPDATED:1/29/2026
PLANNING:
- Single authoritative storage path selection logic
- Unified logging configuration (paths, rotation, verbosity)
- Consistent directory layout for all artifacts
- Systemd units with explicit mount dependencies and sandboxing rules
Event-Driven Camera + Offline Vision Pipelines + Hardening
AICAM is a set of Raspberry Pi camera pipelines designed around a small number of strict principles:
- Offline-first — no cloud dependency or required network access
- Event-first — state transitions are first-class artifacts, not log noise
- Deterministic outputs — version stamps, hashes, and reproducible behavior where applicable
- One camera owner at a time — no parallel Picamera2 / libcamera access
This repository contains:
- Baseline
rpicam-*recorders (stills, test clips, continuous segmented recording) - Picamera2-based AI pipelines (MobileNet-SSD legacy; YOLO ONNX is the forward path)
- Evidence-oriented event logging and artifact generation
- Guides covering:
- camera tuning
- encrypted storage and outbox workflows
- receiver ingest and verification
- training and tuning notes (especially for drone detection)
The project is not a single monolithic application. It is a collection of cooperating pipelines that share architectural rules.
These scripts rely on the native rpicam-* tools and are primarily used for
hardware validation, storage testing, and simple capture workflows.
-
1_rpiCAMStill.py
Single still image capture viarpicam-still. -
2_rpiVIDTest.py
Short test video capture viarpicam-vid. -
3_rpiVIDSec.py
Continuous segmented recording (10-minute clips) with a disk free-space guard. This script establishes the canonical mount + fallback behavior used as a reference. -
4_rpiCAMStill.sh
Shell wrapper for still capture. -
5_rpiVIDTest.sh
Shell wrapper for test video capture. -
6_rpiVIDSec.sh
Shell wrapper for segmented security recording.
These pipelines perform on-device inference using Picamera2 and OpenCV.
-
7_AICAM_Still.py
Still capture + MobileNet-SSD (Caffe) inference, annotated output, and a single-line event record. -
8_AICAM_VIDSec.py
Continuous video recording with MobileNet-SSD inference and explicitHUMAN_ENTER/HUMAN_EXITstate transitions. -
9_AICAM_Humans.py
Human detection pipeline; usage and tuning details are documented in the file header.
These scripts represent the legacy AI path and remain for validation and comparison.
YOLO ONNX pipelines represent the current and future direction of the project. They emphasize stronger event semantics, clearer evidence artifacts, and more explicit logging behavior.
-
_14.5_AICAM_Drones_YoloOnnx.py
YOLO ONNX drone detection pipeline with:- confirmation windows
- rotating operational logs
- annotated and raw clip output
-
_15.2_AICAM_Intrusion.py
“IntrusionCam” pipeline using YOLO ONNX. This script is intentionally minimal and keeps key paths hard-coded near the top to make system behavior explicit during planning and testing.
Architecture and operational guides:
_ARCHITECTURE.md_CAMERA_SETTINGS_GUIDE.md_CAMERA_ENCRYPTION_OUTBOX_GUIDE*.md_SECURE_CAMERA_RECEIVER_SYNC.md_RECEIVER_VERIFICATION_INGEST_GUIDE.md
Training and tuning material:
_14.*drone training documents_DRONE_TUNING_Legacy.md
Only one camera pipeline may run at any given time.
Violating this constraint typically results in:
pipeline handler in use by another process- intermittent capture failures
- libcamera resource contention
Operational rule:
- Start one service or script
- Allow it to fully own the camera
- Stop it cleanly before starting another
This applies equally to rpicam-* tools and Picamera2 pipelines.
- Raspberry Pi OS with the libcamera stack
rpicam-stillandrpicam-vidavailable inPATH
Install using apt (preferred for ABI compatibility on Raspberry Pi):
sudo apt update
sudo apt install -y python3-picamera2 python3-opencv ffmpegNotes:
- Avoid mixing pip-installed OpenCV with apt-installed Picamera2.
- Headless operation is supported; preview modes require an active desktop session.
Most services follow this intent:
- Preferred output: external storage mounted at
/media/user/disk - Fallback output: a user-writable path under the home directory
Mount detection is performed at runtime. If the external disk is not mounted, services continue operating using fallback paths.
Important notes:
- Some scripts intentionally create directories only after confirming mount state.
- Other scripts predate this rule and may be updated later.
- Placeholder paths (e.g.
/home/usr/...) reflect in-progress normalization.
This variation is intentional during the planning and stabilization phase.
Logging is deliberately split by purpose:
- Runtime status, warnings, debug output
- May rotate
- May be written to files or system logs depending on the script
- Append-only records of semantic events
- Examples:
HUMAN_ENTER,HUMAN_EXIT - Often written as:
events.log(human-readable)events.jsonl(machine-parseable)
Event logs are treated as evidence artifacts, not transient debug output.
Logging consolidation is planned but not yet enforced across all services.
python3 1_rpiCAMStill.py
python3 2_rpiVIDTest.py
python3 3_rpiVIDSec.pyYOLO pipelines include extensive CLI flags; consult file headers before running.
This repository reflects an active planning and validation phase.
- Behavior is prioritized over uniformity
- Duplication is tolerated to surface hidden assumptions
- Consolidation will occur only after storage, logging, and failure policies are finalized
Differences between scripts document the evolution of the system rather than mistakes.
When policy decisions are finalized, the following will be addressed:
- Single authoritative storage path selection logic
- Unified logging configuration (paths, rotation, verbosity)
- Consistent directory layout for all artifacts
- Systemd units with explicit mount dependencies and sandboxing.
In addition to shell-based operation, this project supports Python-based workflows.
Python usage is intended to run inside an isolated virtual environment (venv) to
preserve dependency integrity and reduce host impact. Operational details, including
example commands and environment setup, are documented in OPERATIONS.md.
Refer to OPERATIONS.md for authoritative, step-by-step execution guidance.

