Masaaki-75 / freeseed

Official implementation of "FreeSeed: Frequency-band-aware and Self-guided Network for Sparse-view CT Reconstruction"
14 stars 1 forks source link

missing module #2

Closed EvelyneCalista closed 6 months ago

EvelyneCalista commented 7 months ago

hi @Masaaki-75 , thanks for your great work, I would like to run your model, however 'generate_sparse_and_gt_data' module is missing from the network class. May I know how to produce this module? Thank you so much

Masaaki-75 commented 7 months ago

Hi! Thank you for your interest!

This is not a network module but a method that is used to generate simulated pair for training/evaluation. You can see its definition in every trainer class, e.g., https://github.com/Masaaki-75/freeseed/blob/6c1bd45cc5b67200e0d1a6525c89455d81296662/trainers/dudo_trainer.py#L43

EvelyneCalista commented 7 months ago

I got it. I solved with using this line only "sparse_mu, gt_mu = self.net.module.generate_sparse_and_full_ct(mu_ct,)" and commented "sparse_mu, gt_mu = self.net.generate_sparse_and_full_ct(mu_ct,)"

now i think there is some installation error with torch radon, it shows "RuntimeError: CUDA error: no kernel image is available for execution on the device" I have tried your guidance using (Updated) Precompile Packages , but lead to another "libcufft.so.10:" error. Do you install cuda separately with pytorch before using pip install pytorch? [ i am using RTX 3090].

Masaaki-75 commented 7 months ago

Yes, and in my case, I am using Cuda compilation tools, release 11.5, V11.5.50 with Build cuda_11.5.r11.5/compiler.30411180_0 on RTX 3090.

If the precompiled packages do not work, I suggest building from source. This works for me when either installing torch-radon v1 or a better-maintained v2 version from https://github.com/carterbox/torch-radon. BTW, I have my walkthrough at https://github.com/Masaaki-75/proct/blob/main/inst_tr.sh. Hope that helps!

EvelyneCalista commented 7 months ago

Thank you so much :pleading_face: !! i tried your walkthrough, build from source, it shows error image

however your code is running with warning on torch fft image

do this condition normal? I am afraid the installation is broken somewhere

Masaaki-75 commented 7 months ago
  1. The error message on the first screenshot seems incomplete. Showing the full message may help better locate the error.
  2. The warning of FFT is because there is a difference between pytorch v1.7 and higher versions in the way the FFT functions are called (the module, input arguments, etc). Calling torch.rfft will be deprecated in higher versions (e.g. v2.0), so pytorch is recommending using new features (e.g. torch.fft.rfft). However, this for now is not an error.
EvelyneCalista commented 7 months ago

There are 3 errors occurred, do these comes from cuda installation? 1. image

2. image

3. image image image

Masaaki-75 commented 7 months ago

This indicates a build dependency problem that is more likely to stem from Linux than from cuda, and is unfortunately beyond my knowledge😟. But in the first place it seems that your linux environment did not have cfitsio library (a library of C and Fortran subroutines) installed properly.

EvelyneCalista commented 7 months ago

do you think I shall resolve the torch-radon installation for now or i can ignore it? at least the code can be run. image

by the way do you again use test.sh to do same testing for validation data? i tried run test.sh to the validation data, but the result is different with the validation during training 193_output_ct_freeseed_0 5_1_5 image

EvelyneCalista commented 7 months ago

oh! i got it, sorry i didn't notice there are three types of weight image i used the opt-seed one, after changed to net-free, it is fine. 504_output_ct_freeseed_0 5_1_5 image

Masaaki-75 commented 7 months ago

This is strange. Normally the code should fail without torch-radon dependency. But given that you have run the training smoothly and the visualization also looks good, we could assume the installation is okay.

EvelyneCalista commented 7 months ago

thank you so much for your help!

EvelyneCalista commented 7 months ago

hi @Masaaki-75 ,

sorry to disturb you again, I am running the dudofreenet

https://github.com/Masaaki-75/freeseed/blob/3e81152a5cd60db01c80e8404aff4c65c270ad01/wrappers/basic_wrapper_v2.py#L72C5-L84C9

this line give error image do change the line with this will be good? image

but it will lead to another error with tensor mismatch image

Masaaki-75 commented 7 months ago

The bug has been fixed this afternoon, please see here: https://github.com/Masaaki-75/freeseed/commit/0e8a5d0cb327140a15038002bd7fd4c227fbb3da

I found this issue when I was confirming the test script issue you raised 😂, but forgot to notify you after fixing it. Anyway, thank you for bringing it up!

Masaaki-75 commented 7 months ago

Also, if you are trying to load the checkpoints correctly, please do modify the default arguments in main.py as in https://github.com/Masaaki-75/freeseed/commit/3e81152a5cd60db01c80e8404aff4c65c270ad01.