Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ValueError #10

Open
mnazari123 opened this issue Mar 21, 2024 · 3 comments
Open

ValueError #10

mnazari123 opened this issue Mar 21, 2024 · 3 comments

Comments

@mnazari123
Copy link

I followed up all the instruction as it has been written. I am trying to run the segmentation part of the model in 1 GPU; unfortunately, unlike the depth I got an error that I could not solve that. I would appreciate If you have any suggestion for the changes needed to make it work for the single gpu.
Here is the error in the file:
File "/media/user/meta/segmentation/models/model.py", line 216, in forward_train
loss_decode = self._decode_head_forward_train(x, img_metas,
File "/media/user/meta/segmentation/models/model.py", line 149, in _decode_head_forward_train
loss_decode = self.decode_head.forward_train(x, img_metas,

Here is the error:
File "/home/user/seg_env/lib/python3.10/site-packages/torch/nn/functional.py", line 2416, in _verify_batch_size
raise ValueError("Expected more than 1 value per channel when training, got input size {}".format(size))
ValueError: Expected more than 1 value per channel when training, got input size torch.Size([1, 512, 1, 1])

@ClsFaith
Copy link

我按照所写的说明进行了操作。我正在尝试在 1 个 GPU 中运行模型的分割部分;不幸的是,与深度不同,我遇到了一个无法解决的错误。如果您对使其适用于单 GPU 所需的更改有任何建议,我将不胜感激。 这是文件中的错误: 文件“/media/user/meta/segmentation/models/model.py”,第216行,在forward_train loss_decode = self._decode_head_forward_train(x, img_metas, File“/media/user/meta/分段/模型/model.py”,第 149 行,在 _decode_head_forward_train loss_decode = self.decode_head.forward_train(x, img_metas,

这是错误: 文件“/home/user/seg_env/lib/python3.10/site-packages/torch/nn/function.py”,第 2416 行,在 _verify_batch_size 中 引发 ValueError(“预计每个通道的值超过 1 个值,当训练,获取输入大小 {}".format(size)) ValueError:训练时每个通道预计有超过 1 个值,获取输入大小 torch.Size([1, 512, 1, 1])

您好 请问您解决了吗?

@mnazari123
Copy link
Author

我按照所写的说明进行了操作。我正在尝试在 1 个 GPU 中运行模型的分割部分;不幸的是,与深度不同,我遇到了一个无法解决的错误。如果您对使其适用于单 GPU 所需的更改有任何建议,我将不胜感激。 这是文件中的错误: 文件“/media/user/meta/segmentation/models/model.py”,第216行,在forward_train loss_decode = self._decode_head_forward_train(x, img_metas, File“/media/user/meta/分段/模型/model.py”,第 149 行,在 _decode_head_forward_train loss_decode = self.decode_head.forward_train(x, img_metas,
这是错误: 文件“/home/user/seg_env/lib/python3.10/site-packages/torch/nn/function.py”,第 2416 行,在 _verify_batch_size 中 引发 ValueError(“预计每个通道的值超过 1 个值,当训练,获取输入大小 {}".format(size)) ValueError:训练时每个通道预计有超过 1 个值,获取输入大小 torch.Size([1, 512, 1, 1])

您好 请问您解决了吗?

No, not yet.

@wwqq
Copy link
Collaborator

wwqq commented Apr 23, 2024

Hi, @mnazari123 @ClsFaith Using a larger batch size(>1) may solve the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants