Twitter icon
Facebook icon
LinkedIn icon
Google icon
Reddit icon
StumbleUpon icon icon

MaskCam: A Jetson Nano AIoT Mask Detection Camera

Added to IoTplaybook or last updated on: 05/27/2021
MaskCam: A Jetson Nano AIoT Mask Detection Camera


MaskCam is a prototype reference design for a Jetson Nano-based smart camera system that measures crowd face mask usage in real-time, with all AI computation performed at the edge. MaskCam detects and tracks people in its field of view and determines whether they are wearing a mask via an object detection, tracking, and voting algorithm.

It uploads detection statistics to the cloud, where a web GUI can be used to monitor face mask compliance in the area the camera is watching. It saves interesting video snippets to local disk (e.g., a sudden influx of lots of people not wearing masks) and can optionally stream video via RTSP.

MaskCam in action at the airport!

We urge you to try it out! It’s easy to install on a Jetson Nano Developer Kit and only requires a USB webcam. This page gives instructions for setting up and running MaskCam. We'll also be adding a video guide that walks you through the setup.

MaskCam was developed by Berkeley Design Technology, Inc. (BDTI) and Tryolabs S.A., with development funded by NVIDIA. MaskCam is offered under the MIT License. For more information about MaskCam, please see the report from BDTI. The project is also fully open-sourced under the MIT license. Further details about using and modifying MaskCam are given in our GitHub repository.

If you have questions, please email us at We'll be giving a talk on this project at the 2021 Embedded Vision Summit, stay tuned for a link to the session page!

Materials Needed For This Project

To set up MaskCam, you will need:

  • A Jetson Nano Developer Kit running JetPack 4.4.1 or 4.5. (See these instructions on how to install JetPack on the Jetson Nano.)
  • An external DC 5 volt, 4 amp power supply connected through the Dev Kit's barrel jack connector (J25). (See these instructions on how to enable barrel jack power.) This software makes full use of the GPU, so a typical 2A power supply won't provide enough power.
  • A USB webcam attached to your Nano
  • An Ethernet cable, USB WiFi dongle, or M.2 WiFi module to connect to your Jetson Nano to the internet
  • Another computer with a program that can display RTSP streams -- we suggest VLC or QuickTime.

Getting Started

The easiest and fastest way to get MaskCam running on your Jetson Nano Dev Kit is using our pre-built containers.

First, power on your Jetson Nano and wait for it to fully boot. Open a terminal and use the following command to download the MaskCam container from Docker Hub (this takes about 10 minutes to download):

sudo docker pull maskcam/maskcam-beta

Find your local Jetson Nano IP address using ifconfig. This address will be used later to view a live video stream from the camera and to interact with the Nano from a web server.

Make sure a USB camera is connected to the Nano, and then start MaskCam by running the following command. Make sure to substitute <your-jetson-ip> with your Nano's IP address.

sudo docker run --runtime nvidia --privileged --rm -it --env MASKCAM_DEVICE_ADDRESS=<your-jetson-ip> -p 1883:1883 -p 8080:8080 -p 8554:8554 maskcam/maskcam-beta

The MaskCam container will start running the mask detection script,, using the USB camera as the default input device (/dev/video0). It will produce various output messages in the terminal as it's loading. If there are errors, the process will automatically end after several seconds. Check the Troubleshooting section at the end of this guide for tips on resolving errors.

After 30 seconds or so, it should continually generate status messages (such as Processed 100 frames...). Leave it running (don't press Ctrl+C, but be aware that the device will start heating up) and continue to the next section to view the live mask detection video stream!

Viewing a Live Video Stream

If you scroll through the logs and don't see any errors, you should find a message like:

Streaming at rtsp://aaa.bbb.ccc.ddd:8554/maskcam

where aaa.bbb.ccc.ddd is the address that you provided in MASKCAM_DEVICE_ADDRESS previously. If you didn't provide an address, you'll see some unknown address label there, but the streaming will still work.

You can copy-paste that URL into your RSTP streaming viewer (see how to do it with VLC) on another computer. If all goes well, you should be rewarded with streaming video of your Nano, with green boxes around faces wearing masks and red boxes around faces not wearing masks. An example video of the live streaming in action is shown below.

Testing out the live mask detection stream - 1