Skip to content

Hey! These are our codes and presentations for the GNR638 Deep Learning project. We have made Arcface, which is the SOTA (State of the Art) face recognition model.

License

Notifications You must be signed in to change notification settings

zestyoreo/Arcface

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

55 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Arcface

https://docs.google.com/presentation/d/1m9TeHUAtqzd9Ohgw1LW7X491v_TRbOiB-q9YGU7rXgg/edit?usp=sharing

GNR638 Project


Hey! These are our codes and presentations for the GNR638 Deep Learning project. We have made Arcface, which is the SOTA (State of the Art) face recognition model.
Link to paper.
Links to all videos are present at the end of this document. It is recommended to watch the videos before trying out the code.



Instructions to run Training Code


  1. Create a python virtual environment in python or conda and download all the necessary libraries to make the project codes run. All required libraries are listed in the requirements.txt.
@gnr638_warrior: conda create --name arcface
@gnr638_warrior: conda activate arcface
(arcface)@gnr638_warrior: pip install -r requirements.txt
    • The main training code in the Codes section of this folder is the python file named arcface_training_code_v2.py.
    • The datasets for training are present in the folder named datasets inside Codes folder.
@gnr638_warrior: cd Codes
  1. Activate the newly created venv with all neccessary libraries.
@gnr638_warrior: conda activate arcface
(arcface)@gnr638_warrior: _
  • Run the arcface_training_code_v2.py file to start training.
(arcface)@gnr638_warrior: python arcface_training_code_v2.py
  • Else if you are comfortable with ipynb notebooks open the Arcface_Training_Code_v2.ipynb notebook, change the kernel to the created venv and execute the cells in order to start training.
  1. Once the training reaches 50 epochs the model is saved in the Codes folder itself.


Instructions to run Vizualisations and Plots Code


  1. Activate the newly created venv with all neccessary libraries.
@gnr638_warrior: conda activate arcface
(arcface)@gnr638_warrior: _
  • Run the arcface_visualizations.py file to calculate threshold and create the plots.
(arcface)@gnr638_warrior: python arcface_visualizations.py
  • Else if you are comfortable with ipynb notebooks open the Arcface_Visualizations.ipynb notebook, change the kernel to the created venv and execute the cells in order to calculate threshold and create the plots.

A) Executing ipynb notebook is preferred in this case.



Instructions to run Face Verification Code


  1. Activate the newly created venv with all neccessary libraries.
@gnr638_warrior: conda activate arcface
(arcface)@gnr638_warrior: _
    • Images are stored in the images folder.
    • Upload images you wish to verify. (make sure they are closely cropped images of faces.
    • Change path in line 152,153 in arcface_face_verification.py or the 5th cell in Arcface_Face_Verification.ipynb for face verification with paths to different images if you wish to.
  • Run the arcface_face_verification.py file to verify.
(arcface)@gnr638_warrior: python arcface_face_verification.py
  • Else if you are comfortable with ipynb notebooks open the Arcface_Face_Verification.ipynb notebook, change the kernel to the created venv and execute the cells in order to load model then verify if both are the same people or not.

A) Executing ipynb notebook is preferred in this case.
B) In this file, a Resnet-34 model is used as a backbone. We trained it to reduce model size for our flask deployment, but it wasn't significantly smaller than our Resnet-50 backbone arcface model.



Instructions to run Flask Face Verification Deployment


  1. Activate the newly created venv with all neccessary libraries.
@gnr638_warrior: conda activate arcface
(arcface)@gnr638_warrior: _
  1. Navigate inside the face_recog_site folder from the main folder.
(arcface)@gnr638_warrior: cd face_recog_site
  1. Run the app.py file to start the server.
(arcface)@gnr638_warrior: python app.py
ArcFace expects  []  inputs
and it represents faces as  (512,)  dimensional vectors
 * Serving Flask app 'app' (lazy loading)
 * Environment: production
   WARNING: This is a development server. Do not use it in a production deployment.
   Use a production WSGI server instead.
 * Debug mode: on
 * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
 * Restarting with stat
ArcFace expects  []  inputs
and it represents faces as  (512,)  dimensional vectors
 * Debugger is active!
 * Debugger PIN: 137-611-671
  1. Copy the address in which the server is running and open it on your default browser. (see the deployment video to see how it is done)
    • Once you select image 1 and image 2, don't forget to upload them before trying to verify if they are the same people.
    • Once the images are uploaded, they are saved in the uploads folder of face_recog_site as 1 and 2.
    • To verify another pair of faces just refresh the page. You need NOT run app.py ech time you verify 2 faces.


Videos


The video presentation we made was very long. So we divided it into parts. To view short demos of the model and the work we have done please watch GNR638 Project Shorter Version. The Arcface: GNR638 Project Long Version is a combination of the shorter version and the Arcface Explanation. In Arcface: Visualizations and Inference we describe the models we have trained and try to find the thresholds and best hyperparameters based on the experiments we have performed on data. The video titled ArcFace: Face Verification Deployment using Flask is already a part of the sort and long version videos.


We as a team have taken a lot of efforts to finish this project. It would be awesome if you could take some more time and see our full project,explanation and analysis (pls watch Arcface: GNR638 Project Long Version & Arcface: Visualizations and Inference). If you feel this to be a violation of instructions just watch GNR638 Project Shorter Version for a quick overview of our project. Either ways thank you for seeing our project and hope u like it!



Other Links




Project by 200050103, 200260027 and 200050160.

About

Hey! These are our codes and presentations for the GNR638 Deep Learning project. We have made Arcface, which is the SOTA (State of the Art) face recognition model.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published