Hack Week May 2017 - AFK
For the week commencing 1st May I took part in a hack week at work. I’ve been working with Amazon Web Services both professionally and personally for the last two years or so, but I hadn’t had a great deal of experience outside of EC2 or S3. I chose to spend the week hacking with the lesser-known Amazon services.
One such service is Amazon Rekognition
, a
deep learning-based image recognition service. Rekognition has various features
such as Object and Scene Detection, Image Moderation and Face Comparison.
For my hack I chose only to utilise Face Comparison, and thus
afk
was born.
afk
is a simple Python program that detects when your have moved away from
your screen and locks your system. It works by using
imagesnap
, a command-line tool for
OS X that allows you to control video devices, such as web cams. afk
works
by taking a picture using your device’s default camera and using Rekognition to
determine if your face is in that picture. If it is, the process starts again;
if it isn’t, the screen will be locked and the program will exit.
afk
utilises Amazon’s Python SDK
Boto 3
to interact with the
rekognition API. As a result the amount of code I needed to write (28 lines) was
miniscule. The image comparison itself only required 12 lines of Python.
afk
is available on my GitHub
, feel
free to take a look and try it out for yourself and let me know what you think!