BUILDING A SMART
SECURITY CAMERA
WITH RASPBERRY
PI ZERO AND AWS
@markawest
Who Am I?
• Manager Bouvet Data Science.
• Hacker and Maker.
• Leader Norwegian JUG (javaBin).
@markawest
Initial Motivation
@markawest
Project Requirements
Functional
• Monitor activity in the
garden.
• Send warning when activity
detected.
• Live video stream.
Non-functional
• In place as soon as possible.
• Low cost.
• Portable.
@markawest
Result : Simple Web Camera
• Hardware based on Raspberry
Pi Zero W.
• Uses Motion Software to detect
movement in a video stream.
• Movement triggers Email Alerts
containing snapshots from
video feed.
@markawest
How the Motion Software works
1 2 3 4
@markawest
1 2 3
How the Motion Software works
1 2 3 4
1 2 3
@markawest
1 2 3
How the Motion Software works
1 2 3 4
1 2 3
@markawest
1 2 3
Motion
Streaming
Demo
@markawest
Example
Alert Email
1 2
1
@markawest
Alarm Snapshots from Web Camera
@markawest
False Alarms from Web Camera
cat
cloud
@markawest
The Motion Software
focuses on the amount of
changed pixels, and not the
cause of the changed
pixels!
@markawest
Removing False Alarms with
Smart Image Analysis
person
@markawest
cat
Project Requirements Reloaded
Functional
• Monitor activity in the
garden.
• Send warning when activity
detected.
• Live video stream.
Non-functional
• In place as soon as possible.
• Low cost.
• Portable.
@markawest
Project Requirements Reloaded
Functional
• Monitor activity in the
garden.
• Send warning when human
activity detected.
• Live video stream.
Non-functional
• In place as soon as possible.
• Low cost.
• Portable.
@markawest
Finding an Image Analysis Solution
OpenCV
• Use Face Detection to find out if
a human was in the snapshot.
• Problem: What if the subject
was facing away from the
camera, or wearing a mask?
TensorFlow
• Train and use a Neural Network
to find humans in the snapshot.
• Problem: Potentially a fun
project, but would take more
time than I had available.
@markawest
Amazon Rekognition
• Part of Amazon Web Services suite of Cloud based services.
• Image Analysis as a Service, offering a range of API’s.
• Built upon Deep Neural Networks.
• Launched in November 2016.
@markawest
AWS Rekognition Demo
@markawest
Delegating Image Processing
Amazon Web Services (AWS)
Send Email Alert
if snapshot
contains a person
Analyse snapshot
from Motion
Software
@markawest
Why use AWS as a Data Pipeline?
• Serverless.
• Highly scalable.
• Highly available.
• Separation of concerns.
• Pay as you go model, with a generous free tier.
@markawest
AWS
Rekognition
AWS Simple
Email Service
AWS s3
(storage)
Amazon Web Service Flow
Overview
AWS Step Function
(workflow)
Upload
Trigger
1
2
4
5
6
calls
3
uses
uses
@markawest
Step Function for Image Processing
Error
Handler
(sends
Error
Email via
AWS
SES)
Sends snapshot to AWS Rekognition
Evaluate AWS Rekognition response
Send Alert Email?
Send Alert Email
via AWS SES
Archive image in AWS S3
1
2
3
4
5
6 1
2
3
4
5
6
@markawest
Smart Camera
(and AWS Step Function)
Demo
@markawest
Project Requirements : Evaluation
Functional
• Monitor activity in the
garden.
• Send warning when human
activity detected.
• Live video stream.
Non-functional
• In place as soon as possible.
• Low cost.
• Portable.
@markawest
“Fun project, but has it
caught any real criminals?”
@markawest
Key Takeaways
• «AIaaS» can give faster Time to Market.
• Test «AIaaS» solutions before committing.
• Overlap between vendors.
• Beware vendor lock-in.
• Don’t forget infrastructure (Data Engineering)!
@markawest
Would you like to know more?
github.com/markwest1972/
smart-security-camera
@markawest
Code & Instructions for replicating project
Links to Blog Entries describing project
The Heisencat by Jon Rohan
THANKS FOR
LISTENING!
@markawest
Kraków, 17-19 May 2017

