GNAYUOHZ / ReID-MGN

Simple pytorch unofficial implement of paper: Learning Discriminative Features with Multiple Granularities for Person Re-Identification

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

help me to resolve this error

ssbilakeri opened this issue · comments

triplwtloss is giving dimension error. Please help me to fix this error.

File "main.py", line 50, in train
loss = self.loss(outputs, labels)
File "/usr/local/lib/python3.7/dist-packages/torch/nn/modules/module.py", line 889, in _call_impl
result = self.forward(*input, **kwargs)
File "/content/STREID/loss.py", line 14, in forward
Triplet_Loss = [triplet_loss(output, labels) for output in outputs[1:4]]
File "/content/STREID/loss.py", line 14, in
Triplet_Loss = [triplet_loss(output, labels) for output in outputs[1:4]]
File "/usr/local/lib/python3.7/dist-packages/torch/nn/modules/module.py", line 889, in _call_impl
result = self.forward(*input, **kwargs)
File "/content/STREID/loss.py", line 57, in forward
dist = torch.pow(inputs, 2).sum(dim=1, keepdim=True).expand(n, n)
IndexError: Dimension out of range (expected to be in range of [-1, 0], but got 1)

what you change? Please make it clearer.