Creating a Smart and Serverless Cat Detection System
Using Amazon Web Services!
Linda Nichols
@lynnaloo
Norfolk.js
norfolkjs.org
RevolutionVA
revolutionconf.com
hrdevfest.org
Let's Talk about Cat Detection Systems!
@lynnaloo
What is it?
@lynnaloo
A motion detector that sends an SMS message when a cat is nearby.
Components
@lynnaloo
-
Raspberry Pi 3
-
Raspberry Pi Camera
-
PIR Sensor
-
Power Source
-
Lead Wires
-
1 Kitty (optional)
Hardware
@lynnaloo
Software
@lynnaloo
-
Node.js
-
Johnny-Five
-
AWS IoT SDK
-
Raspicam
-
Node.js
-
Twilio
On the Raspberry Pi:
In the Cloud:
What's Johnny-Five?
@lynnaloo
Johnny-Five
@lynnaloo
Open-source JavaScript Robotics Platform
www.johnny-five.io
What is Amazon IoT?
@lynnaloo
It's a managed cloud platform that lets connected devices easily and securely interact with cloud applications and other devices.
- Amazon Web Services
What is Amazon IoT?
@lynnaloo
What is Amazon IoT?
@lynnaloo
It's a pub/sub system for devices.
- Linda
What is Amazon IoT?
@lynnaloo
-
Supports billions of devices
-
Supports trillions of messages
-
Inexpensive
-
Reliable
-
Secure
-
Super-fast
@lynnaloo
Trillions of cat detections
How Does It Work?
@lynnaloo
-
Major components are the device gateway and rules engine.
-
A message broker provides a pub/sub via MQTT protocol.
-
The rules engine filters and routes messages to other services.
How Does It Work?
@lynnaloo
But I thought this was "serverless"...
@lynnaloo
Disclaimer:
"Serverless" is just a catchy, made-up, marketing term.
@lynnaloo
Serverless Architecture
It's about the events!
@lynnaloo
Serverless Architecture
Events from IoT (and other services) can trigger Serverless Functions
@lynnaloo
Serverless Functions (FaaS).
@lynnaloo
Stateless functions running in containers managed by a service provider (not you!).
AWS Lambda
-
Very Inexpensive
-
Easy Deployments
-
Scalable
-
Supports Many Runtimes
@lynnaloo
Lambda Handler
@lynnaloo
'use strict';
const catNames = require('cat-names');
const AmazonDb = require('amazon-db-module');
function getCatName(event, context, callback) {
const amazonDb = new AmazonDb();
const catName = catNames.random();
amazonDb.update(catName);
callback(null, { payload: `Your cat name is ${catName}.` });
}
module.exports.getCatName;
But what makes the cat detector... smart?
@lynnaloo
Amazon Rekognition
@lynnaloo
Features
-
Object and Scene Detection
-
Image Moderation
-
Facial Recognition
-
Face Comparison
-
Celebrity Recognition
Amazon Rekognition
@lynnaloo
Amazon Rekognition service uses deep learning algorithms to analyze images for scenes, objects, faces, and other content.
Visual Recognition knows if a cat is in an image.
Amazon Rekognition
@lynnaloo
[
{ Name: 'Animal', Confidence: 98.29473114013672 },
{ Name: 'Cat', Confidence: 97.9908218383789 },
{ Name: 'Adorable', Confidence: 97.9908218383789 },
{ Name: 'Feline', Confidence: 96.9802474975586 },
{ Name: 'Domestic Cat', Confidence: 64.9802474975586 },
{ Name: 'Mammal', Confidence: 64.9908218383789 },
{ Name: 'Manx', Confidence: 64.9908218383789 },
{ Name: 'Pet', Confidence: 64.9908218383789 }
]
The Code
@lynnaloo
Hardware/IoT Platform Code: github.com/lynnaloo/kitty-detector
AWS Lambda Functions: github.com/lynnaloo/go-away-kitty
Demo Time!
@lynnaloo
Thank You!
@lynnaloo
Creating a Smart and Serverless Cat Detection System
By Linda Nichols
Creating a Smart and Serverless Cat Detection System
All Things Open 2017 - Creating a Smart and Serverless Cat Detection System
- 1,949