cavaface icon indicating copy to clipboard operation
cavaface copied to clipboard

About the pre-trained model

Open bobo0810 opened this issue 4 years ago • 14 comments

Thank you for this work. I want to use the pre-trained model of AttentionNet-IRSE-56/92 from the MODEL_ZOO.md for fine-tuning. Where can I get the pre-trained model?

bobo0810 avatar Jul 31 '20 07:07 bobo0810

The AttentionNet-IRSE pretrained model is not avaiable. And I saved the model use torch.jit.save api which seem like not support for finetuning. You can retrain it use this to save model.https://github.com/cavalleria/cavaface.pytorch/blob/13182ecc349ca050fa5a877045390a41037313a7/train.py#L352

cavalleria avatar Jul 31 '20 07:07 cavalleria

The AttentionNet-IRSE pretrained model is not avaiable. And I saved the model use torch.jit.save api which seem like not support for finetuning. You can retrain it use this to save model.https://github.com/cavalleria/cavaface.pytorch/blob/13182ecc349ca050fa5a877045390a41037313a7/train.py#L352

OK,thanks! Can the models from Model Zoo.md not be finetuning? Such as IR-SE50 etc.

bobo0810 avatar Jul 31 '20 07:07 bobo0810

The models from Model Zoo.md is saved using api torch.jit.save which can evaluate it without defining model python files, but it seem like cannot finetune.😂

cavalleria avatar Jul 31 '20 07:07 cavalleria

You can load the weights from torch.jit.load and set these in to the state_dict of a real model (from BACKBONE_DICT) in order to support finetuning.

xsacha avatar Aug 01 '20 14:08 xsacha

You can load the weights from torch.jit.load and set these in to the state_dict of a real model (from BACKBONE_DICT) in order to support finetuning.

Oh, that's great. Can you provide the pre-trained model of AttentionNet-IRSE-56/92 so that I can fine-tune it? Thank you @cavalleria @xsacha

bobo0810 avatar Aug 02 '20 02:08 bobo0810

@bobo0810 Should be like this:

mymodel = AttentionNet_IRSE_92()
mymodel.load_state_dict(torch.jit.load('AttentionNet_IRSE_92_torchscript.pt').state_dict())

See: https://pytorch.org/docs/stable/generated/torch.jit.ScriptModule.html#torch.jit.ScriptModule.state_dict

xsacha avatar Aug 03 '20 00:08 xsacha

@cavalleria hello,according to data augmentation result in model_zoo.md,baseline is the best, so we do not need to do any data augmentation?

FelixZhang7 avatar Aug 21 '20 02:08 FelixZhang7

@cavalleria hello,according to data augmentation result in model_zoo.md,baseline is the best, so we do not need to do any data augmentation?

When trained for the same amount of time, from scratch, baseline is better. This will be the case for any sort of classifier AFAIK. This is also the case if you double the size of the dataset. There is more data to learn, so it will take longer.

Augmentation requires either a fine-tune on a baseline (pre-trained) or much longer training to see optimal results.

xsacha avatar Aug 21 '20 02:08 xsacha

@cavalleria hello,according to data augmentation result in model_zoo.md,baseline is the best, so we do not need to do any data augmentation?

When trained for the same amount of time, from scratch, baseline is better. This will be the case for any sort of classifier AFAIK.

Augmentation requires either a fine-tune on a baseline or longer training to see optimal results.

@FelixZhang7 Although model.md is like this, my experimental experience is that adding data augmentation will improve performance. @xsacha In order to make the network converge better, data augmentation should be performed on the pre-trained model and continue training

bobo0810 avatar Aug 21 '20 02:08 bobo0810

@xsacha @cavalleria @bobo0810 Hello, I want to find a network with a better accuracy than resnet50-IR, and it is better to have similar inference speed,could you give me some advice ?

FelixZhang7 avatar Aug 26 '20 02:08 FelixZhang7

@FelixZhang7 AttNet-56-IR It is similar inference speed to resnet50 on GPU and better accuracy.

xsacha avatar Aug 26 '20 02:08 xsacha

@xsacha @cavalleria @bobo0810 Hello, I want to find a network with a better accuracy than resnet50-IR, and it is better to have similar inference speed,could you give me some advice ?

I haven't compared the speed of the networks yet. Refer to modelzoo.md, I am using attention_irse.

bobo0810 avatar Aug 26 '20 02:08 bobo0810

@bobo0810 efficient-b1/mobilenetv3(enlarge width) and so on.

cavalleria avatar Aug 26 '20 02:08 cavalleria

@xsacha I‘ve tried AttNet-56-IR,almost the same acc compare with resnet50-IR...

FelixZhang7 avatar Aug 27 '20 06:08 FelixZhang7