RuntimeError: applying transform <monai.transforms.io.dictionary.LoadImaged object at 0x7f0f84fb8a90>
could you please help me to save this problem?
That's been addressed earlier https://github.com/Project-MONAI/MONAI/issues/5603 please upgrade monai or downgrade itk...
have you solved this problem?Can you tell me the solution
I am having the same issue.. Did you find the solution?
I am having the same issue.. Did you find the solution?
Yes, you can fix this by reinstalling monai with "pip install 'monai[all]==1.1.0'"
I am trying to run on the BRATS-21 dataset.
python3 main.py --json_list=./jsons/brats21_folds.json --data_dir=./BRATS-2021/ --max_epochs=300 --val_every=5 --noamp --distributed --roi_x=128 --roi_y=128 --roi_z=128 --in_channels=4 --spatial_dims=3 --use_checkpoint --feature_size=48 --fold=0
Original Traceback (most recent call last):
File "/home/2022022/djain02/packages/lib/python3.10/site-packages/monai/transforms/transform.py", line 141, in apply_transform
return _apply_transform(transform, data, unpack_items, lazy, overrides, log_stats)
File "/home/2022022/djain02/packages/lib/python3.10/site-packages/monai/transforms/transform.py", line 98, in _apply_transform
return transform(data, lazy=lazy) if isinstance(transform, LazyTrait) else transform(data)
File "/home/2022022/djain02/packages/lib/python3.10/site-packages/monai/transforms/io/dictionary.py", line 162, in __call__
data = self._loader(d[key], reader)
File "/home/2022022/djain02/packages/lib/python3.10/site-packages/monai/transforms/io/array.py", line 282, in __call__
img_array, meta_data = reader.get_data(img)
File "/home/2022022/djain02/packages/lib/python3.10/site-packages/monai/data/image_reader.py", line 938, in get_data
data = self._get_array_data(i)
File "/home/2022022/djain02/packages/lib/python3.10/site-packages/monai/data/image_reader.py", line 1012, in _get_array_data
return np.asanyarray(img.dataobj, order="C")
File "/home/2022022/djain02/packages/lib/python3.10/site-packages/nibabel/arrayproxy.py", line 391, in __array__
arr = self._get_scaled(dtype=dtype, slicer=())
File "/home/2022022/djain02/packages/lib/python3.10/site-packages/nibabel/arrayproxy.py", line 358, in _get_scaled
scaled = apply_read_scaling(self._get_unscaled(slicer=slicer), scl_slope, scl_inter)
File "/home/2022022/djain02/packages/lib/python3.10/site-packages/nibabel/arrayproxy.py", line 332, in _get_unscaled
return array_from_file(self._shape,
File "/home/2022022/djain02/packages/lib/python3.10/site-packages/nibabel/volumeutils.py", line 523, in array_from_file
n_read = infile.readinto(data_bytes)
File "/soft/AIDL/conda_envs/pytorch-200/lib/python3.10/gzip.py", line 301, in read
return self._buffer.read(size)
File "/soft/AIDL/conda_envs/pytorch-200/lib/python3.10/_compression.py", line 68, in readinto
data = self.read(len(byte_view))
File "/soft/AIDL/conda_envs/pytorch-200/lib/python3.10/gzip.py", line 479, in read
self._read_eof()
File "/soft/AIDL/conda_envs/pytorch-200/lib/python3.10/gzip.py", line 525, in _read_eof
raise BadGzipFile("CRC check failed %s != %s" % (hex(crc32),
gzip.BadGzipFile: CRC check failed 0xe9a51edc != 0x4190aef7
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/2022022/djain02/packages/lib/python3.10/site-packages/monai/transforms/transform.py", line 141, in apply_transform
return _apply_transform(transform, data, unpack_items, lazy, overrides, log_stats)
File "/home/2022022/djain02/packages/lib/python3.10/site-packages/monai/transforms/transform.py", line 98, in _apply_transform
return transform(data, lazy=lazy) if isinstance(transform, LazyTrait) else transform(data)
File "/home/2022022/djain02/packages/lib/python3.10/site-packages/monai/transforms/compose.py", line 335, in __call__
result = execute_compose(
File "/home/2022022/djain02/packages/lib/python3.10/site-packages/monai/transforms/compose.py", line 111, in execute_compose
data = apply_transform(
File "/home/2022022/djain02/packages/lib/python3.10/site-packages/monai/transforms/transform.py", line 171, in apply_transform
raise RuntimeError(f"applying transform {transform}") from e
RuntimeError: applying transform <monai.transforms.io.dictionary.LoadImaged object at 0x145fb63fbc40>
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/2022022/djain02/packages/lib/python3.10/site-packages/torch/utils/data/_utils/worker.py", line 302, in _worker_loop
data = fetcher.fetch(index)
File "/home/2022022/djain02/packages/lib/python3.10/site-packages/torch/utils/data/_utils/fetch.py", line 58, in fetch
data = [self.dataset[idx] for idx in possibly_batched_index]
File "/home/2022022/djain02/packages/lib/python3.10/site-packages/torch/utils/data/_utils/fetch.py", line 58, in <listcomp>
data = [self.dataset[idx] for idx in possibly_batched_index]
File "/home/2022022/djain02/packages/lib/python3.10/site-packages/monai/data/dataset.py", line 112, in __getitem__
return self._transform(index)
File "/home/2022022/djain02/packages/lib/python3.10/site-packages/monai/data/dataset.py", line 98, in _transform
return apply_transform(self.transform, data_i) if self.transform is not None else data_i
File "/home/2022022/djain02/packages/lib/python3.10/site-packages/monai/transforms/transform.py", line 171, in apply_transform
raise RuntimeError(f"applying transform {transform}") from e
RuntimeError: applying transform <monai.transforms.compose.Compose object at 0x145fb641c400>
I am getting this error even with monai 1.1.0 and 1.3.0
As in my case it gave the suggestion to visit this website: https://docs.monai.io/en/latest/installation.html#installing-the-recommended-dependencies
As the error was due to monai not installing necessary libraries like ITK,etc... to load the images... So, this does help: pip install 'monai[all]==1.1.0'
It can resolved if you install numpy. version 1.21.6 with the monai version suggested in the requirement.txt I am working on this with brats dataset but I am wondering why my dice score is too low..... can one able to regenerate the results?