Skip to content

ValueError: Expected more than 1 spatial element when training, got input size torch.Size([1, 32, 1]) #31

Open
@cuiyun-fang

Description

@HeatherJiaZG 您好!感谢您提供的代码!但是我在运行python train.py时出现了以下报错:
Traceback (most recent call last): File "/home/jhk/work code/SuperGlue-pytorch-master/train.py", line 172, in <module> data = superglue(pred) File "/home/jhk/anaconda3/envs/openglue/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl return forward_call(*input, **kwargs) File "/home/jhk/work code/SuperGlue-pytorch-master/models/superglue.py", line 262, in forward desc1 = desc1 + self.kenc(kpts1, torch.transpose(data['scores1'], 0, 1)) File "/home/jhk/anaconda3/envs/openglue/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl return forward_call(*input, **kwargs) File "/home/jhk/work code/SuperGlue-pytorch-master/models/superglue.py", line 83, in forward return self.encoder(torch.cat(inputs, dim=1)) File "/home/jhk/anaconda3/envs/openglue/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl return forward_call(*input, **kwargs) File "/home/jhk/anaconda3/envs/openglue/lib/python3.8/site-packages/torch/nn/modules/container.py", line 139, in forward input = module(input) File "/home/jhk/anaconda3/envs/openglue/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl return forward_call(*input, **kwargs) File "/home/jhk/anaconda3/envs/openglue/lib/python3.8/site-packages/torch/nn/modules/instancenorm.py", line 72, in forward return self._apply_instance_norm(input) File "/home/jhk/anaconda3/envs/openglue/lib/python3.8/site-packages/torch/nn/modules/instancenorm.py", line 32, in _apply_instance_norm return F.instance_norm( File "/home/jhk/anaconda3/envs/openglue/lib/python3.8/site-packages/torch/nn/functional.py", line 2482, in instance_norm _verify_spatial_size(input.size()) File "/home/jhk/anaconda3/envs/openglue/lib/python3.8/site-packages/torch/nn/functional.py", line 2449, in _verify_spatial_size raise ValueError("Expected more than 1 spatial element when training, got input size {}".format(size)) ValueError: Expected more than 1 spatial element when training, got input size torch.Size([1, 32, 1])
请问您事先对数据集是否进行过其他处理,或者您是否知道这个报错如何能解决?万分感谢!

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions