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

A bug occurred while running train.py #27

Open
yysube opened this issue Apr 21, 2022 · 1 comment
Open

A bug occurred while running train.py #27

yysube opened this issue Apr 21, 2022 · 1 comment

Comments

@yysube
Copy link

yysube commented Apr 21, 2022

train.py is not running and encounters the following problems.
in pytorch 1.2

Traceback (most recent call last):
File "C:/Program Files (x86)/DM-Count-master/train.py", line 64, in
trainer.train()
File "C:\Program Files (x86)\DM-Count-master\train_helper.py", line 110, in train
self.train_eopch()
File "C:\Program Files (x86)\DM-Count-master\train_helper.py", line 126, in train_eopch
for step, (inputs, points, gt_discrete) in enumerate(self.dataloaders['train']):
File "C:\Anaconda\envs\py37\lib\site-packages\torch\utils\data\dataloader.py", line 819, in next
return self._process_data(data)
File "C:\Anaconda\envs\py37\lib\site-packages\torch\utils\data\dataloader.py", line 846, in _process_data
data.reraise()
File "C:\Anaconda\envs\py37\lib\site-packages\torch_utils.py", line 369, in reraise
raise self.exc_type(msg)
RuntimeError: Caught RuntimeError in DataLoader worker process 0.
Original Traceback (most recent call last):
File "C:\Anaconda\envs\py37\lib\site-packages\torch\utils\data_utils\worker.py", line 178, in worker_loop
data = fetcher.fetch(index)
File "C:\Anaconda\envs\py37\lib\site-packages\torch\utils\data_utils\fetch.py", line 44, in fetch
data = [self.dataset[idx] for idx in possibly_batched_index]
File "C:\Anaconda\envs\py37\lib\site-packages\torch\utils\data_utils\fetch.py", line 44, in
data = [self.dataset[idx] for idx in possibly_batched_index]
File "C:\Program Files (x86)\DM-Count-master\datasets\crowd.py", line 124, in getitem
return self.train_transform(img, keypoints)
File "C:\Program Files (x86)\DM-Count-master\datasets\crowd.py", line 83, in train_transform
gt_discrete = gen_discrete_map(h, w, keypoints)
File "C:\Program Files (x86)\DM-Count-master\datasets\crowd.py", line 37, in gen_discrete_map
discrete_map = torch.zeros(im_width * im_height).scatter_add
(0, index=p_index, src=torch.ones(im_width*im_height)).view(im_height, im_width).numpy()
RuntimeError: Expected object of scalar type Long but got scalar type Int for argument #3 'index'
Your work has given me a lot of help. Thank you very much. I really need you for this problem, and I hope to get your help.

@Summittk
Copy link

please rewrite the crowd.py line37 into the "p_index = torch.from_numpy(p_h* im_width + p_w).to(torch.int64)"

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

2 participants