FedFR: Joint Optimization Federated Framework for Generic and Personalized Face Recognition
October 8, 2022 ยท View on GitHub
Chih-Ting Liu, Chien-Yi Wang, Shao-Yi Chien, Shang-Hong Lai,
Proceedings of the AAAI Conference on Artificial Intelligence (AAAI), 2022
Generate FedFR Dataset
You can follow the steps in split_dataset to generate our pretrained, and FL dataset.
Prerequisite
- Put the pretrained model ("backbone.pth") under the
pretrain/folder.
Training our FedFR
- In
config.py, you should first change the path ofconfig.recandconfig.local_rec - Run with command
sh run.sh. - After training, you will have models saved in the checkpoint directory, eg.,
ckpt/FedFR/.
Generic Evaluation
You will evaluate the generic performance on IJBC dataset.
You can use ijbc_conti.py to continuously evaluate all checkpoints saved in the directory. (eg. epoch 5 to epoch 11)
python3 ijbc_conti.py --root_path PATH/TO/IJBC/ --ckpt_dir ckpt/FedFR --epoch 5 6 7 8 9 10 11 \
--gpu 0 1 2 3 --job 'both'
There are two types of job, '1:1' and '1:n', as described in our paper.
If you want to evaluate both, you can use --job 'both'.
Personalized Evaluation
Each model trained by client before FedAvg model aggregation will be used to evaluate the personalized performance.
Furthermore, as described in paper, the backbone and the tranformation layer will be concatenated to generate personalized features.
The evaluation scripts are as follows:
We only provide single checkpoint for some epoch and single type of evaluation ('1:1' or '1:n')
1:1 Evaluation
python3 local_all.py --backbone 'multi' --task '1:1' --ckpt_path ckpt/FedFR \
--data_dir $VERI_DIR --gallery $GALLERY_DIR --epoch 11 --num_client 40 --gpu 0 1 2 3
$VERI_DIRis the path to 'local_veri_4000' when you split your dataset, eg. '/home/jackieliu/face_recognition/ms1m_split/local_veri_4000'$GALLERY_DIRis the path to 'local_gallery_4000', eg. '/home/jackieliu/face_recognition/ms1m_split/local_gallery_4000'
1:n Evaluation
python3 local_all.py --backbone 'multi' --task '1:n' --ckpt_path ckpt/FedFR \
--data_dir $VERI_DIR --gallery $GALLERY_DIR --epoch 11 --num_client 40 --gpu 0 1 2 3
$VERI_DIRis the path to 'local_veri_4000' when you split your dataset, eg. '/home/jackieliu/face_recognition/ms1m_split/local_veri_4000'$GALLERY_DIRis the path to 'local_gallery_4000', eg. '/home/jackieliu/face_recognition/ms1m_split/local_gallery_4000'