Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

About the pre-trained model #33

Open
bobo0810 opened this issue Jul 31, 2020 · 14 comments
Open

About the pre-trained model #33

bobo0810 opened this issue Jul 31, 2020 · 14 comments

Comments

@bobo0810
Copy link

bobo0810 commented Jul 31, 2020

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?

@cavalleria
Copy link
Owner

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

@bobo0810
Copy link
Author

bobo0810 commented Jul 31, 2020

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.

@cavalleria
Copy link
Owner

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.😂

@xsacha
Copy link
Contributor

xsacha commented Aug 1, 2020

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.

@bobo0810
Copy link
Author

bobo0810 commented Aug 2, 2020

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

@xsacha
Copy link
Contributor

xsacha commented Aug 3, 2020

@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

@FelixZhang7
Copy link

@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?

@xsacha
Copy link
Contributor

xsacha commented Aug 21, 2020

@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.

@bobo0810
Copy link
Author

@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

@FelixZhang7
Copy link

@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 ?

@xsacha
Copy link
Contributor

xsacha commented Aug 26, 2020

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

@bobo0810
Copy link
Author

@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.

@cavalleria
Copy link
Owner

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

@FelixZhang7
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants