Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

About helpers/nn_mri.py file and import lrelu #101

Closed
fharman opened this issue Oct 16, 2020 · 15 comments · Fixed by #113
Closed

About helpers/nn_mri.py file and import lrelu #101

fharman opened this issue Oct 16, 2020 · 15 comments · Fixed by #113
Labels
bug Something isn't working

Comments

@fharman
Copy link

fharman commented Oct 16, 2020

Hi everyone,

For the testing , i want to run qualitative_validation_for_net.ipynb. But there is an error in this line.

from fastmri_recon.helpers.nn_mri import lrelu

No module named 'fastmri_recon.helpers'

In fastmri_recon folder , there is no helpers folder and consequently there is no file named nn_mri.py in helpers folder.

Is there any problem while uploading the helpers folder and its contexts?

Best regards,

@zaccharieramzi zaccharieramzi added the bug Something isn't working label Oct 16, 2020
@zaccharieramzi
Copy link
Owner

Hi Fatma,

Yes this is to be expected in those notebooks as they are pretty old now and not maintained. They should still provide a good basis for testing the networks trained with the functional API, so you could try to just prune them to what you need.

When I have time I will try to correct them in order to have them work in the current state, or even better provide evaluation scripts for the functional networks.

@fharman
Copy link
Author

fharman commented Oct 16, 2020

etty old now and not maintained. They should still provide a good basis for testing the networks trained with the functional API, so you could try to just prune them to what you need.

thank you, i am waiting for your information

@fharman
Copy link
Author

fharman commented Oct 16, 2020

Hello again,

when i prune the code for reconstruction (comment all lines that included helpers folder), i encountered another problem that included helpers folder.

(#from fastmri_recon.helpers.nn_mri import lrelu
#from fastmri_recon.helpers.reconstruction import reco_and_gt_unet_from_val_file, reco_and_gt_net_from_val_file, reco_and_gt_zfilled_from_val_file)

NameError:name 'reco_and_gt_unet_from_val_file' is not defined

from fastmri_recon.helpers.reconstruction import reco_and_gt_unet_from_val_file, reco_and_gt_net_from_val_file, reco_and_gt_zfilled_from_val_file

As it is seen, in reconstruction.py , it is needed to import reco_and_gt_unet_from_val_file. In all_net_params section,

'val_gen': val_gen_zero,
'run_id': 'unet_af4_1569210349',
'reco_function': reco_and_gt_unet_from_val_file,
},

these lines calls the reco_and_gt_unet_from_val_file for the reconstruction. So helpers folder contains all these reconstruction.py and nn_mri.py files.

best regards,

@zaccharieramzi
Copy link
Owner

zaccharieramzi commented Oct 16, 2020

Sorry about that.

@fharman
Copy link
Author

fharman commented Oct 16, 2020

Sorry about that.

ok i will revise it. thank you:)

@fharman
Copy link
Author

fharman commented Oct 16, 2020

Hi again,

Sorry for disturbance. But i encountered the problem in all_net_params section named NameError: name 'lrelu' is not defined.

This function is derived from nonexisting nn_mri.py. Because lrelu is tried to import from there. Consequently, testing is not run .

Best regards,

@zaccharieramzi
Copy link
Owner

Hmm but did you use lrelu in your unet model ?

If so then the simplest I can do is just to add in an evaluation notebook to cover the old models.

@fharman
Copy link
Author

fharman commented Oct 19, 2020 via email

@zaccharieramzi
Copy link
Owner

If you used the current parameters listed in unet_approach_af4.py you don't need lrelu.

@fharman
Copy link
Author

fharman commented Oct 19, 2020 via email

@fharman
Copy link
Author

fharman commented Oct 19, 2020

Hi everyone again,

Sorry for disturbance. But while running the qualitative_validation_for_net for unet , i encountered the error named as

ValueError: You are trying to load a weight file containing 19 layers into a model with 60 layers.

But As you know, anyway unet has 19 layers. I don't understand why i am always facing this error.

Do you have any idea for this?

Best regards,

@zaccharieramzi
Copy link
Owner

It probably means that you haven't used the same parameters for training and for evaluation. Make sure that the parameters match.

Btw, a U-net doesn't always have 19 layers, it depends on how you define layer and also on how you parametrize the U-net instance.

@fharman
Copy link
Author

fharman commented Oct 19, 2020

Sorry i was confused with vgg16 because of training fastmri both VGG16 and UNET at the same time. I changed the path as your folder

chkpt_path = f'/content/fastmri_reproducible_benchmark_master/checkpoints/{run_id}-{epoch}.hdf5' . I think this error is derived because of the model that i trained more less fastmri data.

But after changing the path as you added in fastmri_reproducible_benchmark_master/checkpoints ended with 300 epoch, i encountered another error. I am really sorry about this error disturbance.

Error is

TypeError: To be compatible with tf.contrib.eager.defun, Python functions must return zero or more Tensors; in compilation of <function unpack_model at 0x7f8ace097400>, found return value of type <class 'tensorflow.python.keras.engine.training.Model'>, which is not a Tensor.

Do you have any idea to overcome this error? i searched and tested all way but not overcome.

Best regards,

@zaccharieramzi
Copy link
Owner

Can you show me the entire stack trace ?

@fharman
Copy link
Author

fharman commented Nov 23, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants