Coder Social home page Coder Social logo

tureckova / abdomen-ct-image-segmentation Goto Github PK

View Code? Open in Web Editor NEW
29.0 29.0 8.0 229 KB

The code for the paper Improving CT Image Tumor Segmentation Through Deep Supervision and Attentional Gates.

License: Apache License 2.0

Python 100.00%
attention medical-imaging nnu-net segmentation

abdomen-ct-image-segmentation's People

Contributors

fabianisensee avatar tureckova avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

abdomen-ct-image-segmentation's Issues

ModuleNotFoundError: No module named 'nnunet.paths'

Hello! I have encountered some problems. After installing nnunet according to the steps, I run the command "python3 experiment_planning/plan_and_preprocess_task.py -t Task017_AbdominalOrganSegmentation -p 8", and there is an error " ModuleNotFoundError: No module named'nnunet.paths' ". Why does this happen?

ExperimentPlanner bug

Hi

I am working on reproducing your attention gated version of nnUNet.

When I run python3 experiment_planning/plan_and_preprocess_task.py -t TaskXX_XXXX -p X

It fails after populating cropped_output_dir due to an error in line 133 of plan_and_preprocess_task.py, that ExperimentPlanner does not exist.

Here I noted that in lines 123 and 124 you had:

from nnunet.experiment_planning.experiment_planner_baseline_2DUNet import ExperimentPlanner2D
# from nnunet.experiment_planning.experiment_planner_baseline_3DUNet import ExperimentPlanner

Which I am guessing should be changed to:

# from nnunet.experiment_planning.experiment_planner_baseline_2DUNet import ExperimentPlanner2D
from nnunet.experiment_planning.experiment_planner_baseline_3DUNet import ExperimentPlanner

Do you agree on this?

Best regards
David

No --vnet=[0/1] flag in inference/predict_simple.py

The guide says to use the line

python inference/predict_simple.py -i INPUT_FOLDER -o OUTPUT_FOLDER -t TaskXX_MY_DATASET -tr nnUNetTrainer -m [3d_fullres/3d_lowres] --vnet=[0/1]
in order to do inference.

But the --vnet flag does not exist for inference/predict_simple.py.

So the scripts will crash if used in this way.

Update request for requirements file: batchgenerators>=0.19.3 should be batchgenerators==0.19.3

I got longer error while following the readme and running python3 experiment_planning/plan_and_preprocess_task.py -t TaskXXX_Pancreas -p X. The error end with:
TypeError: resize_segmentation() got an unexpected keyword argument 'cval'

Copying the full error below for reference.

Turns out the error was due to the cval argument being removed in the latest version of batchgenerators which was install since the requirements file has:
batchgenerators>=0.19.3

I think this should be updated to simply:
batchgenerators==0.19.3

