aramis-lab / clinicadl

Framework for the reproducible processing of neuroimaging data with deep learning methods
https://clinicadl.readthedocs.io/
MIT License
162 stars 55 forks source link

Some problems encountered when running clinicadl train from the command line #6

Closed 921974496 closed 4 years ago

921974496 commented 4 years ago

TypeError: Object of type 'function' is not JSON serializable

921974496 commented 4 years ago

Traceback (most recent call last): File "/home/geng/anaconda3/envs/clinicadl_env/bin/clinicadl", line 11, in load_entry_point('clinicadl', 'console_scripts', 'clinicadl')() File "/home/geng/PycharmProjects/AD-DL/clinicadl/clinicadl/main.py", line 21, in main commandline_to_json(commandline, model_type) File "/home/geng/PycharmProjects/AD-DL/clinicadl/clinicadl/tools/deep_learning/iotools.py", line 173, in commandline_to_json json = json.dumps(commandline_arg_dic) File "/home/geng/anaconda3/envs/clinicadl_env/lib/python3.6/json/init.py", line 231, in dumps return _default_encoder.encode(obj) File "/home/geng/anaconda3/envs/clinicadl_env/lib/python3.6/json/encoder.py", line 199, in encode chunks = self.iterencode(o, _one_shot=True) File "/home/geng/anaconda3/envs/clinicadl_env/lib/python3.6/json/encoder.py", line 257, in iterencode return _iterencode(o, 0) File "/home/geng/anaconda3/envs/clinicadl_env/lib/python3.6/json/encoder.py", line 180, in default o.class.name) TypeError: Object of type 'function' is not JSON serializable

alexandreroutier commented 4 years ago

Hi!

Thanks for your interest in AD-DL. Could you tell us what was the command you typed? This will help us to understand your problem your encounter.

Best, Alex

921974496 commented 4 years ago

Hi!

Thanks for your interest in AD-DL. Could you tell us what was the command you typed? This will help us to understand your problem your encounter.

Best, Alex

clinicadl train -gpu patch /home/geng/ADNI/CAPS /home/geng/ADNI/tsv /home/geng/ADNI/resault Conv4_FC3

mdiazmel commented 4 years ago

clinicadl train -gpu patch /home/geng/ADNI/CAPS /home/geng/ADNI/tsv /home/geng/ADNI/resault Conv4_FC3

Hi,

Could you please verify that you're using the last commit of the repository ? (from the command line run git pull inside the AD-DL folder).

Thanks,

921974496 commented 4 years ago

clinicadl train -gpu patch /home/geng/ADNI/CAPS /home/geng/ADNI/tsv /home/geng/ADNI/resault Conv4_FC3

Hi,

Could you please verify that you're using the last commit of the repository ? (from the command line run git pull inside the AD-DL folder).

Thanks,

I copied it three months ago, but there will be some errors when installing the current version。 git clone git@github.com:aramis-lab/AD-DL.git

Cloning to 'AD-DL' ... git@github.com: Permission denied (publickey). fatal: Unable to read remote warehouse.

Please confirm that you have the correct access rights and that the warehouse exists.

alexandreroutier commented 4 years ago

I copied it three months ago, but there will be some errors when installing the current version。 git clone git@github.com:aramis-lab/AD-DL.git

Cloning to 'AD-DL' ... git@github.com: Permission denied (publickey). fatal: Unable to read remote warehouse.

Please confirm that you have the correct access rights and that the warehouse exists.

Simply replace:

git clone git@github.com:aramis-lab/AD-DL.git

by:

git clone https://github.com/aramis-lab/AD-DL.git

The "Permission denied" issue will not appear :)

921974496 commented 4 years ago

I copied it three months ago, but there will be some errors when installing the current version。 git clone git@github.com:aramis-lab/AD-DL.git Cloning to 'AD-DL' ... git@github.com: Permission denied (publickey). fatal: Unable to read remote warehouse. Please confirm that you have the correct access rights and that the warehouse exists.

Simply replace:

git clone git@github.com:aramis-lab/AD-DL.git

by:

git clone https://github.com/aramis-lab/AD-DL.git

The "Permission denied" issue will not appear :)

Thanks,

921974496 commented 4 years ago

clinicadl preprocessing /home/geng/ADNI/CN /home/geng/ADNI/CN_CAPS /home/geng/ADNI/CN.tsv /home/geng/ADNI/CN_WORKING

RuntimeError: Workflow did not execute cleanly. Check log for details

alexandreroutier commented 4 years ago

clinicadl preprocessing /home/geng/ADNI/CN /home/geng/ADNI/CN_CAPS /home/geng/ADNI/CN.tsv /home/geng/ADNI/CN_WORKING

RuntimeError: Workflow did not execute cleanly. Check log for details Hello,

Could you type the following command:

nipypecli crash <crash_file_pklz>

? <crash_file_pklz> is a crash file *.pklz generated by Nipype when executing AD-DL. It looks like crash-20200504-121531-username-involved_function-very_long_hash.pklz.

Best, Alexandre

921974496 commented 4 years ago

crash-20200504-121531-username-involved_function-very_long_hash.pklz

[Node] Error on "t1_linear_dl.cropnifti" (/home/geng/ADNI/CN_WORKING/t1_linear_dl/19e7eb285f230922933ce76271dd368a9a228458/cropnifti) 200505-10:55:16,487 nipype.workflow ERROR: Node cropnifti.a01 failed to run on host ubuntu. 200505-10:55:16,488 nipype.workflow ERROR: Saving crash info to /home/geng/crash-20200505-105516-geng-cropnifti.a01-cf9d3e2a-307e-4b48-998f-3691e432a1af.pklz Traceback (most recent call last): File "/home/geng/anaconda3/envs/clinicadl_env/lib/python3.6/site-packages/nipype/pipeline/plugins/multiproc.py", line 148, in init mp_context=mp_context, TypeError: init() got an unexpected keyword argument 'initializer'

