FaceScan is a Python program which can detect face masks in webcams, images or video files and streams
FaceScan is able to detect face masks in video feed from connected webcams in realtime:
FaceScan is able to detect face masks from locally saved video and image files:
Before |
After |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
FaceScan is able to detect face masks from online streams such as rtsp, rtmp and http.
FaceScan also comes with a GUI which functions the same way as the python command, just with an easier interface.
Clone the git repo
$ git clone https://github.com/DanielLechner/FaceScan
Change directory to FaceScan/app
$ cd FaceScan/app
If you are using Windows, then go into your Anaconda environment and install torchvision with this command
$ conda install pytorch torchvision cpuonly -c pytorch-nightly -c defaults -c conda-forge
Install all dependencies from requirements.txt. We reccomend using Python 3.8.5.
$ pip install -r requirements.txt
Enviroment should now be fully functional
As mentioned above, there are many ways to use our Python program. Here you can check all the functions:
$ python detect.py --source 0 # webcam
file.jpg # image
file.mp4 # video
path/ # directory
path/*.jpg # glob
rtsp://170.93.143.139/rtplive/470011e600ef003a004ee33696235daa # rtsp stream
rtmp://192.168.1.105/live/test # rtmp stream
http://112.50.243.8/PLTV/88888888/224/3221225900/1.m3u8 # http stream
All outputs are saved in FaceScan/app/runs/detect
Furthermore you can use the following parser tags:
--weights: weights of the trained model
--source: input file/folder to run inference on, 0 for webcam
--output: directory to save results
--iou-thres: IOU threshold for NMS, defaults to 0.45
--conf-thres: object confidence threshold
We decided to use the yolov5s model, since it is the fastes. This is important since live feed has to be computet very fast to have no lag.
Our weights file has a high precision as you can see in this graph, which represents the confidence the trained model has gained over time. This is tested with the "test" Dataset.
To check out more about our License click here