Object Detection & Text Analytics Made Simple using Docker, Apache Kafka, IoT & Amazon Rekognition System
Imagine you are able to capture live video streams, identify objects using deep learning, and then trigger actions or notifications based on the identified objects - all using Docker containers. With Pico, you will be able to setup and run a live video capture, analysis, and alerting solution prototype.
A camera surveils a particular area, streaming video over the network to a video capture client. The client samples video frames and sends them over to AWS, where they are analyzed and stored along with metadata. If certain objects are detected in the analyzed video frames, SMS alerts are sent out. Once a person receives an SMS alert, they will likely want to know what caused it. For that, sampled video frames can be monitored with low latency using a web-based user interface.
The Pico framework uses Kafka cluster to acquire data in real-time. Kafka is a message-based distributed publish-subscribe system, which has the advantages of high throughput and perfect fault-tolerant mechanism. The type of data source is the video that generated by the cameras attached to Raspberry Pi.
- Pico for AWS
- Pico for On-Premises(Using Swarm & Kubernetes)
Items | Link | Reference |
---|---|---|
Raspberry Pi 3 Model B | Buy | |
Raspberry Pi Infrared IR Night Vision Surveillance Camera Module 500W Webcam | Buy | |
5MP Raspberry Pi 3 Camera Module W/ HBV FFC Cable | Buy |
sudo docker run -it --privileged --device /dev/video0:/dev/video0 ajeetraina/pico-producer-rpi python3 producer_camera.py
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
81891d992daf ajeetraina/pico-producer-rpi "/usr/bin/entry.sh p…" 9 minutes ago Up 9 minutes jolly_dewdney
In order to run Kafka on AWS, you need t2.medium instances which doesn't fall under Free Tier. You will need to use your FREE credits or pay for its usage. Alternatively, for development purpose if you are not concerned about performance, you can use GCP instances.
I assume that you have Docker and Docker Compose installed on multiple Swarm Mode Cluster
git clone https://github.com/collabnix/pico
cd pico/kafka
docker stack deploy -c docker-compose.yml mykafka
That's it. Your AWS KAfka cluster is up and running on Docker Swarm Nodes.
To run the consumer script, we need to focus on two files:
- consumer.py and
- image_processor.py
Under the image_processor.py you need to add ACCESS KEY details of your AWS account and under consumer.py you need to add your correct kafka cluster IP.
Here you go..
Just place any object in front of camera module and it shall detect the object automatically with tagging about the object type.
This project was incubated by Ajeet Singh Raina Docker Captain & Docker Community Leader & Avinash Bendigeri(Data Science Engineer)
Stage I - Installing Docker on Raspberry Pi
Stage II - Turn Your Raspberry Pi into Night survillience Camera using Docker
Stage III - Deploy Apache Kafka on AWS Platform using Docker Swarm
Stage IV - Pushing the video frame from Raspberry Pi to Apache Kafka
Stage IV - - Preparing AWS Lambda Deployment Package in Python & Testing Kafka Connect AWS Lambda Connector