Track coffee consumption

In this recipe, we’ll show you how to build a simple face detection application that counts the number of cups of coffee that people drink and displays the tally on a leaderboard.

We will go through the following steps:

  • Step 1: Deploy a sample project
  • Step 2: Change the inference AWS Lambda function
  • Step 3: Create a coffee detection backend
  • Step 4: Deploy the app to AWS Elastic Beanstalk


For this tutorial you will need to know how to:

Please revisit these sections if you are not familiar with the steps.

Skills required

  • Basic coding skills
  • Familiarity with the command line interface


  • 2 hrs

Project Overview

Let’s review the following architectural diagram for the project. The AWS DeepLens device enables you to run deep learning on the edge. It detects a scene and runs it against a face detection model.

When the model detects a face, it uploads a frame to Amazon S3. An AWS Lambda function then runs the frame against AWS Rekognition to detect a mug in the scene and check if a face has been detected before or if is it a new face. After a face is registered or recognized, it’s stored in Amazon DynamoDB, which is used as an incremental counter for a web application.

Following this post, you’ll be able to replicate the architecture and get the necessary information to build an application like this.