/Face-mask-Classification-PyTorch

Transfer Learning for Face-mask Classification using PyTorch

Primary LanguageJupyter NotebookMIT LicenseMIT

Transfer Learning for Face-mask Classification using PyTorch

This repository includes codes for training and evaluating the Mask Classifier model, which is mostly implemented in Python 3 and PyTorch framework.

This code is tested on PyTorch=0.4.1

👍 Download Data

You can download Mask Classifier dataset from here and then save it into a folder name data/

Sample images

👍 What is Treansfer Learning ?

In reality, very few people train the entire Convolutional Network from scratch (with random initialization) because it is fairly difficult to have a data set of adequate scale. Alternatively, it is popular to pre-train ConvNet on a very large dataset (e.g. ImageNet, which includes 1.2 million images with 1000 categories) and then use ConvNet either as an initialization or as a fixed feature extractor for the task of interest.

Two major transfer learning scenarios appear as follows:

👍 Finetuning the convnet

Instead of random initialization, we initialise the network with a pre-trained network, like the one trained on the imageet 1000 dataset. The remainder of the preparation is as normal.

👍 ConvNet as a fixed feature extractor

We freeze the weights for the entire network except for the final fully connected layer. This last fully connected layer is replaced by a new one with random weights and only this layer is trained.

👍 Results by Finetuning the convnet

Classwise accuracy

👍 Results by ConvNet as a fixed feature extractor

Classwise accuracy

👍 Visualizing the model predictions

Thanks! ❤️ ❤️ ❤️