zaccharieramzi / fastmri-reproducible-benchmark

Try several methods for MRI reconstruction on the fastmri dataset. Home to the XPDNet, runner-up of the 2020 fastMRI challenge.
https://fastmri.org/leaderboards
MIT License
151 stars 50 forks source link

About ZeroFilled2DSequence and Masked2DSequence in Unet #108

Closed fharman closed 3 years ago

fharman commented 3 years ago

Hi everyone,

I want to ask about class ZeroFilled2DSequence and Masked2DSequence in Fastmri_sequences.py. When i wanted to test the Fastmri single coil test and val dataset in Unet reconstruction in terms of both metrics and reconstructions, i realized that val_gen scaled and test_gen_scaled had 50 h5 files names in spite of being available 108 h5 file in the path folder. So the numbers of reconstruction of unet results and metrics results are inconsistent with number of test and val path . To see the difference, i looked at the filenames in test_gen_scaled, names are shown like this:

'/content/drive/My Drive/UNET_Colab/knee_singlecoil_test_v2/singlecoil_test_v2/file1000055_v2.h5', '/content/drive/My Drive/UNET_Colab/knee_singlecoil_test_v2/singlecoil_test_v2/file1000093_v2.h5', '/content/drive/My Drive/UNET_Colab/knee_singlecoil_test_v2/singlecoil_test_v2/file1000128_v2.h5',

But in the test path, there are some names that are not available in test_gen_scaled. These italics(missing paths in test_gen_scaled) are illustrated like this:

/content/drive/My Drive/UNET_Colab/knee_singlecoil_test_v2/singlecoil_test_v2/_file1000022v2.h5 /content/drive/My Drive/UNET_Colab/knee_singlecoil_test_v2/singlecoil_test_v2/_file1000036v2.h5 '/content/drive/My Drive/UNET_Colab/knee_singlecoil_test_v2/singlecoil_test_v2/file1000055_v2.h5, /content/drive/My Drive/UNET_Colab/knee_singlecoil_test_v2/singlecoil_test_v2/_file1000056v2.h5 /content/drive/My Drive/UNET_Colab/knee_singlecoil_test_v2/singlecoil_test_v2/_file1000063v2.h5 '/content/drive/My Drive/UNET_Colab/knee_singlecoil_test_v2/singlecoil_test_v2/file1000093_v2.h5', '/content/drive/My Drive/UNET_Colab/knee_singlecoil_test_v2/singlecoil_test_v2/file1000128_v2.h5',

Why test_gen_scaled , test_gen_zero (these are shown in val datasets,too) are skipping 2 h5 files in filepath? This changes the results in metrics and numbers of reconstruction in unet.

If you return, i will appreciate.

Best regards,

zaccharieramzi commented 3 years ago

Hi @fharman ,

Can you show me the code that you used to generate these outputs?

Mainly, are you using only one contrast?

fharman commented 3 years ago

Hi Zaccharie,

test_path = '/content/drive/My Drive/UNET_Colab/knee_singlecoil_test_v2/singlecoil_test_v2/' test_gen_zero = ZeroFilled2DSequence(test_path, af=AF, norm=True, mode='testing', mask_seed=0) test_gen_scaled = Masked2DSequence(test_path, mode='testing', af=AF, scale_factor=1e6, mask_seed=0)

len(test_gen_scaled) 50

import os path, dirs, files = next(os.walk("/content/drive/My Drive/UNET_Colab/knee_singlecoil_test_v2/singlecoil_test_v2/")) file_count = len(files) print(file_count) 108

I don't overcome this problem. Yes, i just only used Fastmri Single Coil Knee Dataset. (PDFS)

Best regards,

zaccharieramzi commented 3 years ago

With this setting, you are actually considering all contrasts. However, you are only considering the acceleration factor AF (I don't to what it is set). So you are only getting the test files that have been retrospectively under-sampled with and acceleration factor of AF, which is roughly half of them.

fharman commented 3 years ago

AF=4, What is your recommendation for full set path? Because with these commands, path files are skipped by 2 files. Consequently, path file numbers are decreasing the half.

Thank you for your return,

Best regards,

zaccharieramzi commented 3 years ago

I recommend treating both acceleration factors separately. You would do the same thing just with AF=4 and AF=8.

With the current implementation it's not possible to have a a generator for both acceleration factors but I intend to keep it that way since I think it's important to separate both. You can still have a model that reconstructs agnostically the 2 acceleration factors, you would just need to run it twice.