This is a face recognition program that is trained on this dataset. Please note that the model provided has not been trained, so you will need to train it on your own data.
The model architecture is illustrated in the following image:
It is a siamese neural network architecture that takes an image as an anchor or input, and another image for comparison, which can be similar (positive) or dissimilar (negative). The model predicts whether the given images are similar or not. For more information, you can refer to the notebooks in the Notebook folder.
The program utilizes the following libraries:
Libraries | Links |
---|---|
PyTorch | https://www.pytorch.com |
NumPy | https://numpy.org |
Pandas | https://pandas.pydata.org |
Pillow | https://pillow.readthedocs.io/en/stable/ |
OpenCV | https://pypi.org/project/opencv-python/ |
Pathlib | https://pypi.org/project/pathlib/ |
To use the program, follow these steps:
-
Install Python 3.9 (It is recommended to install this specific version as it was the development environment version), PyTorch, and PIL.
-
Clone the code files by running the following command:
git clone https://github.com/Ali-Fartout/Face-Recognition.git
- Navigate to the
face_recognition
folder:
cd face_recognition
- Use the following commands for different phases of the program:
-
Training phase:
- Create a folder and place all the images of your face into that folder.
- Copy that folder to the
face_recognition\data
folder. - Run the following command to initiate the training phase:
For example:
python .\app.py "train" "{directory of your image pool}" "{epochs number / default is 5}"
python .\app.py "train" "data\musk" "4"
This will save your model to use multiply times for testing data.
- Testing phase:
- Now import you testing data to this directory :
data\test\input
(Ensure that the number of input images provided for testing is not less than the size of the image pool.) - Use the same image pool folder used for training.
- Run the following command to perform the testing phase:
For example:
python .\app.py "test" "{directory of your image pool}" "{owner name}"
python .\app.py "test" "data\musk" "musk"
- Now import you testing data to this directory :
Note: Do not change any folder names or delete them. If you do so, please retrieve the code from GitHub again.