junyuchen245 / TransMorph_Transformer_for_Medical_Image_Registration

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

Problem in the val step. Could not get enough values to unpack in pkload #19

Closed clinton81 closed 2 years ago

clinton81 commented 2 years ago

Hi, junyuchen.

I down load the dataset from Google Drive (1.44G). And I run the train.py.

The training phase was successful. But it fails in the validation phase: When running into the getitem of class JHUBrainInferDataset , it fails here: x, y, x_seg, y_seg = pkload(path).

I can only get 2 values from pkload(). Not 4. The above line would throws an exception.

junyuchen245 commented 2 years ago

Hi @clinton81 ,

I believe you are not using the right scripts. As I described here, you should use scripts provided in this folder for both training and testing on IXI dataset.

Thanks, Junyu

clinton81 commented 2 years ago

Hi junyuchen,

Sorry, I can't find the exact script. There are so many scripts there that I can't figure out which one is. Also, I look at the page you mentioned above, I can find nothing to make the pickle.load read out 4 results.

Could you please tell me which script that can let I read out 4 results at "return pickle.load(f)"?

junyuchen245 commented 2 years ago

@clinton81 The script you are using was made for the JHU dataset, in which each .pkl contains 4 images, i.e., x, y, x_seg, and y_seg. However, for the IXI dataset, each .pkl file contains only two images, i.e., the image and the corresponding segmentation. Additionally, the JHU dataset was used for inter-patient registration, whereas IXI was used for atlas-to-patient registration. For these reasons, the script you use is not going to work on the IXI dataset.

IXI/ contains all the scripts we used for the IXI dataset, this includes TransMorph and all other baseline methods (e.g., VoxelMoprh, CycleMorph, etc.).

If you are trying to use train TransMorph on the IXI dataset, please refer to this script: https://github.com/junyuchen245/TransMorph_Transformer_for_Medical_Image_Registration/blob/main/IXI/TransMorph/train_TransMorph.py

For dataset IO, please refer to: https://github.com/junyuchen245/TransMorph_Transformer_for_Medical_Image_Registration/blob/d7c00e0f4c8b60ed96800eaca4602e9685a7148a/IXI/TransMorph/data/datasets.py#L10-L25 and https://github.com/junyuchen245/TransMorph_Transformer_for_Medical_Image_Registration/blob/d7c00e0f4c8b60ed96800eaca4602e9685a7148a/IXI/TransMorph/data/datasets.py#L54-L69

Detailed instructions on how to apply the pre-trained weights to replicate our results were provided here. I think it's better for you to start from there.

clinton81 commented 2 years ago

Ok, Got it. Thanks very much.