taozh2017 / HiNet

Code for TMI 2020 "Hi-Net: Hybrid-fusion Network for Multi-modal MR Image Synthesis"
86 stars 20 forks source link

How to get Experimental phenomenon Images? #8

Open ChaoWei0606 opened 3 years ago

ChaoWei0606 commented 3 years ago

Dear taozh2017: Thank you very much for sharing the code. I have a confusion that want to ask you, I have accomplished the train process, and have got the discrimator.pkl and generator.pkl file.But when I test, only the mse, ssim and psnr values are displayed, how can I get the experimental images, for example, T1 + Flair to T2. After using the test, no experimental result images in any folder, what should I do? @taozh2017

liyiersan commented 3 years ago

Well, in test function, the size of pred_out is [batch_size*4,1,128,128], so firstly you should change it into the shape of [160,180,batch_size]. And this can be done by function prediction_syn_results, and the pred_images are what you want. Finally, you should resale the pred_images using the max_value of the volume like this:

pred_images = (pred_images+1)/2*max_value

Then you can save it into a png or jpg by the library Image in PIL.

Yshouang commented 2 years ago

can I ask you something? What's your email address, please?

Yshouang commented 2 years ago

Why is there no code about the test results? Can you upload a complete code?

Yshouang commented 2 years ago

亲爱的taozh2017: 非常感谢您分享代码。 我有一个困惑想请教你,我已经完成了train过程,并且得到了discrimator.pkl和generator.pkl文件。但是我测试的时候,只显示mse,ssim和psnr的值,我怎么得到实验图像,例如,T1 + Flair 到 T2。使用测试后,任何文件夹中都没有实验结果图像,我该怎么办? @taozh2017

请问你的图像显示出来了吗?

taozh2017 commented 2 years ago

亲爱的taozh2017: 非常感谢您分享代码。 我有一个困惑想请教你,我已经完成了train过程,并且得到了discrimator.pkl和generator.pkl文件。但是我测试的时候,只显示mse,ssim和psnr的值,我怎么得到实验图像,例如,T1 + Flair 到 T2。使用测试后,任何文件夹中都没有实验结果图像,我该怎么办? @taozh2017

请问你的图像显示出来了吗?

email: taozhou.ai@gmail.com

taozh2017 commented 2 years ago

亲爱的taozh2017: 非常感谢您分享代码。 我有一个困惑想请教你,我已经完成了train过程,并且得到了discrimator.pkl和generator.pkl文件。但是我测试的时候,只显示mse,ssim和psnr的值,我怎么得到实验图像,例如,T1 + Flair 到 T2。使用测试后,任何文件夹中都没有实验结果图像,我该怎么办? @taozh2017

请问你的图像显示出来了吗?

email: taozhou.ai@gmail.com

你都有generator.pkl了,输入T1和Flair, 输出的结果就是T2了啊

Yshouang commented 2 years ago

I have the same puzzle to ask you. I have completed the train process and got the discrimator.pkl and generator.pkl files. But when I test, I only show the values of mse, ssim and psnr. How can I get the experimental images, such as T1+Flair to T2? After using the test, there is no experimental result image in any folder. What should I do?

Yshouang commented 2 years ago

Well, in test function, the size of pred_out is [batch_size*4,1,128,128], so firstly you should change it into the shape of [160,180,batch_size]. And this can be done by function prediction_syn_results, and the pred_images are what you want. Finally, you should resale the pred_images using the max_value of the volume like this:

pred_images = (pred_images+1)/2*max_value

Then you can save it into a png or jpg by the library Image in PIL.

Excuse me, how did you achieve your results?

Yshouang commented 2 years ago

亲爱的taozh2017: 非常感谢您分享代码。 我有一个困惑想请教你,我已经完成了train过程,并且得到了discrimator.pkl和generator.pkl文件。但是我测试的时候只显示mse、ssim和psnr的值,我怎么得到实验图像,例如,T1 + Flair 到 T2。使用测试后,任何文件夹中都没有实验结果图像,我该怎么办? @taozh2017

Have you kept your results? I'd like to ask.

Yshouang commented 2 years ago

那么,在测试函数中,pred_out的大小是[batch_size*4,1,128,128],所以首先你要把它改成[160,180,batch_size]的形状。这可以通过函数prediction_syn_results 来完成,而pred_images 就是你想要的。最后,您应该像这样使用卷的 max_value 转售 pred_images:

pred_images  =(pred_images + 1)/ 2 * MAX_VALUE

然后你可以通过PIL中的库Image将其保存为png或jpg。

Why is the code I downloaded different from what you wrote? Mine ispred_images = pred_images/pred_images.max()

taozh2017 commented 2 years ago

亲爱的taozh2017: 非常感谢您分享代码。 我有一个困惑想请教你,我已经完成了train过程,并且得到了discrimator.pkl和generator.pkl文件。但是我测试的时候只显示mse、ssim和psnr的值,我怎么得到实验图像,例如,T1 + Flair 到 T2。使用测试后,任何文件夹中都没有实验结果图像,我该怎么办? @taozh2017

Have you kept your results? I'd like to ask.

Pls email your question to taozhou.ai@gmail.com. Thanks