921974496 commented 4 years ago

crash-20200504-121531-username-involved_function-very_long_hash.pklz

[Node] Error on "t1_linear_dl.cropnifti" (/home/geng/ADNI/CN_WORKING/t1_linear_dl/19e7eb285f230922933ce76271dd368a9a228458/cropnifti) 200505-10:55:16,487 nipype.workflow ERROR: Node cropnifti.a01 failed to run on host ubuntu. 200505-10:55:16,488 nipype.workflow ERROR: Saving crash info to /home/geng/crash-20200505-105516-geng-cropnifti.a01-cf9d3e2a-307e-4b48-998f-3691e432a1af.pklz Traceback (most recent call last): File "/home/geng/anaconda3/envs/clinicadl_env/lib/python3.6/site-packages/nipype/pipeline/plugins/multiproc.py", line 148, in init mp_context=mp_context, TypeError: init() got an unexpected keyword argument 'initializer'

(clinicadl_env) geng@ubuntu:~$ nipypecli crash /home/geng/crash-20200505-105516-geng-cropnifti.a01-cf9d3e2a-307e-4b48-998f-3691e432a1af.pklz

File: /home/geng/crash-20200505-105516-geng-cropnifti.a01-cf9d3e2a-307e-4b48-998f-3691e432a1af.pklz Node: t1_linear_dl.cropnifti Working directory: /home/geng/ADNI/CN_WORKING/t1_linear_dl/19e7eb285f230922933ce76271dd368a9a228458/cropnifti

Node inputs:

function_str = def crop_nifti(input_img, ref_crop): """

:param input_img:
:param crop_sagittal:
:param crop_coronal:
:param crop_axial:
:return:
"""

import nibabel as nib
import os
import numpy as np
from nilearn.image import resample_img, resample_to_img
from nibabel.spatialimages import SpatialImage

basedir = os.getcwd()
# crop_ref = crop_img(ref_img, rtol=0.5)
# crop_ref.to_filename(os.path.join(basedir, os.path.basename(input_img).split('.nii')[0] + '_cropped_template.nii.gz'))
# crop_template = os.path.join(basedir, os.path.basename(input_img).split('.nii')[0] + '_cropped_template.nii.gz')

# resample the individual MRI onto the cropped template image
crop_img = resample_to_img(input_img, ref_crop, force_resample=True)
crop_img.to_filename(os.path.join(basedir, os.path.basename(input_img).split('.nii')[0] + '_cropped.nii.gz'))

output_img = os.path.join(basedir, os.path.basename(input_img).split('.nii')[0] + '_cropped.nii.gz')
crop_template = ref_crop

return output_img, crop_template

input_img = /home/geng/ADNI/CN_WORKING/t1_linear_dl/19e7eb285f230922933ce76271dd368a9a228458/antsRegistrationSynQuick/sub-ADNI057S0934_ses-M24Warped.nii.gz ref_crop = /home/geng/AD-DL/clinicadl/clinicadl/resources/masks/ref_cropped_template.nii.gz

Traceback: Traceback (most recent call last): File "/home/geng/anaconda3/envs/clinicadl_env/lib/python3.6/site-packages/nipype/pipeline/plugins/multiproc.py", line 148, in init mp_context=mp_context, TypeError: init() got an unexpected keyword argument 'initializer'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/geng/anaconda3/envs/clinicadl_env/lib/python3.6/site-packages/nipype/pipeline/plugins/multiproc.py", line 67, in run_node result["result"] = node.run(updatehash=updatehash) File "/home/geng/anaconda3/envs/clinicadl_env/lib/python3.6/site-packages/nipype/pipeline/engine/nodes.py", line 516, in run result = self._run_interface(execute=True) File "/home/geng/anaconda3/envs/clinicadl_env/lib/python3.6/site-packages/nipype/pipeline/engine/nodes.py", line 635, in _run_interface return self._run_command(execute) File "/home/geng/anaconda3/envs/clinicadl_env/lib/python3.6/site-packages/nipype/pipeline/engine/nodes.py", line 741, in _run_command result = self._interface.run(cwd=outdir) File "/home/geng/anaconda3/envs/clinicadl_env/lib/python3.6/site-packages/nipype/interfaces/base/core.py", line 397, in run runtime = self._run_interface(runtime) File "/home/geng/anaconda3/envs/clinicadl_env/lib/python3.6/site-packages/nipype/interfaces/utility/wrappers.py", line 142, in _run_interface out = function_handle(**args) File "", line 23, in crop_nifti TypeError: resample_to_img() got an unexpected keyword argument 'force_resample'

mdiazmel commented 4 years ago

It seems to be related to the issue #2305 from nilearn. Could you tell us, please, what is the version of nilearn that you have installed ?

alexandreroutier commented 4 years ago

Dear user,

Are you still facing issues?

Best, Alex

921974496 commented 4 years ago

Thanks, I have solved this problem with your help。Thank you very much。

------------------ 原始邮件 ------------------ 发件人: "Alexandre Routier"<notifications@github.com>; 发送时间: 2020年5月18日(星期一) 下午4:02 收件人: "aramis-lab/AD-DL"<AD-DL@noreply.github.com>; 抄送: "无所谓"<921974496@qq.com>; "Author"<author@noreply.github.com>; 主题: Re: [aramis-lab/AD-DL] Some problems encountered when running clinicadl train from the command line (#6)

Dear user,

Are you still facing issues?

Best, Alex

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.