A Binary Image Classification in PyTorch classifying faces as with or without wearing masks.
This project was done as part of my PyTorch learning as part of TinkerHub's ComputerVision with PyTorch Learning Program.
A simple binary image classification using the deep learning framework PyTorch that can classify faces as with or without wearing masks. This classifier can prove to be helpful in times of a pandemic, similar to the COVID-19 pandemic.
The dataset used can be found here.
The dataset contains a total of 816 images which includes 408 images each in both categories. More images are added to the training set with Image Augmentation. The number of training images(After Image Augmentation) used is 1956 and the number of test images is 164. The images are given in the zip file here. They are named in numerical order for the sake of convenience(image_namer.py is used for naming the images). The name of the images along with thier labels are in mask.csv file(make_csv.py is used for making the csv file).
Two models are trained:- One using the Convolutional Neural Networks and the other one is trained on the VGG16 model by applying transfer learning. The model weights of the VGG16 model is freezed and a Linear layer is added to its end and the data is trained on it.
The entire code was run and tested in Google colab
The source code with little changes can be used to tackle any binary image classification.
obtained by the
CNN model - 89.40%
VGG16 model - 82.34%
- Python3.6 - The Programming language used
- PyTorch - The deep learning framework used
- VGG16 - A pretrained CNN which is trained on the ImageNet dataset.
Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.
- ๐ด Fork the Project
- Create your Feature Branch (
git checkout -b feature/newFeature
) - Commit your Changes (
git commit -m 'Add some newFeature'
) - Push to the Branch (
git push origin feature/newFeature
) - Open a Pull Request
Please feel free to raise any issue...
If you love the repo, Please show some love by starring the repo ๐