Make Data Smart Again 2018 - Building a Smart Security Camera with Raspberry Pi Zero and AWS

  • 1.
    BUILDING A SMART SECURITYCAMERA WITH RASPBERRY PI ZERO AND AWS @markawest
  • 2.
    Who Am I? •Manager Bouvet Data Science. • Hacker and Maker. • Leader Norwegian JUG (javaBin). @markawest
  • 3.
  • 4.
    Project Requirements Functional • Monitoractivity in the garden. • Send warning when activity detected. • Live video stream. Non-functional • In place as soon as possible. • Low cost. • Portable. @markawest
  • 5.
    Result : SimpleWeb Camera • Hardware based on Raspberry Pi Zero W. • Uses Motion Software to detect movement in a video stream. • Movement triggers Email Alerts containing snapshots from video feed. @markawest
  • 6.
    How the MotionSoftware works 1 2 3 4 @markawest 1 2 3
  • 7.
    How the MotionSoftware works 1 2 3 4 1 2 3 @markawest 1 2 3
  • 8.
    How the MotionSoftware works 1 2 3 4 1 2 3 @markawest 1 2 3
  • 9.
  • 10.
  • 11.
    Alarm Snapshots fromWeb Camera @markawest
  • 12.
    False Alarms fromWeb Camera cat cloud @markawest
  • 13.
    The Motion Software focuseson the amount of changed pixels, and not the cause of the changed pixels! @markawest
  • 14.
    Removing False Alarmswith Smart Image Analysis person @markawest cat
  • 15.
    Project Requirements Reloaded Functional •Monitor activity in the garden. • Send warning when activity detected. • Live video stream. Non-functional • In place as soon as possible. • Low cost. • Portable. @markawest
  • 16.
    Project Requirements Reloaded Functional •Monitor activity in the garden. • Send warning when human activity detected. • Live video stream. Non-functional • In place as soon as possible. • Low cost. • Portable. @markawest
  • 17.
    Finding an ImageAnalysis Solution OpenCV • Use Face Detection to find out if a human was in the snapshot. • Problem: What if the subject was facing away from the camera, or wearing a mask? TensorFlow • Train and use a Neural Network to find humans in the snapshot. • Problem: Potentially a fun project, but would take more time than I had available. @markawest
  • 18.
    Amazon Rekognition • Partof Amazon Web Services suite of Cloud based services. • Image Analysis as a Service, offering a range of API’s. • Built upon Deep Neural Networks. • Launched in November 2016. @markawest
  • 19.
  • 20.
    Delegating Image Processing AmazonWeb Services (AWS) Send Email Alert if snapshot contains a person Analyse snapshot from Motion Software @markawest
  • 21.
    Why use AWSas a Data Pipeline? • Serverless. • Highly scalable. • Highly available. • Separation of concerns. • Pay as you go model, with a generous free tier. @markawest
  • 22.
    AWS Rekognition AWS Simple Email Service AWSs3 (storage) Amazon Web Service Flow Overview AWS Step Function (workflow) Upload Trigger 1 2 4 5 6 calls 3 uses uses @markawest
  • 23.
    Step Function forImage Processing Error Handler (sends Error Email via AWS SES) Sends snapshot to AWS Rekognition Evaluate AWS Rekognition response Send Alert Email? Send Alert Email via AWS SES Archive image in AWS S3 1 2 3 4 5 6 1 2 3 4 5 6 @markawest
  • 24.
    Smart Camera (and AWSStep Function) Demo @markawest
  • 25.
    Project Requirements :Evaluation Functional • Monitor activity in the garden. • Send warning when human activity detected. • Live video stream. Non-functional • In place as soon as possible. • Low cost. • Portable. @markawest
  • 26.
    “Fun project, buthas it caught any real criminals?” @markawest
  • 27.
    Key Takeaways • «AIaaS»can give faster Time to Market. • Test «AIaaS» solutions before committing. • Overlap between vendors. • Beware vendor lock-in. • Don’t forget infrastructure (Data Engineering)! @markawest
  • 28.
    Would you liketo know more? github.com/markwest1972/ smart-security-camera @markawest Code & Instructions for replicating project Links to Blog Entries describing project The Heisencat by Jon Rohan
  • 29.