Closed Betricy closed 3 months ago
It is likely an issue with the optimizer and learning rate. The pre-trained parameters of CLIP cannot withstand the high learning rate used in TOP-ReID. You can refer to the settings in CLIP-ReID and adjust to the configuration used in the second stage of fine-tuning.
This might help!
这可能是优化器和学习率的问题。CLIP 的预训练参数无法承受 TOP-ReID 中使用的高学习率。您可以参考 CLIP-ReID 中的设置并调整到第二阶段微调中使用的配置。这可能会 有所帮助!
MAP达到40%是在我修改了lr=0.00035的条件下得到的,而且这种小的学习率收敛非常慢
What is your batch size? You can adjust it to: batch_size: 64 num_instance: 4 Give it a try.
你的batch size是多少?你可以调整为: batch_size: 64 num_instance: 4 试试看。 一张3090 batch_size: 64 num_instance: 8 我会试一试,4
Additionally, you should note whether the learning rate you set is for the backbone only or for the entire network. For the CLIP backbone, you need to reduce the learning rate, while for CRM and TPM, the learning rate should be set normally, otherwise convergence will be very slow!
I think you may set the backbone to 0.000005, while for other parts are 0.00035.
另外,你要注意你设置的学习率是针对骨干网还是针对整个网络。对于 CLIP 骨干网,你需要降低学习率,而对于 CRM 和 TPM,学习率应该设置正常,否则收敛会很慢!
如何设置分层学习率呢?另外我注意到三种模态是共享主干,如果单独主干效果会怎样呢?作者有尝试过吗?
1.You can set different learning rates according to the parameter name, for example:
if "clip..." in key: lr = 0.000005 else: ...
2.Additionally, the results in the TOP-ReID are based on the three modalities not sharing the backbone. I also tried sharing the backbone, and the results can be seen at the bottom of the TOP-ReID README. The results show that the impact is minimal.
1.可以根据参数名设置不同的学习率,例如:
if "clip..." in key: lr = 0.000005 else: ...
2.另外,TOP-ReID 中的结果是基于三种模式不共享骨干网络的。我也尝试过共享骨干网络,结果可以在 TOP-ReID README 的底部看到。结果表明影响微乎其微。
抱歉,我理解错了代码以为是共享的,感谢
你好,我替换你的vit特征提取部分为clip,然后进行训练,效果map减小一半,作者可以帮我看看有什么问题吗? `class build_transformer(nn.Module): def init(self, num_classes, cfg, camera_num, view_num): super(build_transformer, self).init() self.model_name = 'ViT-B-16' self.neck = cfg.MODEL.NECK self.neck_feat = cfg.TEST.NECK_FEAT self.in_planes = 768 self.in_planes_proj = 512 self.num_classes = num_classes self.camera_num = camera_num self.view_num = view_num self.sie_coe = cfg.MODEL.SIE_COE
self.ID_LOSS_TYPE = cfg.MODEL.ID_LOSS_TYPE self.norm = nn.LayerNorm(self.in_planes) self.classifier = nn.Linear(self.in_planes, self.num_classes, bias=False) self.classifier.apply(weights_init_classifier) self.classifier_proj = nn.Linear(self.in_planes_proj, self.num_classes, bias=False) self.classifier_proj.apply(weights_init_classifier)
class clip_TOPReID(nn.Module): def init(self, num_classes, camera_num, view_num, cfg): super(clip_TOPReID, self).init()
`