When designing real-time surveillance systems for high-risk security environments, traditional cloud-based logging presents two major issues: latency delays over weak networks and the vulnerability of databases that can be tampered with or deleted by intruders.
To solve this, I designed and built an edge-AI automated surveillance pipeline that detects local threats and processes video frames at the edge using TensorFlow Lite on a Raspberry Pi 4B and automatically records tamper-proof attack logs directly to the Ethereum Sepolia Testnet using Web3.py.
Here is a breakdown of how the system was built, deployed, and tested.
The Architecture
The system consists of three main components working together:
Edge Inference Engine (AI/IoT): OpenCV and TensorFlow Lite processing live camera frames directly on a Raspberry Pi 4B.
Web Monitoring Dashboard: A real-time web interface built with HTML/JS and hosted on Render.
Immutable Audit Layer (Blockchain): A Solidity smart contract deployed on the Ethereum Sepolia Testnet to store tamper-proof logs.
The Edge AI Engine
Training heavy deep learning models locally isn't feasible for low-power edge hardware.
Training: I trained a CNN model, 3D Convolutional AutoEncoder (3DCAE) on Kaggle using custom dataset augmentation (data_gen.py) for low-light surveillance conditions.
Optimization: The model was then converted to .tflite format, enabling the Raspberry Pi to perform periodic frame checks with a 3–4 second detection latency ideal for monitoring slow-moving physical threats.
Making Logs Tamper-Proof (Web3 Integration)
If a physical security breach occurs, standard database records can easily be wiped or modified by an attacker with local access.
To prevent this:
Whenever the CNN classifies a frame as an "Anomaly", the system automatically triggers a Web3.py script.
The script calls the logAnomaly function on my smart contract deployed at 0x279FcACc1eB244BBD7Be138D34F3f562Da179dd5.
The timestamp, frame index, and device ID are recorded permanently on-chain—creating a verified, unerasable audit log that anyone can inspect via Sepolia Etherscan.
Lessons Learned & Future Improvements
Building this system proved that integrating decentralized ledgers with edge AI is practical for high-security environments, but it comes with trade-offs:
Latency vs. Speed: Balancing edge CPU memory limits with AI accuracy (achieved ~80% accuracy).
Next Steps: Optimizing models further for Jetson Nano hardware and adding automated Twilio SMS emergency alerts for security teams.
Project Links & Resources
- GitHub Repository: https://github.com/Boss-Bobs/Bandit-Detection-System-AI-Blockchain
- Smart Contract on Etherscan: https://sepolia.etherscan.io/address/0x279FcACc1eB244BBD7Be138D34F3f562Da179dd5
Top comments (0)