huanghoujing / person-reid-triplet-loss-baseline

Rank-1 89% (Single Query) on Market1501 with raw triplet loss, In Defense of the Triplet Loss for Person Re-Identification, using Pytorch
487 stars 129 forks source link

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

Open ssbilakeri opened 3 years ago

ssbilakeri commented 3 years ago

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

huanghoujing commented 3 years ago

Hi, to use another backbone.

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

ssbilakeri commented 3 years ago

Thank you very much for your clear explanation.

I want to check with different networks like Efficient net, Inception. Where do I get pretrained weight for these networks.

Can you suggest which pretrained network is preferred for reidentification. Thank you.

On Wed, 3 Mar 2021, 1:34 am Houjing Huang, notifications@github.com wrote:

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.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/huanghoujing/person-reid-triplet-loss-baseline/issues/43#issuecomment-789177614, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOOYJBPSEOJLQ5H5234LWQLTBVAEZANCNFSM4YOF3KGQ .

ssbilakeri commented 3 years ago

Can I get anystrong literature to choose best pre-trained model for people reidentification. Kindly suggest Thank you.

On Wed, 3 Mar 2021, 6:49 am Shavantrevva Bilakeri, ssbilakeri@gmail.com wrote:

Thank you very much for your clear explanation.

I want to check with different networks like Efficient net, Inception. Where do I get pretrained weight for these networks.

Can you suggest which pretrained network is preferred for reidentification. Thank you.

On Wed, 3 Mar 2021, 1:34 am Houjing Huang, notifications@github.com wrote:

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.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/huanghoujing/person-reid-triplet-loss-baseline/issues/43#issuecomment-789177614, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOOYJBPSEOJLQ5H5234LWQLTBVAEZANCNFSM4YOF3KGQ .

huanghoujing commented 3 years ago

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.