Closed Guaishou74851 closed 3 years ago
Hi, this is most likely due to an older version of ODL, such as the stable 0.7.0. A more recent development version is required, which can be installed with
pip install https://github.com/odlgroup/odl/archive/master.zip --upgrade
FYI about the change in ODL: the related PR is #1516, where amongst other things (which i think also include an important fix to gradient accumulation) OperatorAsModule
has been renamed to OperatorModule
.
Thanks a lot!
Hi, I upgraded ODL to the latest version (1.0.0) by using:
pip install https://github.com/odlgroup/odl/archive/master.zip --upgrade
, and I downloaded and unzipped the complete LoDoPaB-CT dataset automatically with dival==0.6.1 Python module, but when I run lodopab_eval.py again, I got:
Traceback (most recent call last):
File "lodopab_eval.py", line 70, in <module>
dataset = get_standard_dataset('lodopab', impl=IMPL)
File "/opt/conda/lib/python3.6/site-packages/dival/datasets/standard.py", line 174, in get_standard_dataset
dataset = LoDoPaBDataset(**lodopab_kwargs)
File "/opt/conda/lib/python3.6/site-packages/dival/datasets/lodopab_dataset.py", line 259, in __init__
self.ray_trafo = self.get_ray_trafo(impl=impl)
File "/opt/conda/lib/python3.6/site-packages/dival/datasets/lodopab_dataset.py", line 348, in get_ray_trafo
return odl.tomo.RayTransform(self.space[1], self.geometry, **kwargs)
File "/opt/conda/lib/python3.6/site-packages/odl/tomo/operators/ray_trafo.py", line 193, in __init__
impl_type, self.__cached_impl = self._initialize_impl(impl)
File "/opt/conda/lib/python3.6/site-packages/odl/tomo/operators/ray_trafo.py", line 238, in _initialize_impl
'implementations.'.format(impl)
ValueError: The 'astra_cuda' `impl` is not found. This `impl` is either not supported, it may be misspelled, or external packages required are not available. Consult `RAY_TRAFO_IMPLS` to find the run-time available implementations.
After some efforts, I am still really confused and do not know how to perform a complete test.
Hi,
i think you can find the relevant info in the last paragraph in this docs section, let me shamelessly paste from a previous dival issue:
the error is about the backend implementation for the radon transform. The default is 'astra_cuda', which requires both the astra-toolbox being installed and a cuda-enabled GPU. For testing, you can pass the option impl='skimage' to get_standard_dataset. But for real use, this will probably be too slow.If you are using anaconda, the latest development version of astra can be installed with
conda install astra-toolbox -c astra-toolbox/label/dev
Then the backends 'astra_cpu' and 'astra_cuda' should become available ('astra_cuda' only if cuda is available).
Hope this helps and please let me know if there are any further troubles to get the code running.
Hi, thank you very much for your helps. The correct configuration of astra-toolbox really solved my previous problem. My another question is, where can I find the hyperparameter setting (.json) files for the low-dose CT tasks (e.g. lodopab_fbp_hyper_params.json and lodopab_fbpunet_hyper_params.json)? When I want to test the recovery performance of FBP operator and run lodopab_eval.py again (with designating the method parameter as "fbp"), I got:
Traceback (most recent call last):
File "lodopab_eval.py", line 94, in <module>
reconstructor.load_params(os.path.join(RESULTS_PATH, name))
File "/opt/conda/lib/python3.6/site-packages/dival/reconstructors/reconstructor.py", line 351, in load_params
self.load_hyper_params(hp_path)
File "/opt/conda/lib/python3.6/site-packages/dival/reconstructors/reconstructor.py", line 245, in load_hyper_params
with open(path, 'r') as f:
FileNotFoundError: [Errno 2] No such file or directory: '../learned_ct_reco_comparison_paper_results/lodopab_fbp_hyper_params.json'
In fact, I traversed this GitHub repository and the related links but only found the trained networks for sparse-angle CT tasks on Apple-CT dataset and the reconstrution results of two tasks (LoDoPaB-CT Challenge Reconstructions and Apple CT Test Reconstructions, respectively). I don't know if I didn't carefully check all the related directories/files/docs/links and missed something, or actually the (hyperparameter configurations)/(trained networks) are in LoDoPaB-CT Challenge Reconstructions?
Hi,
The parameters for the dival reconstructors on the LoDoPaB-CT dataset can be found here (i.e. as a supplementary to dival rather than as a supplementary of this comparison paper repo). Probably this is not very easy to find, i'll add a link in the readme as well as on the supplementary zenodo record with the Apples-CT parameters.
Best regards and thanks for the feedback
Hi,
With your helps, I can already perform complete low-dose CT tests on LoDoPaB-CT testset and get the results, but when I run the following command for testing FBPUNet:
python lodopab_eval.py --method=fbpunet --part=test
, I got:
Traceback (most recent call last):
File "lodopab_eval.py", line 95, in <module>
reconstructor.load_params(os.path.join(RESULTS_PATH, name))
File "/opt/conda/lib/python3.6/site-packages/dival/reconstructors/reconstructor.py", line 435, in load_params
self.load_learned_params(path)
File "/opt/conda/lib/python3.6/site-packages/dival/reconstructors/standard_learned_reconstructor.py", line 477, in load_learned_params
state_dict = torch.load(path, map_location=map_location)
File "/opt/conda/lib/python3.6/site-packages/torch/serialization.py", line 595, in load
return _legacy_load(opened_file, map_location, pickle_module, **pickle_load_args)
File "/opt/conda/lib/python3.6/site-packages/torch/serialization.py", line 764, in _legacy_load
magic_number = pickle_module.load(f, **pickle_load_args)
_pickle.UnpicklingError: invalid load key, 'v'.
I put these files in a new created directory and test FBP operator successfully, so I think the problem may come from the reading process of the trained network (.pt) files by the Pickle Python module. I checked its version and my environment, but still don't know how to fix it. I guess that there are some mismatches about the format of serialized (.pt) file? By the way, is the reconstruction results of the LoDoPaB-CT testset (not the special challenge set) open access?
Best regards and thanks for your patience
Hi,
this is probably because the supp.dival git repo uses git-lfs. If git-lfs is not installed, the files are just small pointer text files. You could either manually download via the Github interface, or install git-lfs and checkout again. Note that the file lodopab_iradonmap.pt
is quite large (approx. 0.5 GiB), so you might want to exclude it somehow.
Credits for considering it might be git-lfs related go to this SO answer.
We haven't published reconstructions on the LoDoPaB-CT test set yet. If you have troubles reproducing some results, just let me know.
Kind regards
In case you had trouble accessing the files due to my quota limit, i just upgraded the plan for the current month. You should be able to access the weights now.
Regards, Johannes
I run lodopab_eval.py on Colab and get: