hzxie / RMNet

The official implementation of "Efficient Regional Memory Network for Video Object Segmentation". (Xie et al., CVPR 2021)
https://haozhexie.com/project/rmnet/
MIT License
85 stars 12 forks source link

Caught TypeError in DataLoader worker process 0 in DataLoader #18

Open 1359347500cwc opened 3 years ago

1359347500cwc commented 3 years ago

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 commented 3 years ago

Please provide the full stacktrace.

1359347500cwc commented 3 years ago

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(opticalflows)).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 commented 8 months ago

I have the same question