Skip to content

This repository contains the senior design project for Computer Engineering at King Fahd University of Petroleum and Minerals

License

Notifications You must be signed in to change notification settings

othmanKisha/In-Door-Face-Mask-Inspector

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

84 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

In Door Face Mask Inspector (IDFMI)

Description

1. Overview

This is a project that aims to allow the return of working environment in indoor offices.

It focuses on reading live streams from ip cameras in enterprise environment, after that, it applies a face mask detection model using the state-of-art Artificial Neural Networks.

In addition to detection, it also provides a customization platform for surveillence cameras.

Another service provided from the system is alerting security members via email.

2. Project Architecture

The project consists of 3 containers

idfmi: Contains the Flask application and gunicorn application server
nginx: Contains the Nginx web server
mongo: Contains the MongoDB database

Some info about the stack used

Python version: 3.8.1
Web framework:  Flask
Database:       MongoDB (Using the pymongo driver)
App server:     gunicorn
Worker class:   meinheld
Web server:     Nginx
Front end:      Bootsrap4, JQuery

The system Architecture of IDFMI

System Architecture

3. Project Tree

The following is how the files are structured inside the project:

In-Door-Face-Mask-Inspector/
    .env
    .gitignore
    docker-compose.yml
    LICENSE
    README.md
    app/
        app.py
        camera.py
        config.py
        Dockerfile
        requirements.txt 
        model/
            face_mask_detection.pb
            load_model.py
            utils.py
        static/
            favicon.ico
            main.css     
            main.js   
            main.scss  
        templates/
            base.html
            auth_error.html 
            forms/
               camera.html
               security.html 
            pages/
               home.html
               welcome.html
    mongo/
        Dockerfile
        settings-insert.js
        setup.sh
    nginx/
        Dockerfile
        idfmi.conf
        nginx.conf

4. Screenshots

The home page before signing

  • light theme

Welcome Page Light

  • dark theme

Welcome Page Dark

The home page after signing

  • light theme

Demo

  • dark theme

Home Page Dark

Different functionalities

  • Adding a camera

    • light theme

    Create Camera Light

    • dark theme

    Create Camera Dark

  • Adding a security member

    • light theme

    Create Security Light

    • dark theme

    Create Security Dark

  • View all security member

    • light theme

    View Security Light

    • dark theme

    View Security Dark

  • Update forms are similar to create forms.

Camera Stream and Detection

  • light theme

Detection Light

  • dark theme

Detection Dark

Requirements

1. Docker

Since the project is containerized, then the only important dependency is to have docker and docker compose installed, installation guides are as follows:

Notice that for Windows and Mac you should only install docker desktop, which will download docker engine and docker-compose by default.

2. Microsoft Azure Subscription

This is a requirement for the demo only to simulate the working environment with respect to authentication, authorization, and Secrets.

You can check microsoft's documentation on how to make a project with azure active directory and keyvault.

3. Email Account

  • could use any email (gmail, yahoo, outlook), but we used gmail for our prototype.

Installation

  • clone the repository:

    git clone https://github.com/othmanKisha/In-Door-Face-Mask-Inspector.git
  • After finishing all the steps for Azure Active Directory and Key Vault, make sure to create a .env file inside the In-Door-Face-Mask-Inspector folder and inside the file add the following:

    KEY_VAULT_NAME=${KEY_VAULT_NAME} # Stored in OS environment
    AZURE_CLIENT_ID=${AZURE_CLIENT_ID} # Stored in OS environment
    AZURE_CLIENT_SECRET=${AZURE_CLIENT_SECRET} # Stored in OS environment
    AZURE_SUBSCRIPTION_ID=${AZURE_SUBSCRIPTION_ID} # Stored in OS environment
    AZURE_TENANT_ID=${AZURE_TENANT_ID} # Stored in OS environment
    
    MONGODB_DATABASE=<The name of the database to be created>
    MONGODB_USERNAME=<The username of the database to be created>
    MONGODB_PASSWORD=<The password of the database to be created>
    MONGODB_HOSTNAME=mongodb # This is the name of mongodb container
    MONGODB_PORT=<The port where mongodb will be running> # By default it is 27017
    
    EMAIL_ADDRESS=<The email address created to send alerts>
    EMAIL_PASSWORD=<The password of the alerts email address>
    SMTP_SERVER=<The mail server, it is smtp.gmail.com when you use gmail, you can search the other mail servers>
    SMTP_PORT=<The mail server port> # The port where the smtp server is running by default 587
    
    MODEL_CONFIDENCE=<The confidence of the model> # By default 0.5
    MODEL_FILE=face_mask_detection.pb # The name of the model, can be changed
    MODEL_DIRECTORY=model # The folder containing the model, can be changed

Usage

  • make sure you are in the project directory:

    cd In-Door-Face-Mask-Inspector
  • run docker-compose command:

    docker-compose up -d
  • now you can view the website by typing localhost on the browser.

Acknowledgment

Authors

License

MIT

About

This repository contains the senior design project for Computer Engineering at King Fahd University of Petroleum and Minerals

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published