You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello,can you help me ?thank you! When I use Market data set ,report an error:
problem:
/home/waq/anaconda3/envs/re_person/bin/python /home/waq/Downloads/ai/re_person/code/DG-Net/DG-Net-master/test_2label.py
-------test-----------
/home/waq/Downloads/ai/re_person/code/DG-Net/DG-Net-master/test_2label.py:182: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details.
config = yaml.load(stream)
Traceback (most recent call last):
File "/home/waq/Downloads/ai/re_person/code/DG-Net/DG-Net-master/test_2label.py", line 204, in
gallery_feature = extract_feature(model,dataloaders['gallery'])
File "/home/waq/Downloads/ai/re_person/code/DG-Net/DG-Net-master/test_2label.py", line 131, in extract_feature
x[0] = norm(x[0])
File "/home/waq/Downloads/ai/re_person/code/DG-Net/DG-Net-master/test_2label.py", line 109, in norm
fnorm = torch.norm(f, p=2, dim=1, keepdim=True)
File "/home/waq/anaconda3/envs/re_person/lib/python3.6/site-packages/torch/functional.py", line 1337, in norm
return _VF.norm(input, p, _dim, keepdim=keepdim) # type: ignore
IndexError: Dimension out of range (expected to be in range of [-1, 0], but got 1)
Process finished with exit code 1
Thank you!
The text was updated successfully, but these errors were encountered:
Check the size of the matrix/vector in x[0], if it has a 1 in the batch dimension, after squeeze in norm() function, this reduces to a vector which is problematic for the norm
---- 回复的原邮件 ----
| 发件人 | Zhedong ***@***.***> |
| 日期 | 2022年04月20日 22:57 |
| 收件人 | ***@***.***> |
| 抄送至 | ***@***.******@***.***> |
| 主题 | Re: [NVlabs/DG-Net] IndexError:Dimension out of range(excepted to be in range of [-1,0],but got 1) (Issue #75) |
Yes @aiqiangbrave
It is due to the batch size = 1
You could use
x = x.unsqueeze(0)
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you were mentioned.Message ID: ***@***.***>
Check the size of the matrix/vector in x[0], if it has a 1 in the batch dimension, after squeeze in norm() function, this reduces to a vector which is problematic for the norm
Hello,can you help me ?thank you! When I use Market data set ,report an error:
problem:
/home/waq/anaconda3/envs/re_person/bin/python /home/waq/Downloads/ai/re_person/code/DG-Net/DG-Net-master/test_2label.py
-------test-----------
/home/waq/Downloads/ai/re_person/code/DG-Net/DG-Net-master/test_2label.py:182: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details.
config = yaml.load(stream)
Traceback (most recent call last):
File "/home/waq/Downloads/ai/re_person/code/DG-Net/DG-Net-master/test_2label.py", line 204, in
gallery_feature = extract_feature(model,dataloaders['gallery'])
File "/home/waq/Downloads/ai/re_person/code/DG-Net/DG-Net-master/test_2label.py", line 131, in extract_feature
x[0] = norm(x[0])
File "/home/waq/Downloads/ai/re_person/code/DG-Net/DG-Net-master/test_2label.py", line 109, in norm
fnorm = torch.norm(f, p=2, dim=1, keepdim=True)
File "/home/waq/anaconda3/envs/re_person/lib/python3.6/site-packages/torch/functional.py", line 1337, in norm
return _VF.norm(input, p, _dim, keepdim=keepdim) # type: ignore
IndexError: Dimension out of range (expected to be in range of [-1, 0], but got 1)
Process finished with exit code 1
Thank you!
The text was updated successfully, but these errors were encountered: