Skip to content
Personal Protective Equipment detection demo showed at AWS re:Inforce 2019: source code and materials.
Python Shell TSQL
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

AWS re:Inforce 2019 PPE Detection Demo

The purpose of Personal Protective Equipment (PPE) is to prevent injuries in the workplace, protect the wearer's body, and reduce exposure to different hazards, such as physical, electrical, chemical, and others. While the usage of such protective gear is essential and legally required in many industry sectors, it is common to see workers forgetting or neglecting the use of PPE.


This demo was presented in the re:Inforce 2019 Builders Fair and contains a prototype approach using several AWS services to help prevent accidents in the workplace.


To get started you will need:

  • The AWS CLI tool installed on your local machine.
  • Python 3.7 with boto3 and python-opencv libraries installed on your local machine:
    pip install -r requirements.txt
  • A Raspberry Pi with the omxplayer package installed.
  • Tested in the N. Virginia region (us-east-1).

1. Installation

1.1 Create resources on your AWS account

  1. Download the .zip or clone this repo on your machine.

  2. Make sure you have a user with programmatic access and have configured the access key ID and secret access key.

  3. Enter the deploy directory and execute ./ create. When asked, set the email address and alarm message (this process will take about 5 minutes to complete, please wait it to finish before proceeding):

    cd deploy
    ./ create

1.2 Configure your Raspberry Pi

Now that you have created the AWS resources in the previous step, you need to upload the certificates and source files to your Raspberry Pi.

  1. On the AWS console, go to yours Things page on the AWS IoT Core service and click on the IoT Thing named ppe-raspberry-<your_account_id>.

  2. In the left menu, click on Interact, then on Connect a device, and follow the steps to download the connection kit for Linux/OSX and Python SDK.

  3. Upload the connection kit .zip and the files from the src/iot directory. For example, using scp:

    scp pi@<your_iot_device_ip>:~
    scp src/iot/ pi@<your_iot_device_ip>:~
    scp src/iot/not_protected.ogg pi@<your_iot_device_ip>:~
  4. Login to your Raspberry Pi, unzip the connection kit and modify the to run the demo:

    sed -i 's#python install#python install --user#g'
    sed -i 's#aws-iot-device-sdk-python/samples/basicPubSub/'
    chmod +x

2. Running

  1. Make sure the ./ script is still running in your Raspberry Pi.

  2. Execute the src/ in your machine.

    python src/

3. Optional

The src/athena directory contains source files to make queries in Amazon Athena and create dashboards with Amazon QuickSight. Make sure you change the <your_data_bucket> present in src/athena/table.sql.


4. Clean up

You can remove the AWS resources created for this demo by running ./deploy delete.

License Summary

This sample code is made available under the MIT-0 license. See the LICENSE file.

You can’t perform that action at this time.