Edge-deployed parking space detection and monitoring service using YOLOv11m models optimized for vehicle detection.
oaParkingMonitor is a specialized parking detection service designed for edge deployment on Mac Mini devices. It provides real-time vehicle detection, parking space monitoring, and cloud integration for parking analytics.
- Real-time Detection: YOLOv11m model with CoreML optimization for M1/M2 processors
- Snapshot Architecture: 5-second interval processing for optimal performance
- Network Optimized: Compression, caching, and delta updates for bandwidth efficiency
- Cloud Integration: AWS batch upload with retry logic and confirmation tracking
- Edge Optimized: <4GB memory footprint, minimal CPU impact on detection
- Detector: MVPParkingDetector with temporal smoothing and multi-scale detection
- API Service: FastAPI with network optimizations and comprehensive endpoints
- Storage: Edge storage with hierarchical snapshot organization
- Upload Service: AWS integration with batch processing and retry logic
Core Operations:
GET /health- Service health check with upload statusGET /detection- Current parking state (real-time snapshot)GET /detections- Historical detection batch retrievalGET /config- System configurationPOST /config- Configuration updates
Debug & Monitoring:
GET /snapshot- Processed image with detection overlaysGET /frame- Raw camera frameGET /camera/status- Camera hardware statusGET /upload/status- AWS upload service statistics
Network Optimizations:
GET /detection/changes?since=<epoch>- Delta updates for bandwidth efficiency- Quality parameters:
?quality=10-100for image endpoints - Automatic gzip compression for JSON responses
- HTTP caching with ETag support
- Hardware: Mac Mini M1/M2 with camera
- OS: macOS with launchd service management
- Python: 3.12+ with uv package manager
- Network: Tailscale connectivity for remote management
Deployed via oaAnsible automation:
# From oaAnsible directory
./scripts/run projects/yhu/preprod -t parking-monitor- Environment: Configure via
.envfile - Zones: Define parking spaces in
config/mvp.yaml - Camera: Auto-detected hardware camera (source: "0")
- AWS: Configure upload credentials for cloud integration
- Processing: <2 seconds per snapshot
- Interval: 5-second snapshots (configurable)
- Accuracy: Multi-scale detection with temporal smoothing
- Memory: <4GB total footprint
- Compression: 60-70% payload reduction for JSON responses
- Delta Updates: 85-99% bandwidth savings for frequent polling
- Image Quality: Configurable 10-100 quality for bandwidth optimization
- Caching: 5-10x faster response times for repeated requests
# Check service status
launchctl list com.orangead.parking-monitor
# View logs
tail -f /tmp/oaParkingMonitor.{out,err}
# API health check
curl http://localhost:9091/health# Detection statistics
curl http://localhost:9091/detection
# Upload service status
curl http://localhost:9091/upload/status
# Camera hardware status
curl http://localhost:9091/camera/statusoaParkingMonitor/
├── src/ # Source code
│ ├── api/ # API models and types
│ ├── config/ # Configuration management
│ ├── detector.py # Core detection engine
│ ├── main.py # FastAPI application
│ ├── middleware/ # HTTP middleware (compression, caching)
│ ├── models/ # Data models
│ ├── services/ # Business logic services
│ ├── tracking/ # Change tracking and analytics
│ └── utils/ # Utilities and helpers
├── config/ # Configuration files
│ └── mvp.yaml # Parking zone definitions
├── templates/ # HTML templates for dashboard
├── .env # Environment configuration
└── pyproject.toml # Python dependencies
# Install dependencies
uv sync
# Run service
uv run python -m src.main
# Test endpoints
curl http://localhost:9091/health
curl http://localhost:9091/detection# Transfer updates to device
scp -r src/ admin@device:~/orangead/oaParkingMonitor/
# Restart service
ssh admin@device "launchctl unload ~/Library/LaunchAgents/com.orangead.parking-monitor.plist"
ssh admin@device "launchctl load ~/Library/LaunchAgents/com.orangead.parking-monitor.plist"
# Validate
ssh admin@device "curl http://localhost:9091/health"- Automatic gzip compression for JSON responses >512 bytes
- 60-70% bandwidth reduction for typical API responses
- Edge-optimized compression level 6 for CPU efficiency
- Image quality parameters:
?quality=10-100 - Bandwidth savings: 85% at quality=10, 30% at quality=75
- Backward compatible (default quality=95)
/detection/changes?since=<timestamp>for incremental updates- 85-99% bandwidth reduction for frequent polling clients
- 10-minute rolling change history
- HTTP caching with ETag support for conditional requests
- 304 Not Modified responses for unchanged data
- 5-10x faster response times for cached endpoints
- Edge Push: Automatic batch uploads every 60 seconds
- Cloud Pull: Historical data retrieval via
/detectionsendpoint - Confirmation: Cloud confirms receipt via
/detections/confirm - Retry Logic: Exponential backoff for failed uploads
- Real-time WebSocket updates (planned)
- Prometheus metrics export (planned)
- Alert integration via health endpoints
Licensed under the terms specified in LICENSE file.