Giter Club home page Giter Club logo

learned_ct_reco_comparison_paper's People

Contributors

jleuschn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

lidingzhe zfxu

learned_ct_reco_comparison_paper's Issues

Problem of ODL

I run lodopab_eval.py on Colab and get:

# with dival==0.6.0
Traceback (most recent call last):
  File "lodopab_eval.py", line 16, in <module>
    from dival.reconstructors.learnedpd_reconstructor import LearnedPDReconstructor
  File "/opt/conda/lib/python3.6/site-packages/dival/reconstructors/learnedpd_reconstructor.py", line 4, in <module>
    from odl.contrib.torch import OperatorModule
ImportError: cannot import name 'OperatorModule'
# with dival==0.5.7
Traceback (most recent call last):
  File "lodopab_eval.py", line 16, in <module>
    from dival.reconstructors.learnedpd_reconstructor import LearnedPDReconstructor
  File "/usr/local/lib/python3.7/dist-packages/dival/reconstructors/learnedpd_reconstructor.py", line 4, in <module>
    from odl.contrib.torch import OperatorModule
ImportError: cannot import name 'OperatorModule' from 'odl.contrib.torch' (/usr/local/lib/python3.7/dist-packages/odl/contrib/torch/__init__.py)

could you provide the training file of lodopab dataset

