layumi / Person_reID_baseline_pytorch

:bouncing_ball_person: Pytorch ReID: A tiny, friendly, strong pytorch implement of person re-id / vehicle re-id baseline. Tutorial 👉https://github.com/layumi/Person_reID_baseline_pytorch/tree/master/tutorial
https://www.zdzheng.xyz
MIT License
4.1k stars 1.01k forks source link

使用swin训练出现的问题 #334

Open jxVoidreaver opened 2 years ago

jxVoidreaver commented 2 years ago

使用swin训练出现问题: Epoch 0/59

Traceback (most recent call last): File "/home/bder73002/phf/Person_reID_baseline_pytorch-master/train.py", line 523, in model = train_model(model, criterion, optimizer_ft, exp_lr_scheduler, File "/home/bder73002/phf/Person_reID_baseline_pytorch-master/train.py", line 268, in train_model outputs = model(inputs) File "/home/bder73002/anaconda3/envs/python3.9.2/lib/python3.9/site-packages/torch/nn/modules/module.py", line 889, in _call_impl result = self.forward(*input, **kwargs) File "/home/bder73002/phf/Person_reID_baseline_pytorch-master/model.py", line 122, in forward x = self.avgpool(x.permute((0,2,1))) RuntimeError: number of dims don't match in permute

tjusyy commented 2 years ago

请问您解决了吗?我也遇到了这个问题

layumi commented 2 years ago

Hi @tjusyy

可能是 timm版本问题。 更新timm就行。

Please update your timm and try it again

tjusyy commented 2 years ago

您好,timm更新到0.5.4也不行,请问您是哪个版本

jxVoidreaver commented 2 years ago

我尝试在0.4.12和0.5.4版本运行,都是同样的问题

layumi commented 2 years ago

https://github.com/layumi/Person_reID_baseline_pytorch/blob/master/model.py#L121

要更新到 0.6.0以上。timm 改写法了。

pip install git+https://github.com/rwightman/pytorch-image-models.git
jxVoidreaver commented 2 years ago

非常感谢,问题已经解决。 安装timm最新版本:pip install timm==0.6.2.dev0 使用pip updata只能更新到0.5.4版本