Closed vegarant closed 5 years ago
Execute this block of code after checking whether is_train is true, as optimizer is used only during training.
When you want to test the trained networks, the grad
variables don't need to exist. It is used only to update the trainable weights during training. There is no problem to run build_model(...)
without grad
variables. If there is any error on your environment, let me know.
Eh, the problem is that the grad
variable is only initialized on
https://github.com/hpkim0512/Deep_MRI_Unet/blob/a4b86db5b23f389761d6ed40d5a503bac385a33b/model.py#L81
So if the if-test enters the else
statement the grad
variable never gets
initialized. Then you get an error on the line I mentioned above.
I get that computing the gradient is completely meaningless if you would like to test the network.
Does running the line below (as suggested by the readme file) work for you with the current version of the code. I get an error at least.
python main.py --is_train=False --ckpt_dir=model --test_set=test_set
Ah... I see what you mean.
The lines 87-90 should be placed in the state if self.is_train
.
I'll correct that. Thank you!
Nice. Could you also check that the pre-trained model provided in the README file works as intended. The images the network produces for me at the moment seems really bad.
https://github.com/hpkim0512/Deep_MRI_Unet/blob/a4b86db5b23f389761d6ed40d5a503bac385a33b/model.py#L90
It seems as if
self.is_train
isFalse
, then thegrad
variable will not exist and thebuild_model(...)
function fails.