A client asked me to create a real-time backup system for their CCTV feed. Not only that, they also want the system to detect the names of known persons and cats.;p>
Infrastructure and Tools
- Local Processing Unit: I used a Raspberry Pi as the local processing unit to capture video feeds from CCTV cameras. This lightweight and cost-effective solution was ideal for initial video processing at the edge.
- Video Segmentation: Using FFmpeg, I configured the Raspberry Pi to segment the video feeds into 1-minute chunks. This ensured manageable file sizes and facilitated real-time processing.
-
Object Detection and Identification:
- MobileNet SSD Model: I integrated a pre-trained MobileNet SSD model for object detection, which was capable of identifying various objects, including persons, cars, and cats.
- Face Recognition: For recognizing known human faces, I used the face_recognition library. This allowed the system to accurately identify specific individuals.
- Custom Cat Recognition: Implemented custom template matching for identifying specific cats by name.
- Asynchronous Messaging: To handle the flow of data between the Raspberry Pi and cloud services, I set up Google Pub/Sub. This allowed for reliable and asynchronous communication, ensuring that data was processed in real-time without bottlenecks.
- Serverless Processing: I developed Google Cloud Functions to subscribe to the Pub/Sub topic and process the video segments and metadata. These functions handled the uploading of processed data to Google Cloud Storage, leveraging the scalability of serverless architecture.
-
Data Processing Pipeline:
- Apache Beam: I designed a data processing pipeline using Apache Beam, which was deployed on Google Cloud Dataflow. This pipeline read enriched metadata from Pub/Sub, transformed it, and wrote it to BigQuery for storage and analysis.
- BigQuery: The processed data was stored in BigQuery, allowing for efficient querying and analysis of the video metadata.
-
Monitoring and Logging:
- Google Cloud Monitoring: I integrated Google Cloud Monitoring to track custom metrics, such as the number of detected objects by type (humans, cars, cats). Custom metric descriptors were created, and counts were reported at the end of each processing bundle in the Dataflow pipeline.
- Detailed Logging: Implemented detailed logging within the Dataflow pipeline and Google Cloud Functions to capture significant events and errors, providing real-time insights into system operations.
Development
- Configured the Raspberry Pi and implemented video capture and segmentation using FFmpeg.
- Integrated and fine-tuned the MobileNet SSD model for object detection and developed the face recognition and cat recognition components.
- Set up Google Pub/Sub for asynchronous messaging and developed Cloud Functions for serverless processing.
- Built the data processing pipeline using Apache Beam and deployed it on Google Cloud Dataflow.
- Implemented logging and monitoring using Google Cloud Monitoring.