tureckova / abdomen-ct-image-segmentation Goto Github PK
View Code? Open in Web Editor NEWThe code for the paper Improving CT Image Tumor Segmentation Through Deep Supervision and Attentional Gates.
License: Apache License 2.0
The code for the paper Improving CT Image Tumor Segmentation Through Deep Supervision and Attentional Gates.
License: Apache License 2.0
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?
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
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.
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.
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.
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.