LeapMask

Hello there, I'm Cipulot and you're in the LeapMask repository! This project is a sort of baseline for future custom projects that needs a way to detect faces and provide a touch-less interface.

Inspiration

I've been inspired by the global urge to detect if proper safety rules are followed by people in both public and private spaces. Being in university with this difficult situation I've found that the "real" problem will be the reopening of the spaces and the organization of classes, so I decided to put my experience into play.

General features

Basically this repo gives you the ability to:

Here's a quick face mask detection example :

And a condition based motion sensor data gathering:

Tech used

For the facial detection a custom model was built and was tested with different implementations. The first tests were based on an haar cascade in OpenCV (you can see the result in the above gifs) but I quickly realized that this implementation was too much resource hungry and slow (you can test it if you want with this script and the "old" model).

Therefore I've trained another model with Tensorflow, this time with a set of both real and computer generated positive images (source is below and a couple of hundreds taken by myself both via Google Images and in my local area). This has proven to be effective in reducing the narrowness in detection that a "one type only" approach can introduce.

The input interface is based on the Leap Motion gesture sensor with ad-hoc compiled files in order to make it work with Python3 (since it's only Python2 compatible out of the box).

GUI

To use this Python script I've implemented a very simple GUI that:

Feature label change:

Gesture and virtual press:

Built with

Note

In order to make the Leap Motion Python library to work with Python3 (64bit for now) you need to use the provided pre-compiled files and put them in your installation path in the folders that are named as the one that are provided. You can find those in the "LM Python3 files" folder. Note that these files are a direct recompilation of the Python2 compatible scripts and not fully tested. The Leap Motion V4 SDK also works but introduces a tremendous amount of bugs with Python 3 that prevents the connection in many occasions.

NEW! An updated version of the pre compiled files for the Leap Motion Library is now available at this repository, providing Python 3.8.6 support.

Specifications

This project was tested on the following configuration:

Known issues

To do

Reference

If you're interested looking into the Face Mask detection stuff take a look at this paper (in that you can find a GitHub Repo with a lot of training images and links to positive/negative images databases): Masked Face Recognition Dataset and Application