Hi,
Thx for your codes about these method.I have tried the MS-D-CNN using lodopab dataset
Here is my training codes
`import os
import argparse
import json
try:
from FBPMSDReconstructor import FBPMSDNetReconstructor
MSD_PYTORCH_AVAILABLE = True
except ImportError:
MSD_PYTORCH_AVAILABLE = False
import torch

IMPL = 'astra_cuda'
RESULTS_PATH = '/data0/ct_logs/msdnet'

dataset = get_standard_dataset('lodopab', impl=IMPL)
ray_trafo = dataset.get_ray_trafo(impl=IMPL)
test_data = dataset.get_data_pairs('test', 100)

NOISE_SETTING_DEFAULT = 'gaussian_noise'
NUM_ANGLES_DEFAULT = 50
METHOD_DEFAULT = 'fbpmsdnet'

parser = argparse.ArgumentParser()
parser.add_argument('--noise_setting', type=str, default='gaussian_noise')
parser.add_argument('--num_angles', type=int, default=50)
parser.add_argument('--method', type=str, default='fbpmsdnet')

options = parser.parse_args()

noise_setting = options.noise_setting # 'gaussian_noise', 'scattering'
num_angles = options.num_angles # 50, 10, 5, 2
method = options.method # 'learnedpd', 'fbpunet', 'fbpmsdnet', 'cinn'
name = 'lodopab_{}_{}'.format(noise_setting, method)

from dival import get_standard_dataset
from dival.measure import PSNR
from dival.util.plot import plot_images
import numpy as np
IMPL = 'astra_cuda'
datasets = get_standard_dataset('lodopab', impl=IMPL)
test_data = datasets.get_data_pairs('test', 100)

FBP_DATASET_STATS = {
'noisefree': {
2: {
'mean_fbp': 0.0020300781237049294,
'std_fbp': 0.0036974098858769781,
'mean_gt': 0.0018248517968347585,
'std_gt': 0.0020251920919838714
},
5: {
'mean_fbp': 0.0018914765285141003,
'std_fbp': 0.0027988724415204552,
'mean_gt': 0.0018248517968347585,
'std_gt': 0.0020251920919838714
},
10: {
'mean_fbp': 0.0018791806499857538,
'std_fbp': 0.0023355593815585413,
'mean_gt': 0.0018248517968347585,
'std_gt': 0.0020251920919838714
},
50: {
'mean_fbp': 0.0018856220845133943,
'std_fbp': 0.002038545754978578,
'mean_gt': 0.0018248517968347585,
'std_gt': 0.0020251920919838714
}
},
'gaussian_noise': {
2: {
'mean_fbp': 0.0020300515246877825,
'std_fbp': 0.01135122820016111,
'mean_gt': 0.0018248517968347585,
'std_gt': 0.0020251920919838714
},
5: {
'mean_fbp': 0.0018914835384669934,
'std_fbp': 0.0073404856822226593,
'mean_gt': 0.0018248517968347585,
'std_gt': 0.0020251920919838714
},
10: {
'mean_fbp': 0.0018791781748714272,
'std_fbp': 0.0053367740312729459,
'mean_gt': 0.0018248517968347585,
'std_gt': 0.0020251920919838714
},
50: {
'mean_fbp': 0.0018856252771456445,
'std_fbp': 0.0029598508235758759,
'mean_gt': 0.0018248517968347585,
'std_gt': 0.0020251920919838714
}
},
'scattering': {
2: {
'mean_fbp': 0.68570249744436962,
'std_fbp': 1.3499668155231217,
'mean_gt': 0.002007653630624356, # different from gaussian_noise
'std_gt': 0.0019931366497635745 # since subset of slices is used
},
5: {
'mean_fbp': 0.67324839540841908,
'std_fbp': 0.99012416989800478,
'mean_gt': 0.002007653630624356, # different from gaussian_noise
'std_gt': 0.0019931366497635745 # since subset of slices is used
},
10: {
'mean_fbp': 0.66960775275347806,
'std_fbp': 0.80318946689776671,
'mean_gt': 0.002007653630624356, # different from gaussian_noise
'std_gt': 0.0019931366497635745 # since subset of slices is used
},
50: {
'mean_fbp': 0.67173917657611049,
'std_fbp': 0.6794825395874754,
'mean_gt': 0.002007653630624356, # different from gaussian_noise
'std_gt': 0.0019931366497635745 # since subset of slices is used
}
}
}

ray_trafo = dataset.ray_trafo

assert MSD_PYTORCH_AVAILABLE
reconstructor = FBPMSDNetReconstructor(
ray_trafo,
hyper_params={
'depth': 100,
'width': 1,
'dilations': (1, 2, 3, 4, 5, 6, 7, 8, 9, 10),
'lr': 0.001,
'batch_size': 1,
'epochs': 50,
'data_augmentation': True,
'scheduler': 'none'
},
save_best_learned_params_path=os.path.join(RESULTS_PATH, name),
log_dir=os.path.join(RESULTS_PATH, name),
num_data_loader_workers=0,
)

reconstructor.save_hyper_params(
os.path.join(RESULTS_PATH, '{}_hyper_params.json'.format(name)))

print("start training: '{}'".format(name))
print('hyper_params = {}'.format(
json.dumps(reconstructor.hyper_params, indent=1)))
reconstructor.train(dataset)

recos = []
psnrs = []
for obs, gt in test_data:
reco = reconstructor.reconstruct(obs)
recos.append(reco)
psnrs.append(PSNR(reco, gt))

print('mean psnr: {:f}'.format(np.mean(psnrs)))
import matplotlib.pyplot as plt
for i in range(3):
_, ax = plot_images([recos[i], test_data.ground_truth[i]],
fig_size=(10, 4))
ax[0].set_xlabel('PSNR: {:.2f}'.format(psnrs[i]))
ax[0].set_title('CINNReconstructor')
ax[1].set_title('ground truth')
ax[0].figure.suptitle('test sample {:d}'.format(i))
plt.show()`

but it raise error at this code line in 'odl_fourier_transform.py'
图片
and the error is below
图片
the original code about 'torch.fft.rfft(x_preproc,dim=-1)' is 'torch.rfft(x_preproc,1)'
I modify it cause I use the pytorch1.9 version.
is this line modifiation or my dataset loading cause the error ?
and could u provide the ms_d_cnn network training file of lodopab dataset,many thx!

"label_files" in the apple CT dataset

Hi Johannes,

Thanks a lot for this comprehensive study!

In the util/apples_data.py I am wondering where can I find the label_files defined in the line

label_files = os.listdir(os.path.join(config['data_path'], 'labels'))

It seems that I couldn't find this file in the apple CT dataset webpage https://zenodo.org/record/4212301#.YKqogIaxXds Perhaps I miss something?

Another questions is that, I see that the util/apples_data.py script loads data from projections_noisefree, projections_gaussian_noise, and projections_scattering folders. I suppose they correspond to folders Dataset_A, Dataset_B, and Dataset_C, respectively in the apple CT dataset webpage?

Thanks a lot!

Cheers,
Tianlin

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.