-
fine tune a pre-trained model with your customized dataset
the network used in this project is vgg16 and it was pre-trained by Oxford to classify 2622 identities. Check this paper for more details. Since their model was trained for a classification purpose, it must be tuned to fit verification tasks. A triplet loss is used in this project just as what the paper describes. For more details about triplet loss, check this Google facenet paper
- install anaconda for python 3
- install tensorflow
- install keras (theno backend is not tested)
- install other python packages such as tqdm
run TestCases\test_align_database.py
different face datasets were used in this project, they are LFW dataset (http://vis-www.cs.umass.edu/lfw/) AR dataset (http://www2.ece.ohio-state.edu/~aleix/ARdatabase.html) CAS-PEAL dataset (http://www.jdl.ac.cn/peal/)
any face dataset can be used, since lfw data set is easy to download and prepare, we use lfw dataset for illustration
- download lfw dataset. Since we have our own align implementation. it is recommended to download data without alignment. the quick link is here
- align the lfw database. Open TestCases\test_align_database.py and edit the following two lines
source = 'imgs\\align_test\\origin'
target = 'imgs\\align_test\\aligned'
run test_align_database.py after running, you should get a folder of aligned images.
- download the model:
- todo: provide download link
- open cfg.py and modify the '_dir_models' variable, it changes the absolute path to the model
- open TestCases\test_verification_on_general_dataset.py and change dir_image to be the root directory of aligned images 6.run test_verification_on_general_dataset.py
- we still use lfw dataset to illustrate the process, in practice, any face dataset can be used
- note that it is recommended to use a GPU to train. Training on a cpu machine could be very slow.
- open train.py and modify this line: reader_LFW = LFWReader(dir_images='E:\DM\Faces\Data\LFW\aligned') set the directory to be the absolute path of aligned lfw images
- run the train.py code