lhoyer / DAFormer

[CVPR22] Official Implementation of DAFormer: Improving Network Architectures and Training Strategies for Domain-Adaptive Semantic Segmentation
Other
466 stars 92 forks source link

KeyError: Caught KeyError in DataLoader worker process 3. #30

Closed hpuxing closed 2 years ago

hpuxing commented 2 years ago

Thanks for your wonderful work. but I have a question for you. I would appreciate it if you could answer it.

When I run “python run_experiments.py --7", in Ubuntu18.04, I got this problem : KeyError: Caught KeyError in DataLoader worker process 3.'. And the error is as follows:

2022-06-11 10:04:42,150 - mmseg - INFO - Iter [16550/40000] lr: 3.518e-05, eta: 10:05:26, time: 1.454, data_time: 0.029, memory: 9792, decode.loss_seg: 0.1154, decode.acc_seg: 90.7496, src.loss_imnet_feat_dist: 0.1078, mix.decode.loss_seg: 0.1369, mix.decode.acc_seg: 89.0204 2022-06-11 10:05:54,290 - mmseg - INFO - Iter [16600/40000] lr: 3.510e-05, eta: 10:04:01, time: 1.443, data_time: 0.029, memory: 9792, decode.loss_seg: 0.1193, decode.acc_seg: 90.7338, src.loss_imnet_feat_dist: 0.1099, mix.decode.loss_seg: 0.1370, mix.decode.acc_seg: 89.7331 Traceback (most recent call last): File "run_experiments.py", line 101, in train.main([config_files[i]]) File "/home/duguangxing/DAFormer/tools/train.py", line 166, in main train_segmentor( File "/home/duguangxing/DAFormer/mmseg/apis/train.py", line 131, in train_segmentor runner.run(data_loaders, cfg.workflow) File "/home/duguangxing/anaconda3/lib/python3.8/site-packages/mmcv-1.3.7-py3.8.egg/mmcv/runner/iter_based_runner.py", line 131, in run iter_runner(iter_loaders[i], **kwargs) File "/home/duguangxing/anaconda3/lib/python3.8/site-packages/mmcv-1.3.7-py3.8.egg/mmcv/runner/iter_based_runner.py", line 58, in train data_batch = next(data_loader) File "/home/duguangxing/anaconda3/lib/python3.8/site-packages/mmcv-1.3.7-py3.8.egg/mmcv/runner/iter_based_runner.py", line 32, in next data = next(self.iter_loader) File "/home/duguangxing/anaconda3/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 521, in next data = self._next_data() File "/home/duguangxing/anaconda3/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 1203, in _next_data return self._process_data(data) File "/home/duguangxing/anaconda3/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 1229, in _process_data data.reraise() File "/home/duguangxing/anaconda3/lib/python3.8/site-packages/torch/_utils.py", line 434, in reraise raise exception KeyError: Caught KeyError in DataLoader worker process 3. Original Traceback (most recent call last): File "/home/duguangxing/anaconda3/lib/python3.8/site-packages/torch/utils/data/_utils/worker.py", line 287, in _worker_loop data = fetcher.fetch(index) File "/home/duguangxing/anaconda3/lib/python3.8/site-packages/torch/utils/data/_utils/fetch.py", line 49, in fetch data = [self.dataset[idx] for idx in possibly_batched_index] File "/home/duguangxing/anaconda3/lib/python3.8/site-packages/torch/utils/data/_utils/fetch.py", line 49, in data = [self.dataset[idx] for idx in possibly_batched_index] File "/home/duguangxing/DAFormer/mmseg/datasets/uda_dataset.py", line 111, in getitem return self.get_rare_class_sample() File "/home/duguangxing/DAFormer/mmseg/datasets/uda_dataset.py", line 88, in get_rare_class_sample i1 = self.file_to_idx[f1] KeyError: '0005460_labelTrainIds.png'

yangqigege commented 2 years ago

I have the same problem,have you solved it? I would appreciate it if you could answer it.

lhoyer commented 2 years ago

Thank you for your interest in our work. I did not encounter this problem during training. I would suggest checking that python tools/convert_datasets/gta.py was run successfully and that the produced files contain all samples including the one that was missing.

hpuxing commented 1 year ago

Thanks, I noticed that the image “0005460” was missing after the dataset was unzipped.