示例#1
0
                                     hyper_params={
                                         'filter_type': 'Hann',
                                         'frequency_scaling': 0.8
                                     })
cg_reconstructor = CGReconstructor(ray_trafo, reco_space.zero(), 4)
gn_reconstructor = GaussNewtonReconstructor(ray_trafo, reco_space.zero(), 2)
lw_reconstructor = LandweberReconstructor(ray_trafo, reco_space.zero(), 8)
mlem_reconstructor = MLEMReconstructor(ray_trafo, 0.5 * reco_space.one(), 1)

reconstructors = [
    fbp_reconstructor, cg_reconstructor, gn_reconstructor, lw_reconstructor,
    mlem_reconstructor
]
options = {'save_iterates': True}

eval_tt.append_all_combinations(reconstructors=reconstructors,
                                test_data=[test_data],
                                options=options)

# %% run task table
results = eval_tt.run()
results.apply_measures([PSNR, SSIM])
print(results)

# %% plot reconstructions
fig = results.plot_all_reconstructions(fig_size=(9, 4), vrange='individual')

# %% plot convergence
results.plot_convergence(1, fig_size=(9, 6), gridspec_kw={'hspace': 0.5})
results.plot_performance(PSNR)
                                     hyper_params={
                                         'filter_type': 'Hann',
                                         'frequency_scaling': 0.8
                                     })

fbp_unet_reconstructor = FBPUNetReconstructor(ray_trafo,
                                              batch_size=64,
                                              use_cuda=True)
state_filename = 'fbp_unet_reconstructor_lodopab_baseline_state.pt'
with open(state_filename, 'wb') as file:
    r = requests.get('https://github.com/jleuschn/supp.dival/raw/master/'
                     'examples/'
                     'fbp_unet_reconstructor_lodopab_baseline_state.pt')
    file.write(r.content)
fbp_unet_reconstructor.load_params(state_filename)

reconstructors = [fbp_reconstructor, fbp_unet_reconstructor]

eval_tt.append_all_combinations(reconstructors=reconstructors,
                                test_data=[test_data],
                                datasets=[dataset],
                                options={'skip_training': True})

# %% run task table
results = eval_tt.run()
results.apply_measures([PSNR, SSIM])
print(results)

# %% plot reconstructions
fig = results.plot_all_reconstructions(fig_size=(9, 4), vrange='individual')