MIC-DKFZ / TractSeg

Automatic White Matter Bundle Segmentation
Apache License 2.0
222 stars 74 forks source link

EOFError: Ran out of input #241

Open chawyuan opened 1 year ago

chawyuan commented 1 year ago

Hi experts, My system was linux 20.04 with python 3.7 When I run the TractSeg -i Diffusion.nii.gz --raw_diffusion_input, it presented : Creating brain mask... Warning: An input intended to be a single 3D volume has multiple timepoints. Input will be truncated to first volume, but this functionality is deprecated and will be removed in a future release. Creating peaks (1 of 3)... Creating peaks (2 of 3)... Creating peaks (3 of 3)... Loading weights from: /home/ubuntu/.tractseg/pretrained_weights_tract_segmentation_v3.npz Traceback (most recent call last): File "/home/ubuntu/anaconda3/envs/myenv/bin/TractSeg", line 420, in main() File "/home/ubuntu/anaconda3/envs/myenv/bin/TractSeg", line 337, in main unit_test=args.test) File "/home/ubuntu/anaconda3/envs/myenv/lib/python3.7/site-packages/tractseg/python_api.py", line 157, in run_tractseg model = BaseModel(Config, inference=True) File "/home/ubuntu/anaconda3/envs/myenv/lib/python3.7/site-packages/tractseg/models/base_model.py", line 106, in init self.load_model(join(self.Config.EXP_PATH, self.Config.WEIGHTS_PATH)) File "/home/ubuntu/anaconda3/envs/myenv/lib/python3.7/site-packages/tractseg/models/base_model.py", line 280, in load_model pytorch_utils.load_checkpoint(path, unet=self.net) File "/home/ubuntu/anaconda3/envs/myenv/lib/python3.7/site-packages/tractseg/libs/pytorch_utils.py", line 20, in load_checkpoint checkpoint = torch.load(path, map_location=lambda storage, loc: storage) File "/home/ubuntu/anaconda3/envs/myenv/lib/python3.7/site-packages/torch/serialization.py", line 795, in load return _legacy_load(opened_file, map_location, pickle_module, pickle_load_args) File "/home/ubuntu/anaconda3/envs/myenv/lib/python3.7/site-packages/torch/serialization.py", line 1002, in _legacy_load magic_number = pickle_module.load(f, pickle_load_args) EOFError: Ran out of input

I want to know how to solve this error?

chawyuan commented 1 year ago

Although I created new conda env and built python from version 3.6 to 3.10, it still not worked

wasserth commented 1 year ago

It might be the case that the downloaded model weights are corrupted. Try rm -r ~/.totalseg to remove them and run again.

yutinghe99 commented 1 year ago

Hello, experts @wasserth I have met the same error, and tried rm -r ~/.totalseg, returned with no such file. First I met the Failed to establish a new connection: [Errno 111] Connection refused'), then I typed unset ALL_PROXY && unset all_proxy, the [Errno 111] disappeared. And when I tried to rerun TractSeg -i peaks.nii.gz -o template/tract_segmentation/ --output_type tract_segmentation, the EOFError: Ran out of input showed. All these commands run from the top of the 'template' folder. My system is ubuntu 20.04, anaconda3, python 3.10.

How can I fix the problem? Thanks in advance.

chawyuan commented 1 year ago

I am sorry, I haven’t solved this problem yet.

Yuan

On Mon, Jun 19, 2023 at 15:09 yutinghe99 @.***> wrote:

Hello, experts, I have met the same error, and tried rm -r ~/.totalseg, returned with no such file. First I met the Failed to establish a new connection: [Errno 111] Connection refused'), then I typed unset ALL_PROXY && unset all_proxy, the [Errno 111] disappeared. And when I tried to rerun TractSeg -i peaks.nii.gz -o template/tract_segmentation/ --output_type tract_segmentation, the EOFError: Ran out of input showed. All these commands run from the top of the 'template' folder. How can I fix the problem? Thanks in advance.

— Reply to this email directly, view it on GitHub https://github.com/MIC-DKFZ/TractSeg/issues/241#issuecomment-1597165924, or unsubscribe https://github.com/notifications/unsubscribe-auth/BAQ6C5QPXRWOIBKUUHBPB3TXMBFRZANCNFSM6AAAAAAZEO3OQ4 . You are receiving this because you authored the thread.Message ID: @.***>

