junyuchen245 / TransMorph_Transformer_for_Medical_Image_Registration

TransMorph: Transformer for Unsupervised Medical Image Registration (PyTorch)
MIT License
453 stars 76 forks source link

Training problems on the IXI dataset #36

Closed Yongxin1120 closed 2 years ago

Yongxin1120 commented 2 years ago

Hi,

I encountered some difficulties in training the model, I tried to use the preprocessed IXI dataset for model training, including "VoxelMorph", "CycleMorph", "TransMorph", but all encountered the same problem: "ValueError: num_samples should be a positive integer value, But got num_samples=0 "This problem appears in the train.py file" train_loader = DataLoader(train_set, batch_size=batch_size, shuffle=True, Num_workers =4, pin_memory=True) ", I found that I could fix this by setting shuffle=Flase, but then a new problem appeared: "UnboundLocalError: Local variable 'def_out' referenced Before Assignment ", this problem appears in the train.py file "pred_fig = comput_fig(def_out)". I can't deal with this new problem. I would like to ask you for help. Maybe I cannot modify the shuffle parameter in the source program. What is the cause and solution of the first problem? I've been using both my laptop and workstation, so I rule out the possibility of hardware causing the problem.

Best

Yongxin

image

image

image

image

junyuchen245 commented 2 years ago

Hi @Yongxin1120 ,

It is very likely that you didn't set training and validation folder correctly. This error occurs because the folders that contain training and validation datasets are empty.

Junyu

Yongxin1120 commented 2 years ago

Hi @Yongxin1120 ,

It is very likely that you didn't set training and validation folder correctly. This error occurs because the folders that contain training and validation datasets are empty.

Junyu

Hi Junyu

Thank you very much for your reply, but this problem should not exist, because I have used the data set you provided and modified the corresponding path. I will check the data problem you raised in detail again.

Best Yongxin

junyuchen245 commented 2 years ago

@Yongxin1120 It maybe useful to try print(glob.glob(train_dir+'*.pkl')) and see if it prints all the file names.

Junyu

Yongxin1120 commented 2 years ago

Hi Junyu

Thank you very much for your careful help. I'll try it now

Best

Yongxin