douzi0248 / Re-ID

144 stars 44 forks source link

triplet loss运行问题 #14

Open Zhangzhengyi-up opened 3 years ago

Zhangzhengyi-up commented 3 years ago

File "train.py", line 230, in train_model loss5 = triplet(p, labels)[0] File "/home/zzy/anaconda3/envs/baseline/lib/python3.6/site-packages/torch/nn/modules/module.py", line 547, in call result = self.forward(*input, **kwargs) File "/home/zzy/Downloads/Person_reID_baseline_pytorch/triplet_loss.py", line 143, in forward dist = torch.pow(inputs, 2).sum(dim=1, keepdim=True).expand(n, n) RuntimeError: expand(torch.cuda.FloatTensor{[16, 1, 16, 8]}, size=[16, 16]): the number of sizes provided (2) must be greater or equal to the number of dimensions in the tensor (4)

你好,在运行你的代码的时候,tripelt loss这里老是报错,请问有什么解决方法吗

douzi0248 commented 3 years ago

抱歉哈!现在才回复你,可能是你输入到triplet loss的特征维度不对。

---原始邮件--- 发件人: "Zhangzhengyi-up"<notifications@github.com> 发送时间: 2020年9月30日(周三) 凌晨0:17 收件人: "douzi0248/Re-ID"<Re-ID@noreply.github.com>; 抄送: "Subscribed"<subscribed@noreply.github.com>; 主题: [douzi0248/Re-ID] triplet loss运行问题 (#14)

File "train.py", line 230, in train_model loss5 = triplet(p, labels)[0] File "/home/zzy/anaconda3/envs/baseline/lib/python3.6/site-packages/torch/nn/modules/module.py", line 547, in call result = self.forward(*input, **kwargs) File "/home/zzy/Downloads/Person_reID_baseline_pytorch/triplet_loss.py", line 143, in forward dist = torch.pow(inputs, 2).sum(dim=1, keepdim=True).expand(n, n) RuntimeError: expand(torch.cuda.FloatTensor{[16, 1, 16, 8]}, size=[16, 16]): the number of sizes provided (2) must be greater or equal to the number of dimensions in the tensor (4)

你好,在运行你的代码的时候,tripelt loss这里老是报错,请问有什么解决方法吗

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.