Inspiration: The Problem with "Always-On" AI

In industrial environments like manufacturing plants and power grids, rotating machinery must run 24/7. When equipment fails unexpectedly, it costs millions in downtime. To monitor this, factories install cameras—but streaming high-resolution video of normally operating machinery to the cloud 24/7 is a massive waste of bandwidth and AWS compute resources.

Standard AI pipelines process every single frame equally. But human inspectors don’t work that way. We glance at a machine, and if something looks slightly off, we lean in and stare closely. We wanted to build an AI that behaves exactly like that.

What it does

EdgeGuard Vision is an adaptive, Agentic Vision system for industrial predictive maintenance. It abandons the static "process every frame" pipeline in favor of a dynamic perception-decision-action loop:

  1. The "Glance" (Coarse Scan): The agent monitors machinery at a 50% resolution scale and skipped framerate. This requires minimal edge compute power.
  2. The "Decision": It calculates the temporal variance of motion magnitude using OpenCV 5 Farneback dense optical flow. $$ \sigma^2 = \frac{1}{N} \sum_{i=1}^{N} (x_i - \mu)^2 $$ (Where \(x_i\) is the average flow magnitude between frames)
  3. The "Lean In" (Adaptive Action): If the variance exceeds a stable threshold (e.g., a motor stuttering), the agent dynamically changes its own parameters. It extracts the exact Region of Interest (ROI) using contour detection, and re-analyzes only that specific component at 100% resolution and maximum framerate to verify the fault.
  4. Camera-Aware Safety: It actively calculates global motion to distinguish a broken machine from a camera vibrating on a factory wall, returning an "Uncertain/Review Required" state rather than a false positive.

How we built it

  • The Vision Engine: Built entirely on OpenCV 5 (pinned to 5.0.0.93). We utilized cv2.calcOpticalFlowFarneback, frame differencing, and contour detection to drive the agent's mathematical decision policy.
  • The Agentic Logic: Written in pure Python, avoiding slow LLM integrations in favor of a deterministic, lightning-fast state machine that logs an auditable trace of every parameter change.
  • The Backend: A FastAPI REST architecture handling file buffering, state management, and SQLite persistence for inspection history.
  • The Frontend Dashboard: A premium, responsive Network Operations Center (NOC) dashboard built from scratch with Vanilla HTML/CSS/JS and CSS Grid. The dynamic motion timeline charts were written natively using the HTML5 <canvas> API to avoid heavy third-party CDN dependencies.
  • The Cloud: Containerized via Docker and architected for deployment on AWS ECS, allowing the edge to handle the coarse scan and pushing to AWS only for detailed verifications.
  • Synthetic Evaluation Lab: Because real industrial fault footage is proprietary, we wrote an OpenCV drawing script to generate deterministic test fixtures (e.g., stuttering gears, camera shake) to scientifically evaluate the agent's accuracy.

Challenges we ran into

  • Defining "Agentic Vision": The biggest challenge was moving past a simple "chatbot that explains an image." We had to engineer a system where visual data literally altered the code's next execution step (changing spatial mapping, resolution, and temporal sampling on the fly).
  • OpenCV 5 Dependencies: Resolving strict dependency conflicts between the bleeding-edge OpenCV 5 headless packages and the newly released NumPy 2.x architecture required careful environment pinning.
  • SPA Canvas State: Managing HTML5 Canvas redraws during Single-Page Application (SPA) tab switching required building a custom frontend state manager to persist chart data memory.

Accomplishments that we're proud of

  • Successfully building a true Agentic Vision Loop powered purely by visual mathematics.
  • Achieving a highly polished, enterprise-grade NOC dashboard layout without relying on React or massive frontend frameworks.
  • Implementing the "Global Trace Log," which creates complete transparency for maintenance engineers by showing exactly why the AI escalated an inspection.

What we learned

We deepened our understanding of optical flow algorithms, the nuances of HTML5 canvas charting, and the immense value of Edge-to-Cloud architectures. By pushing the "heavy lifting" to the cloud only when the edge agent decides it's necessary, we learned how to architect computer vision systems that are economically viable at scale.

What's next for EdgeGuard Vision

  1. AWS Greengrass Integration: Deploying the coarse-scan agent natively onto IoT edge devices (like a Raspberry Pi 4), while reserving AWS ECS instances solely for the high-res detailed verification scans.
  2. COOL Optimization: Implementing the Cloud-Optimized OpenCV Library (COOL) on AWS Graviton to further accelerate the detailed ROI scans.
  3. Thermal Modalities: Expanding the agent to trigger detailed thermal analyses if visual optical flow detects friction-based anomalies.

Built With

Share this project:

Updates

Submission history