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

Caught TypeError in DataLoader worker process 0 in DataLoader #18

Open
1359347500cwc opened this issue Oct 29, 2021 · 3 comments
Open

Comments

@1359347500cwc
Copy link

when I load Davis_dataset it always reports "Caught TypeError in DataLoader worker process 0. " in test.py", line 78, "in test_net for idx, (video_name, n_objects, frames, masks, optical_flows) in enumerate(test_data_loader):"

@hzxie
Copy link
Owner

hzxie commented Oct 30, 2021

Please provide the full stacktrace.

@hzxie hzxie changed the title About Dateloader Caught TypeError in DataLoader worker process 0 in DataLoader Oct 30, 2021
@1359347500cwc
Copy link
Author

Thanks for your reply!

Here is the full stacktrace

/home/cwc/RMNet/RMNet/utils/data_transforms.py:49: VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify 'dtype=object' when creating the ndarray.
optical_flows = torch.from_numpy(np.array(optical_flows)).float().permute(0, 3, 1, 2)
/home/cwc/RMNet/RMNet/utils/data_transforms.py:49: VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify 'dtype=object' when creating the ndarray.
optical_flows = torch.from_numpy(np.array(optical_flows)).float().permute(0, 3, 1, 2)
Traceback (most recent call last):
File "runner.py", line 111, in
main()
File "runner.py", line 96, in main
test_net(cfg)
File "/home/cwc/RMNet/RMNet/core/test.py", line 78, in test_net
for idx, (video_name, n_objects, frames, masks, optical_flows) in enumerate(test_data_loader):
File "/home/cwc/anaconda3/envs/torch18/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 517, in next
data = self._next_data()
File "/home/cwc/anaconda3/envs/torch18/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 1199, in _next_data
return self._process_data(data)
File "/home/cwc/anaconda3/envs/torch18/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 1225, in _process_data
data.reraise()
File "/home/cwc/anaconda3/envs/torch18/lib/python3.8/site-packages/torch/_utils.py", line 429, in reraise
raise self.exc_type(msg)
TypeError: Caught TypeError in DataLoader worker process 0.
Original Traceback (most recent call last):
File "/home/cwc/anaconda3/envs/torch18/lib/python3.8/site-packages/torch/utils/data/_utils/worker.py", line 202, in _worker_loop
data = fetcher.fetch(index)
File "/home/cwc/anaconda3/envs/torch18/lib/python3.8/site-packages/torch/utils/data/_utils/fetch.py", line 44, in fetch
data = [self.dataset[idx] for idx in possibly_batched_index]
File "/home/cwc/anaconda3/envs/torch18/lib/python3.8/site-packages/torch/utils/data/utils/fetch.py", line 44, in
data = [self.dataset[idx] for idx in possibly_batched_index]
File "/home/cwc/RMNet/RMNet/utils/data_loaders.py", line 76, in getitem
frames, masks, opt_flows = self.transforms(frames, masks, opt_flows)
File "/home/cwc/RMNet/RMNet/utils/data_transforms.py", line 36, in call
frames, masks, optical_flows = transform(frames, masks, optical_flows)
File "/home/cwc/RMNet/RMNet/utils/data_transforms.py", line 49, in call
optical_flows = torch.from_numpy(np.array(optical_flows)).float().permute(0, 3, 1, 2)
TypeError: can't convert np.ndarray of type numpy.object
. The only supported types are: float64, float32, float16, complex64, complex128, int64, int32, int16, int8, uint8, and bool.

image

here is the error point in line 49
image

So I add a dtype to change the type of numpy.object_ to 'float32' but it report a new error
image

i also try to change the numpy to list then use the torch.LongTensor to convert it to tensor it report this error*
image

I want to know whether it is the problem with my optical flow files?

@Sand-Glass
Copy link

I have the same question

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