yutinghe99 commented 1 year ago

Hi Yuan,

i solved this error. It is because the internet. Your should export the Port of your VPN on your terminal, try rm -r ~/.tractseg, then run TractSeg again, it would succeed.

chawyuan commented 1 year ago

Thanks, I'll check it out.

On Mon, Jun 26, 2023 at 16:08 yutinghe99 @.***> wrote:

Hi Yuan,

i solved this error. It is because the internet. Your should export the Port of your VPN on your terminal, try rm -r ~/.tractseg, then run TractSeg again, it would succeed.

— Reply to this email directly, view it on GitHub https://github.com/MIC-DKFZ/TractSeg/issues/241#issuecomment-1607572892, or unsubscribe https://github.com/notifications/unsubscribe-auth/BAQ6C5XZP4VJGMBY3IGREB3XNGJWNANCNFSM6AAAAAAZEO3OQ4 . You are receiving this because you authored the thread.Message ID: @.***>

amirhusseinab commented 9 months ago

Hi all,

Sorry to bring this old issue up again. I had the same problem running it on the university's HPC using Singularity. My solution was to manually download those three files and put them into ~/.tractseg/ and rename them into their corresponding "pretrainedweights*" name. Thought maybe useful for someone.

giovannividetta commented 5 months ago

Hello, @yutinghe99 !

Applying for the first time TractSeg in order to reconstruct white matter bundles, I had the same problem of @chawyuan and I tried your solution on data uploaded by @wasserth within his Github repository. However, now when I run TractSeg -i Diffusion.nii.gz --raw_diffusion_input, the following error message pops up me:

_Creating brain mask... Warning: An input intended to be a single 3D volume has multiple timepoints. Input will be truncated to first volume, but this functionality is deprecated and will be removed in a future release. Creating peaks (1 of 3)... Creating peaks (2 of 3)... Creating peaks (3 of 3)... Loading weights from: /Users/brainmilab/.tractseg/pretrained_weights_tract_segmentation_v3.npz Processing direction (1 of 3) zsh: segmentation fault TractSeg -i Diffusion.nii.gz --raw_diffusioninput

Any suggestions? Did I make a mess thoughtlessly? Thanks in advance for your support!

yutinghe99 commented 5 months ago

Hello, @giovannividetta

Sorry, I should have mentioned that my solution is only for people who trying to work on TractSeg in China since we use a different Internet from other countries. You may have a look at the solution given by @amirhusseinab.

Hi all,

Sorry to bring this old issue up again. I had the same problem running it on the university's HPC using Singularity. My solution was to manually download those three files and put them into ~/.tractseg/ and rename them into their corresponding "pretrainedweights*" name. Thought maybe useful for someone.

Best wishes, Yuting

giovannividetta commented 5 months ago

Oh, ok, I did not get it! Thank you again @yutinghe99 for your useful support!

However, I have already tried solution proposed by @amirhusseinab and I have downloaded all pretrained weights, but the problem persists.

_(base) brainmilab@iMac-di-Brainmi ~ % cd ~/.tractseg/ (base) brainmilab@iMac-di-Brainmi .tractseg % ls pretrained_weights_dm_regression_v2.npz pretrained_weights_dm_regression_xtract_v1.npz pretrained_weights_endings_segmentation_v4.npz pretrained_weights_peak_regression_part1_v2.npz pretrained_weights_peak_regression_part2_v2.npz pretrained_weights_peak_regression_part3_v2.npz pretrained_weights_peak_regression_part4_v2.npz pretrained_weights_tract_segmentation_v3.npz pretrained_weights_tract_segmentation_xtractv1.npz

I used both an Italian internet connection and an European internet connection for university accounts (eduroam)

ravenep commented 3 months ago

Hi all,

Sorry to bring this old issue up again. I had the same problem running it on the university's HPC using Singularity. My solution was to manually download those three files and put them into ~/.tractseg/ and rename them into their corresponding "pretrainedweights*" name. Thought maybe useful for someone.

This worked well for me, thank you for posting @amirhusseinab