frankkramer-lab / MIScnn

A framework for Medical Image Segmentation with Convolutional Neural Networks and Deep Learning
GNU General Public License v3.0
400 stars 116 forks source link

FILE NOT FOUND ERROR #111

Closed Shivam-21-11 closed 2 years ago

Shivam-21-11 commented 2 years ago

I am trying to use cross-validation on kits19 dataset but i get this file not found error. google collab : recreateIssue

EDIT: the kits19 dataset doesnot have imaging.nii.gz file . Kits19

RemoteTraceback                           Traceback (most recent call last)
RemoteTraceback: 
"""
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/nibabel/loadsave.py", line 42, in load
    stat_result = os.stat(filename)
FileNotFoundError: [Errno 2] No such file or directory: '/content/drive/MyDrive/kits19/data/case_00012/imaging.nii.gz'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.7/multiprocessing/pool.py", line 121, in worker
    result = (True, func(*args, **kwds))
  File "/usr/lib/python3.7/multiprocessing/pool.py", line 44, in mapstar
    return list(map(*args))
  File "/usr/local/lib/python3.7/dist-packages/miscnn/processing/preprocessor.py", line 247, in prepare_sample_subfunctions
    sample = self.data_io.sample_loader(index, load_seg=training)
  File "/usr/local/lib/python3.7/dist-packages/miscnn/data_loading/data_io.py", line 88, in sample_loader
    image, extended = self.interface.load_image(index)
  File "/usr/local/lib/python3.7/dist-packages/miscnn/data_loading/interfaces/nifti_io.py", line 84, in load_image
    vol = nib.load(os.path.join(img_path, "imaging.nii.gz"))
  File "/usr/local/lib/python3.7/dist-packages/nibabel/loadsave.py", line 44, in load
    raise FileNotFoundError(f"No such file or no access: '{filename}'")
FileNotFoundError: No such file or no access: '/content/drive/MyDrive/kits19/data/case_00012/imaging.nii.gz'
"""

The above exception was the direct cause of the following exception:

FileNotFoundError                         Traceback (most recent call last)
<ipython-input-16-923019b7623a> in <module>()
     85 from miscnn.evaluation.cross_validation import cross_validation
     86 # Run cross-validation function
---> 87 model.train(validation_samples,epochs=100)
     88 #cross_validation(validation_samples, model, k_fold=3, epochs=1000, iterations=150,evaluation_path="evaluation", draw_figures=True, callbacks=[cb_lr, cb_es])

10 frames
/usr/local/lib/python3.7/dist-packages/nibabel/loadsave.py in load()
     42         stat_result = os.stat(filename)
     43     except OSError:
---> 44         raise FileNotFoundError(f"No such file or no access: '{filename}'")
     45     if stat_result.st_size <= 0:
     46         raise ImageFileError(f"Empty file: '{filename}'")

FileNotFoundError: No such file or no access: '/content/drive/MyDrive/kits19/data/case_00012/imaging.nii.gz'
muellerdo commented 2 years ago

Hello @Shivam-21-11,

did you follow the download instructions in their README? ;)

I quote:

Usage

To get the data for this challenge, please clone this repository (~500MB), and then run get_imaging.py. For example

git clone https://github.com/neheller/kits19
cd kits19
pip3 install -r requirements.txt
python3 -m starter_code.get_imaging

This will download the much larger and static image files from a separate source. The data/ directory should then be structured as follows

data
├── case_00000
|   ├── imaging.nii.gz
|   └── segmentation.nii.gz
├── case_00001
|   ├── imaging.nii.gz
|   └── segmentation.nii.gz
...
├── case_00209
|   ├── imaging.nii.gz
|   └── segmentation.nii.gz
└── kits.json

Cheers, Dominik