Skip to content

This is the official implementation of the paper titled "Comprehensive Comparison of Vision Transformers and Traditional Convolutional Neural Networks for Face Recognition Tasks"

Notifications You must be signed in to change notification settings

MarcosRodrigoT/ViT-Face-Recognition

Repository files navigation

Vision Transformers for Face Recognition

This is the official implementation of the paper titled "Comprehensive Comparison of Vision Transformers and Traditional Convolutional Neural Networks for Face Recognition Tasks".

The whole project, including model weights and extensive results can be found in https://www.gti.ssr.upm.es/data as a .zip file.

The structure of directories should look like:

Project
├── datasets
|    ├── LFW
|    |    └── lfw
|    ├── UPM-GTI-Face
|    └── VGG-Face2
└── saved_results
     ├── Models
     |    ├── ResNet_50
     |    ├── VGG_16
     |    └──  ViT_B32
     └── Tests
         ├── LFW
         └── UPM-GTI-Face

Pre-requisites

  1. Download the following datasets and move them to their respective directories:
cd ~/Downloads/
mv VGG-Face2/* ~/Project/datasets/VGG-Face2/
mv lfw/* ~/Project/datasets/LFW/lfw/
mv UPM-GTI-Face/* ~/Project/datasets/UPM-GTI-Face
  1. Install the requirements
pip install -r requirements.txt

Training

The training of the three models can be achieved executing their respective files. The results of the training will be saved to /tmp directory.

  • ViT_B32
python vitb32_train.py
  • ResNet_50
python resnet50_train.py
  • VGG_16
python vgg16_train.py

Any of the networks can be trained from scratch by commenting the following line in the respective training file:

"""
LOAD PRE-TRAINED MODEL WEIGHTS
"""

# Load pre-trained model weights before training
best_weights = "./saved_results/Models/ViT_B32/checkpoint"
vit_model.load_weights(best_weights)

LFW Test

The test can be performed by executing the corresponding file. Results will be saved to /saved_results/Tests/LFW.

python lfw_test.py

UPM-GTI-Face Test

The test can be performed by executing the corresponding file. Results will be saved to /saved_results/Tests/UPM-GTI-Face.

python upm-gti-face_test.py

Authors

Citation

@inproceedings{rodrigo2023comprehensive,\
    title={Comprehensive Comparison of Vision Transformers and Traditional Convolutional Neural Networks for Face Recognition Tasks},\
    author={Rodrigo, Marcos and Cuevas, Carlos and García, Narciso},\
    booktitle={Under revision for the 2023 IEEE International Conference on Image Processing},\
    year={2023},\
    organization={IEEE}\
}

About

This is the official implementation of the paper titled "Comprehensive Comparison of Vision Transformers and Traditional Convolutional Neural Networks for Face Recognition Tasks"

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages