Meraki Facemask Detector

Description

This project integrates Meraki MV Cameras with Amazon Rekognition through their APIs to perform a deeper image analysis, to detect whether a person is wearing a facemask or not. The results will be posted into a Webex Teams space.

Workflow

The workflow will be the following:

Alt text

Before start: What do you need

  1. Access to a Meraki Dashboard (and its API key) with an MV Camera and MV Sense license available.

  2. An AWS Account, with an access and secret key created (Instructions on how to generate them)

  3. A Webex account. You will need it to create a Bot and grab its Access Token. You'll find instructions on how to do it here.

  4. An MQTT broker reachable by the MV Camera. It can be configured on your laptop, or a separate server. In my case, I used a Raspberry Pi 3b+ with a Debian image, and I installed Mosquitto, an open source MQTT Broker.

Usage

  1. Clone this repo in your local machine typing on your terminal:

https://github.com/agmanuelian/Meraki_Facemask_Detector.git

  1. Install the required dependencies specified on the requirements.txt file:

pip3 install requirements.txt

  1. Set up your MQTT Broker, and configure it on the Meraki Dashboard

    1. Select your MV Camera
    2. Go to Settings
    3. Select Sense
    4. Enable your MV Sense license
    5. Select Add or edit MQTT Brokers and configure its parameters.
    6. After you added your broker, select it on the dropdown list.
    7. Save your changes.
  2. Configure your credentials on the lambda_module/main.py file.

  3. On you AWS account, set up your Lambda Function. When it's time to upload your code, zip the lambda_module directory, and upload the .zip file.

Lambda Setup - Step 1

Lambda Setup - Step 1

After you do this, increase the execution time up to 15 seconds, under the Configuration tab.

Lambda Setup - Step 2

Lambda Setup - Step 2

  1. On you AWS account, set up your API Gateway. Once deployed, grab its public address. You will need it on the next step.

API Gateway Setup - Step 1

API Gateway Setup - Step 1

API Gatewat Setup - Step 2

API Gateway Setup - Step 1

  1. Replace your credentials on the mqtt_trigger.py file. The API URL that you got on the previous step, should be added to the script on this step.

  2. Add your recently created bot to a Webex room. The bot access token and the Room ID should be already configured on the lambda_module/main.py file.

  3. Run the mqtt_trigger.py script. You should see displayed on the terminal a real time feed of the detected people quantity. When a person gets in front of the camera, it will trigger the API call and process the function. The results will be posted on the Webex room.

Output

These are the results of the image analysis posted into a Webex Room.

Results posted in a Webex Room

Links to DevNet Learning Labs

Meraki Learning Lab

Related Sandbox

Meraki Always On Sandbox
Meraki Enterprise Sandbox

View code on GitHub

Code Exchange Community

Get help, share code, and collaborate with other developers in the Code Exchange community.View Community
Disclaimer:
Cisco provides Code Exchange for convenience and informational purposes only, with no support of any kind. This page contains information and links from third-party websites that are governed by their own separate terms. Reference to a project or contributor on this page does not imply any affiliation with or endorsement by Cisco.