Skip to content

A project to classify different types of masks using PyTorch

Notifications You must be signed in to change notification settings

Pro-vo-ker/comp472_project

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

64 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AI Face Mask Detection

A project for the COMP 472 course at Concordia University

Member GitHub
Thanh Ta mth-1012
Madline Nessim madeleine341
Lam Tran linchen2508
Hung Cai Pro-vo-ker

Demo

(soon)

Files

main.py is where we load the dataset, transform it, and then feed it to our model to train

CNN.py is the convolutional neural network model that studies and analyzes the dataset

evaluator.py is where the evaluator functions are stored, including train/test split, k-fold cross-validation and single evaluation (to be added); bias evaluation is in the code but commented out

Libraries

Create an Anaconda environment with Python 3.9.

Using Anaconda, install the following before running.

conda install pytorch torchvision torchaudio -c pytorch

If you want to utilize cuda, install cudatoolkit.

conda install cudatoolkit=11.0

Continue to install matplotlib for graph plotting and scikit-learn wrapper.

pip install matplotlib skorch

Make sure jupyter notebook is installed before running the notebook file.

Previous version

The folder "old" contains the old version of main and evaluator, where we didn't utilize scikit-learn

How to run

There are two ways to test run, pure Python or Jupyter Notebook environment

Pure Python

Run the main.py with the IDE or in the console, enter

python main.py

After the training finishes, a train/test split (75-25) evaluation is automatically called and the result will be shown. It should be similar to this

Model saved

==== Predict ====
Accuracy for Test (25%) Dataset: 80.55%

For further evaluation, run the evaluator.py with the IDE or in the console, enter

python evaluator.py

Jupyter Notebook

(to be updated, you know what to do anyway)

Known Errors

1

If the error

OMP: Error #15: Initializing libiomp5md.dll, but found mk2iomp5md.dll already initialized.

is shown when running the evaluator.py, add

import os
os.environ['KMP_DUPLICATE_LIB_OK']='True'

to the appropriate position in main.py.

2

SliceDataset is not working in the notebook. K-fold cross-validation is not usable.

About

A project to classify different types of masks using PyTorch

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 59.7%
  • Jupyter Notebook 40.3%