Real-Time Face Mask Detector is a project made by ลukasz Staniszewski and Bartosz Cywiลski for college classes. Our purpose was to create and develop application which enables to detect Covid-19 mask in real time with Client-Server socket connection architecture.
๐ต๐ฑ ๐ต๐ฑ If you want to see full documentation of project, prepared specially for college course, click here. ๐ต๐ฑ ๐ต๐ฑ
Project architecture is divided on:
- Server - python script representing socket server, to which client can connect. After client's correct connection server is downloading in real-time frames from camera, which is connected to same (sub)system on which server is running. Server processes image by using Haar Cascades with OpenCV in order to detect face(s) in the frame and then, when face is detected, its running algorithm with pre-trained (using tensorflow) model to detect Covid-19 mask. After full processing, server sends to client frame with decision made on it and conviction in made decision.
- Client - python script representing socket client with proper Graphical User Inteface made with QT. Client's application enables to connect to server by giving IP of server and allows user to receive detection status.
.
โโโ ClientDetector # code and resources for client application
โย ย โโโ pyui # code implementing ui
โย ย โย ย โโโ ui # ui created with qt designer
โย ย โโโ resources # resources for gui
โย ย โโโ config.ini # config file to type manually server's ip and port
โย ย โโโ tests # unit tests provided for client app
โโโ DataPacker # code for data sended between server and client
โย ย โโโ tests # unit tests for data packer
โโโ DetectorExceptions # connection exceptions code
โโโ ServerDetector # code and resources for server application
โย ย โโโ haar-classifier # face detection model
โย ย โโโ images # images for tests
โย ย โโโ model # mask-detection model
โย ย โโโ tests # unit tests provided for server app
โโโ docs # folder with official polish documentation
โโโ logs # folder when logs are placed
โโโ requirements.txt # python modules needed to be installed to run apps
โโโ mainClient.py # script running client app
โโโ mainServer.py # script running server app
- In order to install app you need to stock up with Python 3.9.5 and Windows/Linux Operating System.
- Download repository:
git clone https://github.com/bartooo/mask-detector.git
cd mask-detector
git-lfs pull
- Create virtual environment and install modules:
python -m venv venv
.\venv\Scripts\activate [on Linux: source ./venv/bin/activate]
pip install -r .\requirements.txt
- Open two separate terminal windows and cd in both of them to folder with installed project.
- Activate virtual environment in both terminals:
.\venv\Scripts\activate [on Linux: source ./venv/bin/activate]
- Run Server script in one of terminals:
python .\mainServer.py
- When server finishes running, check server name to which you will connect. In below example its DESKTOP-HT34P2E:
...
2021-07-01 15:31:10.931750: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1264]
[SERVER] Listening on DESKTOP-HT34P2E:8006...
- Run Client script in second terminal:
python .\mainClient.py
- Go to SETTINGS, type server name in correct input and TEST CONNECTION, you should see similiar result:
-
If you see correct frame, click CHANGE SERVER.
-
You are free to detect your mask. Go back to Main Menu and click START DETECTION.
- Application correctly working.
- Application when no face provided.
- Testing connection.
Surgical Medical Mask Graphic Vector Designed By rovian1993 from Pngtree.com.