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

Hi how to train your code with different pre-trained models #43

Open
ssbilakeri opened this issue Mar 2, 2021 · 4 comments
Open

Hi how to train your code with different pre-trained models #43

ssbilakeri opened this issue Mar 2, 2021 · 4 comments

Comments

@ssbilakeri
Copy link

How to train with different pre-trained models.
please reply.

@huanghoujing
Copy link
Owner

Hi, to use another backbone.

  • First, you create another file, e.g. resnext.py under directory tri_loss/model. The content is the original resnext.py provided by pytorch.
  • Then, modify the forward function of resnext, removing unnecessary operation after this line x = self.layer4(x), so that it returns the result of layer4.
  • Finally, you can use from .resnext import resnext50 in tri_loss/model/Model.py, and then replace this line
self.base = resnet50(pretrained=True, last_conv_stride=last_conv_stride)

with

self.base = resnext50(pretrained=True)

If you would like to reduce the last convolutional stride of the backbone, you can modify it yourself in resnext.py accordingly.

@ssbilakeri
Copy link
Author

ssbilakeri commented Mar 3, 2021 via email

@ssbilakeri
Copy link
Author

ssbilakeri commented Mar 3, 2021 via email

@huanghoujing
Copy link
Owner

Sorry for the late response. If you want to try on many different backbones or understand which one is better, as well as some training tricks, you can read the paper FastReID: A Pytorch Toolbox for General Instance Re-identification and the accompanying code https://github.com/JDAI-CV/fast-reid.

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

2 participants