In-browser FaceMask Detection for small business

Zekun Wang
4 min readNov 30, 2020

facemask-detection.com 👈👈

This is an AI that detects masks super fast:

  • No installation or registration.
  • No need to buy expensive devices.
  • You don’t even need a continuous internet connection.
  • Most importantly, completely FREE!

Well, let’s be serious. This is an AI model running in the browser that can recognize whether people are wearing masks and automatically remind them.

Let us recall those mask detection machines at the entrance of luxury stores, they can remind customers to wear masks. However, most small businesses and local shops cannot pay thousands of dollars to equip them. Now, you only need a tablet or laptop, and you can have it! After loading, this model runs completely locally on your device, and no data will be uploaded to the server.

How to use it?

  1. Download and Launch the latest version of the Chrome browser
  2. Enter chrome://flags in the address bar
  3. Enable all WebAssembly features
  4. Re-launch Chrome, open the webpage and allow access to the camera.
Settings in chrome://flags

Hint: iOS is not supported yet, please use Android, macOS, and Windows. The FPS depends on your device CPU.

Why it’s so fast?

This model is modified from Yolo-Fastest and is only 1.3M in size. It might be the fastest and lightest open source improved version of Yolo object detection model. The Yolo series models that we are familiar with, which are characterized by detection speed, are much larger than it, usually tens of M in size. Even the smallest one, YOLOv5s, is 7.5M. Therefore, this model only puts little pressure on the device.

The deployment of this model is achieved through the NCNN framework and WebAssembly. NCNN is a high-performance neural network inference computing framework optimized for mobile platforms. It has excellent performance on low computing power devices. WebAssembly compiles the C++ program into a binary format so that it can run at high speed in the browser.

Because of this, even without a GPU, even if it runs in a browser, it can complete the detection with a high FPS, which exceeds most common mask detection tools.

What about privacy issues?

Since this model runs entirely in the browser, it does not and does not need to upload any data, such as video content, to the server. All detection processes are completed locally. After loading, the user can even cut off the Internet connection.

All video content will only be processed in real-time and will not be stored in any form.

Therefore, there is no need to worry about any privacy leakage and other issues. This also means that the user does not need to set up wifi for the place where the device is placed or worry about the extra data charge caused by detection. At the same time, the tool will not occupy the storage space of the device.

What’s more?

Because the existing deployment uses SIMD, etc., it cannot run on Safari temporarily. And iOS only supports WebAssembly in Safari, so it cannot be used on iOS now. I am still working on the problem. It’s coming.

All in all, it is just a free alternative to the expensive mask detection machine. You can buy a tablet for $60 and a floor standing for $20 to get similar functions. After this pandemic, these devices can also be used for other purposes.

(It's not promoting these products. Just an example.)

In such a hard time, I hope this AI can give a hand to those small businesses that strive to persist. So that they can obtain protection similar to luxury shops at a small cost. As long as this tool can protect one more person from COVID-19, it would be enough.

Of course, this project is not yet mature. If you have any suggestions or are willing to contribute to this project, please contact me.

I will post some technical processes of this project on my blog. Thank you very much!

--

--

Zekun Wang
0 Followers

Data Science | Vanderbilt University