https://docs.google.com/presentation/d/1m9TeHUAtqzd9Ohgw1LW7X491v_TRbOiB-q9YGU7rXgg/edit?usp=sharing
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.
- 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
- 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.
- Once the training reaches 50 epochs the model is saved in the Codes folder itself.
- 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.
- 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.
- Activate the newly created venv with all neccessary libraries.
@gnr638_warrior: conda activate arcface
(arcface)@gnr638_warrior: _
- Navigate inside the face_recog_site folder from the main folder.
(arcface)@gnr638_warrior: cd face_recog_site
- 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
- 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.
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!
- Arcface: GNR638 Project Long Version
- GNR638 Project Shorter Version
- Arcface Explanation
- Arcface: Visualizations and Inference
- ArcFace: Face Verification Deployment using Flask