Farm security cameras are increasingly used to monitor entrances and detect intruders. While these systems improve safety, they also capture authorized workers and family members, raising privacy concerns. At AgriShield, we are exploring whether real-time, privacy-preserving computer vision can run entirely on edge hardware, like a Raspberry Pi, while maintaining performance and usability.
Imagine a farm where a single camera watches a barn entrance all day. Workers pass by dozens of times during routine tasks like feeding animals, moving equipment, or even just checking a gate. A traditional camera system records all of this footage continuously—even when nothing suspicious is happening. Identifiable videos of workers and owners are stored, reviewed, and transmitted, often without their own consent or comfort. Agrishield is designed to reduce unnecessary exposure while still keeping the camera useful for security purposes.
This blog entry highlights the current implementation, which focuses on face detection and anonymization. Identity recognition, alerting, and storage are planned for future work, but the existing system already demonstrates the feasibility of edge-based privacy protection.
System Overview
Our prototype pipeline is built to run on a Raspberry Pi 5 (8GB) using:
Camera input can come from any USB webcam or RTSP-compatible device (like TP-Link or Wyze cameras). The system is designed to run entirely locally, with no cloud dependency, ensuring fast, real-time processing and keeping sensitive video data on-device.
By running it all locally, the video never has to leave the farm. Nothing gets uploaded to the internet, there’s no remote server that stores the footage, and no third-party services analyzing the faces in the recordings. This reduces privacy risk and operational costs and improves reliability in rural areas with limited connectivity.
Live Video & Face Detection
The main loop continuously captures frames from the camera. Each frame undergoes:
MediaPipe outputs relative bounding boxes for detected faces, which are mapped back to the original frame resolution. Boxes are clamped to frame boundaries to prevent indexing errors. This setup ensures robust detection and smooth frame rates on resource-constrained hardware.
Privacy-Preserving Face Obfuscation
The heart of the system is the circular_blur function, which anonymizes detected faces while preserving natural-looking boundaries.
Instead of placing a black box over someone’s face, the system behaves more like frosted glass that is shaped exactly to the targeted face. You can tell when a person is in the frame and see their movements/posture, but you can’t recognize who the person specifically is.
The steps are:
This multi-layer approach produces an artifact-free, face-shaped anonymization in real time, even on a Raspberry Pi.
System Control & Visualization
The prototype provides interactive feedback for developers and demo purposes:
Seeing the system working in real time allows validation of privacy’s consistent application, whether someone is close, far from, or partially visible to the camera. The setup allows real-time testing of detection and anonymization behavior, ensuring that privacy logic works consistently across different face sizes and positions.
What This Prototype Demonstrates
The prototype shows how cameras don’t have to be in an “all or nothing”-type of situation. The system can still monitor spaces while respecting the individuals who belong in the environment.
Even without identity recognition or alerting, the current system proves that privacy-preserving computer vision can work entirely on-device.
Next Steps
Future enhancements will build on this foundation:
The current prototype ensures a strong foundation for selective, GDPR-aligned privacy on the edge.
AgriShield demonstrates that privacy and security can coexist in farm surveillance, and that even a Raspberry Pi can deliver high-quality, real-time anonymization without cloud dependencies.
The Problem: Monitoring Farm Entry Without Surveillance This year at AI Sense, I had the opportunity to work on my...
Read More
Why Many AgTech Startups Fail… Even With Working Products ? Despite having functioning products, a lot of agricultural technology startups...
Read More
AI is reshaping the way we grow, harvest, and distribute food. From AI-driven supply chain management... AI is reshaping the...
Read More