open-mmlab / mmdetection

OpenMMLab Detection Toolbox and Benchmark
https://mmdetection.readthedocs.io
Apache License 2.0
29.64k stars 9.47k forks source link

RuntimeError: can not load DICOM image in training #4068

Closed ChengLongDeng closed 3 years ago

ChengLongDeng commented 4 years ago

I have converted my own datasets to COCO format but my original image format is DICOM (.IMA). In training phase, I got the following error: (python tools/train.py ./configs/mask_rcnn/mask_rcnn_r50_caffe_fpn_mstrain-poly_1x_medical.py)

Traceback (most recent call last): File "tools/train.py", line 178, in main() File "tools/train.py", line 174, in main meta=meta) File "/data/dcl_code/deeplearning/mmdetection/mmdet/apis/train.py", line 150, in train_detector runner.run(data_loaders, cfg.workflow, cfg.total_epochs) File "/home/DCL/anaconda3/envs/mmdetection/lib/python3.7/site-packages/mmcv/runner/epoch_based_runner.py", line 125, in run epoch_runner(data_loaders[i], **kwargs) File "/home/DCL/anaconda3/envs/mmdetection/lib/python3.7/site-packages/mmcv/runner/epoch_based_runner.py", line 47, in train for i, data_batch in enumerate(self.data_loader): File "/home/DCL/anaconda3/envs/mmdetection/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 363, in next data = self._next_data() File "/home/DCL/anaconda3/envs/mmdetection/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 989, in _next_data return self._process_data(data) File "/home/DCL/anaconda3/envs/mmdetection/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 1014, in _process_data data.reraise() File "/home/DCL/anaconda3/envs/mmdetection/lib/python3.7/site-packages/torch/_utils.py", line 395, in reraise raise self.exc_type(msg) AttributeError: Caught AttributeError in DataLoader worker process 0. Original Traceback (most recent call last): File "/home/DCL/anaconda3/envs/mmdetection/lib/python3.7/site-packages/torch/utils/data/_utils/worker.py", line 185, in _worker_loop data = fetcher.fetch(index) File "/home/DCL/anaconda3/envs/mmdetection/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py", line 44, in fetch data = [self.dataset[idx] for idx in possibly_batched_index] File "/home/DCL/anaconda3/envs/mmdetection/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py", line 44, in data = [self.dataset[idx] for idx in possibly_batched_index] File "/data/dcl_code/deeplearning/mmdetection/mmdet/datasets/custom.py", line 191, in getitem data = self.prepare_train_img(idx) File "/data/dcl_code/deeplearning/mmdetection/mmdet/datasets/custom.py", line 214, in prepare_train_img return self.pipeline(results) File "/data/dcl_code/deeplearning/mmdetection/mmdet/datasets/pipelines/compose.py", line 40, in call data = t(data) File "/data/dcl_code/deeplearning/mmdetection/mmdet/datasets/pipelines/loading.py", line 67, in call results['img_shape'] = img.shape AttributeError: 'NoneType' object has no attribute 'shape'

1、Whether the data format cannot be DICOM?

xvjiarui commented 4 years ago

Hi @ChengLongDeng You may check if the image path is correct. All image types that all supported by OpenCV are compatible.

JanaldoChen commented 3 years ago

@ChengLongDeng Have you fixed this problem? I met the same problem too.