JDAI-CV / FaceX-Zoo

A PyTorch Toolbox for Face Recognition
https://arxiv.org/pdf/2101.04407.pdf
Other
1.88k stars 434 forks source link

How to make a pkl file in face_sdk #32

Open ElegantLin opened 3 years ago

ElegantLin commented 3 years ago

Hi, FaceX-Zoo Team,

Thanks for your fantastic work. I wonder how to make a recognition model (pkl file) in face_sdk folder using training_procedure. I load the pkl using torch.load and I find it is a ParrallelModel class. How do you make it?

Thanks!

wang21jun commented 3 years ago

Please refer to this tool: https://github.com/JDAI-CV/FaceX-Zoo/blob/main/face_sdk/utils/model_convert.py

tuyennhoangg commented 3 years ago

I downloaded the file model3 (Trained by MS-Celeb-1M-v1c-Mask) in line 3.4 Masked Face Recognition from this link: https://github.com/JDAI-CV/FaceX-Zoo/tree/main/training_mode But it had problems

(venv) D:\Project\Paper_face\face_sdk>python utils/model_convert.py Traceback (most recent call last): File "utils/model_convert.py", line 21, in new_pretrained_dict[k] = pretrained_dict['backbone.'+k] KeyError: 'backbone.conv1.conv.weight'

ElegantLin commented 3 years ago

@tuyennhoangg What is the model's backbone? The script is only used for mobilenet.

wang21jun commented 3 years ago

For model3, please change 'backbone' to 'feat_net' in line21, that is: old: new_pretrained_dict[k] = pretrained_dict['backbone.'+k]
new: new_pretrained_dict[k] = pretrained_dict['feat_net.'+k]

chuongnvk54 commented 2 years ago

Hello @wang21jun, Could you share me the script code to convert Swin_tranformer models and the model_meta.json of it. When I used model_convert.py file and test the sample I have got the error:

ERROR 2022-05-11 15:18:50 face_pipline.py: 77] Failed to load face recognition model. ERROR 2022-05-11 15:18:50 face_pipline.py: 78] No module named 'backbone'