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

IndexError: The shape of the mask [50] at index 0 does not match the shape of the indexed tensor [1] at index 0 #55

Open
luoolu opened this issue Dec 22, 2022 · 1 comment

Comments

@luoolu
Copy link

luoolu commented Dec 22, 2022

torch.multiprocessing.spawn.ProcessRaisedException:

-- Process 1 terminated with the following error:
Traceback (most recent call last):
File "/home/DATA/user/PycharmProjects/vnext/venv/lib/python3.7/site-packages/torch/multiprocessing/spawn.py", line 59, in _wrap
fn(i, *args)
File "/home/DATA/user/PycharmProjects/vnext/detectron2/engine/launch.py", line 126, in _distributed_worker
main_func(*args)
File "/home/DATA/user/PycharmProjects/vnext/projects/IDOL/train_net.py", line 168, in main
return trainer.train()
File "/home/DATA/user/PycharmProjects/vnext/detectron2/engine/defaults.py", line 484, in train
super().train(self.start_iter, self.max_iter)
File "/home/DATA/user/PycharmProjects/vnext/detectron2/engine/train_loop.py", line 149, in train
self.run_step()
File "/home/DATA/user/PycharmProjects/vnext/detectron2/engine/defaults.py", line 494, in run_step
self._trainer.run_step()
File "/home/DATA/user/PycharmProjects/vnext/detectron2/engine/train_loop.py", line 273, in run_step
loss_dict = self.model(data)
File "/home/DATA/user/PycharmProjects/vnext/venv/lib/python3.7/site-packages/torch/nn/modules/module.py", line 889, in _call_impl
result = self.forward(*input, **kwargs)
File "/home/DATA/user/PycharmProjects/vnext/venv/lib/python3.7/site-packages/torch/nn/parallel/distributed.py", line 705, in forward
output = self.module(*inputs[0], **kwargs[0])
File "/home/DATA/user/PycharmProjects/vnext/venv/lib/python3.7/site-packages/torch/nn/modules/module.py", line 889, in _call_impl
result = self.forward(*input, **kwargs)
File "/home/DATA/user/PycharmProjects/vnext/projects/IDOL/idol/idol.py", line 219, in forward
det_targets, ref_targets = self.prepare_targets(gt_instances)
File "/home/DATA/user/PycharmProjects/vnext/projects/IDOL/idol/idol.py", line 315, in prepare_targets
ref_target[k] = v[valid_i]
IndexError: The shape of the mask [50] at index 0 does not match the shape of the indexed tensor [1] at index 0

@luoolu
Copy link
Author

luoolu commented Dec 22, 2022

The same dataset can be trained normally on the Mask2former network

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

1 participant