NifTK / NiftyNet

[unmaintained] An open-source convolutional neural networks platform for research in medical image analysis and image-guided therapy
http://niftynet.io
Apache License 2.0
1.36k stars 404 forks source link

ValueError: Unknown keywords in config file: By "keep_prob" did you mean "output_prob"? #171

Closed peter850706 closed 6 years ago

peter850706 commented 6 years ago

I created my own configuration file with NETWORK parameter 'keep_prob', but I got this error:

ValueError: Unknown keywords in config file: By "keep_prob" did you mean "output_prob"? "keep_prob" is not a valid option.

Then I check this link: http://niftynet.readthedocs.io/en/dev/config_spec.html, and I found the parameter 'keep_prob', can anyone solve this? Thank you!!

(By the way, I also check the source code in: http://niftynet.readthedocs.io/en/dev/_modules/niftynet/utilities/user_parameters_default.html#add_application_args, 'keep_prob' is in there.)

Zach-ER commented 6 years ago

Hi there, I think that the most likely explanation is that you don't have the latest version of niftynet: this feature was added recently. Try pulling the latest version and seeing if this problem persists?

peter850706 commented 6 years ago

Hi, I install the latest version of niftynet via pip, but I still got the same error. My server's OS is Ubuntu 17.10 (GNU/Linux 4.13.0-43-generic x86_64), and I build the environment via conda. Here are the error messages:

CRITICAL:tensorflow:Optional Python module cv2 not found, please install cv2 and retry if the application fails.
WARNING:niftynet: From ~/anaconda3/envs/test/lib/python3.6/site-packages/tensorflow/contrib/learn/python/learn/datasets/base.py:198: retry (from tensorflow.contrib.learn.python.learn.datasets.base) is deprecated and will be removed in a future version.
Instructions for updating:
Use the retry module or similar alternatives.
NiftyNet version 0.3.0
INFO:niftynet: Import [BRATSApp] from ~/niftynet/extensions/VIPCUP/wtnet/brats_seg_app.py.
Traceback (most recent call last):
  File "~/anaconda3/envs/test/bin/net_run", line 11, in <module>
    sys.exit(main())
  File "~/anaconda3/envs/test/lib/python3.6/site-packages/niftynet/__init__.py", line 64, in main
    system_param, input_data_param = user_parameters_parser.run()
  File "~/anaconda3/envs/test/lib/python3.6/site-packages/niftynet/utilities/user_parameters_parser.py", line 151, in run
    _check_config_file_keywords(config)
  File "~/anaconda3/envs/test/lib/python3.6/site-packages/niftynet/utilities/user_parameters_parser.py", line 276, in _check_config_file_keywords
    _raises_bad_keys(config_keywords, error_info='config file')
  File "~/anaconda3/envs/test/lib/python3.6/site-packages/niftynet/utilities/user_parameters_parser.py", line 311, in _raises_bad_keys
    key, closest, EPILOG_STRING, error_info))
ValueError: Unknown keywords in config file: By "keep_prob" did you mean "output_prob"?
 "keep_prob" is not a valid option.

======
For more information please visit:
http://niftynet.readthedocs.io/en/dev/config_spec.html
======

For the parameter 'volume_padding_mode', there exists the same situation. For the parameter 'dataset_to_infer', I can't change its value from 'Inference' to others. No matter how I change it (even overriding the arguments in command line), its real value is still 'Inference'(the value in settings_inference.txt can change, but actually the data are still 'Inference' set).

Other parameters can work correctly, I can't unstand why. Here is my configuration file:

whole_tumor_ini.docx

wyli commented 6 years ago

Hi @peter850706 you can install the latest version by pip install git+https://github.com/NifTK/NiftyNet.git

--

update (thanks @fepegar): you might have to install the required packages as well:

pip install tensorflow-gpu==1.7
pip install -r https://raw.githubusercontent.com/NifTK/NiftyNet/dev/requirements-gpu.txt
fepegar commented 6 years ago

@wyli When I try that command in a new conda environment I get errors asking for packaging, nibabel, etc. See discussion with @dzhoshkun in #145

peter850706 commented 6 years ago

Hi @wyli , the following are the commands that I rebuild my environment:

conda create -n nntest python=3.5 
source activate nntest
*conda install tensorflow-gpu==1.7.0  #(I tried pip first but I got error)
pip install -r https://raw.githubusercontent.com/NifTK/NiftyNet/dev/requirements-gpu.txt
pip install git+https://github.com/NifTK/NiftyNet.git
pip install scikit-image
pip install SimpleITK

Then 'keep_prob' and 'volume_padding_mode' can work correctly now. But 'dataset_to_infer' still remains the same situation as I mentioned above. (By the way, I use highres3dnet_small network to train my model, and I find out that there is no 'keep_prob' setting in the source code, but I don't get any error. Does it mean that no matter how I change 'keep_prob' value, my model won't have dropout layer? If it's truth, I think adding a warning to remind users would be better.)

--

update I think I understand why. For the code in segmentation_application.py, #L81 always gets Inference files. I think changing it to the following code would solve this: file_list = self.get_file_lists(data_partitioner) Perhaps #L85 should be changed, too. I pull a new request for this.

wyli commented 6 years ago

Thanks @peter850706 for tracking this down!

peter850706 commented 6 years ago

@wyli @Zach-ER @fepegar Thanks all of you for the replies!