The full error which was fixed by this change is:
multiprocessing.pool.RemoteTraceback:
"""
Traceback (most recent call last):
File "/homes/kovacs/anaconda3/envs/tureckova_dgk1/lib/python3.9/multiprocessing/pool.py", line 125, in worker
result = (True, func(*args, **kwds))
File "/homes/kovacs/anaconda3/envs/tureckova_dgk1/lib/python3.9/multiprocessing/pool.py", line 48, in mapstar
return list(map(*args))
File "/homes/kovacs/project_scripts/hnc_segmentation/tureckova/Abdomen-CT-Image-Segmentation/nnunet/preprocessing/preprocessing.py", line 270, in _run_star
data, seg, properties = self.resample_and_normalize(data, target_spacing,
File "/homes/kovacs/project_scripts/hnc_segmentation/tureckova/Abdomen-CT-Image-Segmentation/nnunet/preprocessing/preprocessing.py", line 204, in resample_and_normalize
data, seg = resample_patient(data, seg, np.array(properties["original_spacing"]), target_spacing, 3, 1,
File "/homes/kovacs/project_scripts/hnc_segmentation/tureckova/Abdomen-CT-Image-Segmentation/nnunet/preprocessing/preprocessing.py", line 83, in resample_patient
seg_reshaped = resample_data_or_seg(seg, new_shape, True, axis, order_seg, do_separate_z, cval=cval_seg,
File "/homes/kovacs/project_scripts/hnc_segmentation/tureckova/Abdomen-CT-Image-Segmentation/nnunet/preprocessing/preprocessing.py", line 131, in resample_data_or_seg
reshaped_data.append(resize_fn(data[c, slice_id], new_shape_2d, order, cval=cval, **kwargs))
TypeError: resize_segmentation() got an unexpected keyword argument 'cval'
"""
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/homes/kovacs/project_scripts/hnc_segmentation/tureckova/Abdomen-CT-Image-Segmentation/nnunet/experiment_planning/plan_and_preprocess_task.py", line 236, in
plan_and_preprocess(task, processes, no_preprocessing)
File "/homes/kovacs/project_scripts/hnc_segmentation/tureckova/Abdomen-CT-Image-Segmentation/nnunet/experiment_planning/plan_and_preprocess_task.py", line 136, in plan_and_preprocess
exp_planner.run_preprocessing(num_threads)
File "/homes/kovacs/project_scripts/hnc_segmentation/tureckova/Abdomen-CT-Image-Segmentation/nnunet/experiment_planning/experiment_planner_baseline_3DUNet.py", line 383, in run_preprocessing
preprocessor.run(target_spacings, self.folder_with_cropped_data, self.preprocessed_output_folder,
File "/homes/kovacs/project_scripts/hnc_segmentation/tureckova/Abdomen-CT-Image-Segmentation/nnunet/preprocessing/preprocessing.py", line 311, in run
p.map(self._run_star, all_args)
File "/homes/kovacs/anaconda3/envs/tureckova_dgk1/lib/python3.9/multiprocessing/pool.py", line 364, in map
return self._map_async(func, iterable, mapstar, chunksize).get()
File "/homes/kovacs/anaconda3/envs/tureckova_dgk1/lib/python3.9/multiprocessing/pool.py", line 771, in get
raise self._value
TypeError: resize_segmentation() got an unexpected keyword argument 'cval'

Simply did
pip uninstall batchgenerators
pip install batchgenerators==0.19.3

and the function stopped producing this error.

Folder conflict during model training when changing vnet=[0/1]

If I run

python run/run_training.py 3d_lowres nnUNetTrainer Task500_HNC01 0 --ndet --vnet=0

and then

python run/run_training.py 3d_lowres nnUNetTrainer Task500_HNC01 0 --ndet --vnet=1

The contents of the results folder at network_training_output_dir is overwritten by the new model.

Failing install fix

When doing pip install -e . I had to add py_modules=[], in the setup.py file to avoid the error below.

ERROR: Command errored out with exit status 1:
command: /homes/kovacs/anaconda3/envs/tureckova_dgk1_vnet/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/homes/kovacs/project_scripts/hnc_segmentation/tureckova_vnet/Abdomen-CT-Image-Segmentation/setup.py'"'"'; file='"'"'/homes/kovacs/project_scripts/hnc_segmentation/tureckova_vnet/Abdomen-CT-Image-Segmentation/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(file) if os.path.exists(file) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-yjk8gz6f
cwd: /homes/kovacs/project_scripts/hnc_segmentation/tureckova_vnet/Abdomen-CT-Image-Segmentation/
Complete output (14 lines):
error: Multiple top-level packages discovered in a flat-layout: ['nnunet', 'plans_files'].

To avoid accidental inclusion of unwanted files or directories,
setuptools will not proceed with this build.

If you are trying to create a single distribution with multiple packages
on purpose, you should not rely on automatic discovery.
Instead, consider the following options:

1. set up custom discovery (`find` directive with `include` or `exclude`)
2. use a `src-layout`
3. explicitly set `py_modules` or `packages` with a list of names

To find more information, look for "package discovery" on setuptools docs.
----------------------------------------

WARNING: Discarding file:///homes/kovacs/project_scripts/hnc_segmentation/tureckova_vnet/Abdomen-CT-Image-Segmentation. Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.