diff options
author | Daniil Kazantsev <dkazanc3@googlemail.com> | 2019-03-17 11:12:23 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-17 11:12:23 +0000 |
commit | ce6ec432cca73780e6f30e7075c0eb1b661a13be (patch) | |
tree | b8654877391908a82e2284f2b00d57a3bac67920 /demos/demoMatlab_3Ddenoise.m | |
parent | 514ba391805517a999db7ef42808b9ae9662b67b (diff) | |
parent | 527e8b28aad16d09b37fa8c9d8790a89276d68b1 (diff) | |
download | regularization-ce6ec432cca73780e6f30e7075c0eb1b661a13be.tar.gz regularization-ce6ec432cca73780e6f30e7075c0eb1b661a13be.tar.bz2 regularization-ce6ec432cca73780e6f30e7075c0eb1b661a13be.tar.xz regularization-ce6ec432cca73780e6f30e7075c0eb1b661a13be.zip |
Merge pull request #110 from vais-ral/tol
Tolerance-based stopping criterion, fixes for a new structure, new demos
Diffstat (limited to 'demos/demoMatlab_3Ddenoise.m')
-rw-r--r-- | demos/demoMatlab_3Ddenoise.m | 52 |
1 files changed, 32 insertions, 20 deletions
diff --git a/demos/demoMatlab_3Ddenoise.m b/demos/demoMatlab_3Ddenoise.m index cf2c88a..3942eea 100644 --- a/demos/demoMatlab_3Ddenoise.m +++ b/demos/demoMatlab_3Ddenoise.m @@ -18,37 +18,43 @@ Ideal3D(:,:,i) = Im; end vol3D(vol3D < 0) = 0; figure; imshow(vol3D(:,:,7), [0 1]); title('Noisy image'); -lambda_reg = 0.03; % regularsation parameter for all methods + %% fprintf('Denoise a volume using the ROF-TV model (CPU) \n'); +lambda_reg = 0.03; % regularsation parameter for all methods tau_rof = 0.0025; % time-marching constant iter_rof = 300; % number of ROF iterations -tic; u_rof = ROF_TV(single(vol3D), lambda_reg, iter_rof, tau_rof); toc; +epsil_tol = 0.0; % tolerance +tic; [u_rof,infovec] = ROF_TV(single(vol3D), lambda_reg, iter_rof, tau_rof, epsil_tol); toc; energyfunc_val_rof = TV_energy(single(u_rof),single(vol3D),lambda_reg, 1); % get energy function value rmse_rof = (RMSE(Ideal3D(:),u_rof(:))); fprintf('%s %f \n', 'RMSE error for ROF is:', rmse_rof); figure; imshow(u_rof(:,:,7), [0 1]); title('ROF-TV denoised volume (CPU)'); %% % fprintf('Denoise a volume using the ROF-TV model (GPU) \n'); +% lambda_reg = 0.03; % regularsation parameter for all methods % tau_rof = 0.0025; % time-marching constant % iter_rof = 300; % number of ROF iterations -% tic; u_rofG = ROF_TV_GPU(single(vol3D), lambda_reg, iter_rof, tau_rof); toc; +% epsil_tol = 0.0; % tolerance +% tic; u_rofG = ROF_TV_GPU(single(vol3D), lambda_reg, iter_rof, tau_rof, epsil_tol); toc; % rmse_rofG = (RMSE(Ideal3D(:),u_rofG(:))); % fprintf('%s %f \n', 'RMSE error for ROF is:', rmse_rofG); % figure; imshow(u_rofG(:,:,7), [0 1]); title('ROF-TV denoised volume (GPU)'); %% fprintf('Denoise a volume using the FGP-TV model (CPU) \n'); +lambda_reg = 0.03; % regularsation parameter for all methods iter_fgp = 300; % number of FGP iterations -epsil_tol = 1.0e-05; % tolerance -tic; u_fgp = FGP_TV(single(vol3D), lambda_reg, iter_fgp, epsil_tol); toc; +epsil_tol = 0.0; % tolerance +tic; [u_fgp,infovec] = FGP_TV(single(vol3D), lambda_reg, iter_fgp, epsil_tol); toc; energyfunc_val_fgp = TV_energy(single(u_fgp),single(vol3D),lambda_reg, 1); % get energy function value rmse_fgp = (RMSE(Ideal3D(:),u_fgp(:))); fprintf('%s %f \n', 'RMSE error for FGP-TV is:', rmse_fgp); figure; imshow(u_fgp(:,:,7), [0 1]); title('FGP-TV denoised volume (CPU)'); %% -% fprintf('Denoise a volume using the FGP-TV model (GPU) \n'); +fprintf('Denoise a volume using the FGP-TV model (GPU) \n'); +% lambda_reg = 0.03; % regularsation parameter for all methods % iter_fgp = 300; % number of FGP iterations -% epsil_tol = 1.0e-05; % tolerance +% epsil_tol = 0.0; % tolerance % tic; u_fgpG = FGP_TV_GPU(single(vol3D), lambda_reg, iter_fgp, epsil_tol); toc; % rmse_fgpG = (RMSE(Ideal3D(:),u_fgpG(:))); % fprintf('%s %f \n', 'RMSE error for FGP-TV is:', rmse_fgpG); @@ -56,8 +62,8 @@ figure; imshow(u_fgp(:,:,7), [0 1]); title('FGP-TV denoised volume (CPU)'); %% fprintf('Denoise a volume using the SB-TV model (CPU) \n'); iter_sb = 150; % number of SB iterations -epsil_tol = 1.0e-05; % tolerance -tic; u_sb = SB_TV(single(vol3D), lambda_reg, iter_sb, epsil_tol); toc; +epsil_tol = 0.0; % tolerance +tic; [u_sb,infovec] = SB_TV(single(vol3D), lambda_reg, iter_sb, epsil_tol); toc; energyfunc_val_sb = TV_energy(single(u_sb),single(vol3D),lambda_reg, 1); % get energy function value rmse_sb = (RMSE(Ideal3D(:),u_sb(:))); fprintf('%s %f \n', 'RMSE error for SB-TV is:', rmse_sb); @@ -65,7 +71,7 @@ figure; imshow(u_sb(:,:,7), [0 1]); title('SB-TV denoised volume (CPU)'); %% % fprintf('Denoise a volume using the SB-TV model (GPU) \n'); % iter_sb = 150; % number of SB iterations -% epsil_tol = 1.0e-05; % tolerance +% epsil_tol = 0.0; % tolerance % tic; u_sbG = SB_TV_GPU(single(vol3D), lambda_reg, iter_sb, epsil_tol); toc; % rmse_sbG = (RMSE(Ideal3D(:),u_sbG(:))); % fprintf('%s %f \n', 'RMSE error for SB-TV is:', rmse_sbG); @@ -76,7 +82,8 @@ lambda_ROF = lambda_reg; % ROF regularisation parameter lambda_LLT = lambda_reg*0.35; % LLT regularisation parameter iter_LLT = 300; % iterations tau_rof_llt = 0.0025; % time-marching constant -tic; u_rof_llt = LLT_ROF(single(vol3D), lambda_ROF, lambda_LLT, iter_LLT, tau_rof_llt); toc; +epsil_tol = 0.0; % tolerance +tic; [u_rof_llt, infovec] = LLT_ROF(single(vol3D), lambda_ROF, lambda_LLT, iter_LLT, tau_rof_llt, epsil_tol); toc; rmse_rof_llt = (RMSE(Ideal3D(:),u_rof_llt(:))); fprintf('%s %f \n', 'RMSE error for ROF-LLT is:', rmse_rof_llt); figure; imshow(u_rof_llt(:,:,7), [0 1]); title('ROF-LLT denoised volume (CPU)'); @@ -86,7 +93,8 @@ figure; imshow(u_rof_llt(:,:,7), [0 1]); title('ROF-LLT denoised volume (CPU)'); % lambda_LLT = lambda_reg*0.35; % LLT regularisation parameter % iter_LLT = 300; % iterations % tau_rof_llt = 0.0025; % time-marching constant -% tic; u_rof_llt_g = LLT_ROF_GPU(single(vol3D), lambda_ROF, lambda_LLT, iter_LLT, tau_rof_llt); toc; +% epsil_tol = 0.0; % tolerance +% tic; u_rof_llt_g = LLT_ROF_GPU(single(vol3D), lambda_ROF, lambda_LLT, iter_LLT, tau_rof_llt, epsil_tol); toc; % rmse_rof_llt = (RMSE(Ideal3D(:),u_rof_llt_g(:))); % fprintf('%s %f \n', 'RMSE error for ROF-LLT is:', rmse_rof_llt); % figure; imshow(u_rof_llt_g(:,:,7), [0 1]); title('ROF-LLT denoised volume (GPU)'); @@ -96,7 +104,8 @@ iter_diff = 300; % number of diffusion iterations lambda_regDiff = 0.025; % regularisation for the diffusivity sigmaPar = 0.015; % edge-preserving parameter tau_param = 0.025; % time-marching constant -tic; u_diff = NonlDiff(single(vol3D), lambda_regDiff, sigmaPar, iter_diff, tau_param, 'Huber'); toc; +epsil_tol = 0.0; % tolerance +tic; [u_diff, infovec] = NonlDiff(single(vol3D), lambda_regDiff, sigmaPar, iter_diff, tau_param, 'Huber', epsil_tol); toc; rmse_diff = (RMSE(Ideal3D(:),u_diff(:))); fprintf('%s %f \n', 'RMSE error for Diffusion is:', rmse_diff); figure; imshow(u_diff(:,:,7), [0 1]); title('Diffusion denoised volume (CPU)'); @@ -106,7 +115,7 @@ figure; imshow(u_diff(:,:,7), [0 1]); title('Diffusion denoised volume (CPU)'); % lambda_regDiff = 0.025; % regularisation for the diffusivity % sigmaPar = 0.015; % edge-preserving parameter % tau_param = 0.025; % time-marching constant -% tic; u_diff_g = NonlDiff_GPU(single(vol3D), lambda_regDiff, sigmaPar, iter_diff, tau_param, 'Huber'); toc; +% tic; u_diff_g = NonlDiff_GPU(single(vol3D), lambda_regDiff, sigmaPar, iter_diff, tau_param, 'Huber', epsil_tol); toc; % rmse_diff = (RMSE(Ideal3D(:),u_diff_g(:))); % fprintf('%s %f \n', 'RMSE error for Diffusion is:', rmse_diff); % figure; imshow(u_diff_g(:,:,7), [0 1]); title('Diffusion denoised volume (GPU)'); @@ -116,7 +125,8 @@ iter_diff = 300; % number of diffusion iterations lambda_regDiff = 3.5; % regularisation for the diffusivity sigmaPar = 0.02; % edge-preserving parameter tau_param = 0.0015; % time-marching constant -tic; u_diff4 = Diffusion_4thO(single(vol3D), lambda_regDiff, sigmaPar, iter_diff, tau_param); toc; +epsil_tol = 0.0; % tolerance +tic; u_diff4 = Diffusion_4thO(single(vol3D), lambda_regDiff, sigmaPar, iter_diff, tau_param, epsil_tol); toc; rmse_diff4 = (RMSE(Ideal3D(:),u_diff4(:))); fprintf('%s %f \n', 'RMSE error for Anis.Diff of 4th order is:', rmse_diff4); figure; imshow(u_diff4(:,:,7), [0 1]); title('Diffusion 4thO denoised volume (CPU)'); @@ -126,7 +136,7 @@ figure; imshow(u_diff4(:,:,7), [0 1]); title('Diffusion 4thO denoised volume (CP % lambda_regDiff = 3.5; % regularisation for the diffusivity % sigmaPar = 0.02; % edge-preserving parameter % tau_param = 0.0015; % time-marching constant -% tic; u_diff4_g = Diffusion_4thO_GPU(single(vol3D), lambda_regDiff, sigmaPar, iter_diff, tau_param); toc; +% tic; u_diff4_g = Diffusion_4thO_GPU(single(vol3D), lambda_regDiff, sigmaPar, iter_diff, tau_param, epsil_tol); toc; % rmse_diff4 = (RMSE(Ideal3D(:),u_diff4_g(:))); % fprintf('%s %f \n', 'RMSE error for Anis.Diff of 4th order is:', rmse_diff4); % figure; imshow(u_diff4_g(:,:,7), [0 1]); title('Diffusion 4thO denoised volume (GPU)'); @@ -135,8 +145,10 @@ fprintf('Denoise using the TGV model (CPU) \n'); lambda_TGV = 0.03; % regularisation parameter alpha1 = 1.0; % parameter to control the first-order term alpha0 = 2.0; % parameter to control the second-order term +L2 = 12.0; % convergence parameter iter_TGV = 500; % number of Primal-Dual iterations for TGV -tic; u_tgv = TGV(single(vol3D), lambda_TGV, alpha1, alpha0, iter_TGV); toc; +epsil_tol = 0.0; % tolerance +tic; u_tgv = TGV(single(vol3D), lambda_TGV, alpha1, alpha0, iter_TGV, L2, epsil_tol); toc; rmseTGV = RMSE(Ideal3D(:),u_tgv(:)); fprintf('%s %f \n', 'RMSE error for TGV is:', rmseTGV); figure; imshow(u_tgv(:,:,3), [0 1]); title('TGV denoised volume (CPU)'); @@ -146,7 +158,7 @@ figure; imshow(u_tgv(:,:,3), [0 1]); title('TGV denoised volume (CPU)'); % alpha1 = 1.0; % parameter to control the first-order term % alpha0 = 2.0; % parameter to control the second-order term % iter_TGV = 500; % number of Primal-Dual iterations for TGV -% tic; u_tgv_gpu = TGV_GPU(single(vol3D), lambda_TGV, alpha1, alpha0, iter_TGV); toc; +% tic; u_tgv_gpu = TGV_GPU(single(vol3D), lambda_TGV, alpha1, alpha0, iter_TGV, L2, epsil_tol); toc; % rmseTGV = RMSE(Ideal3D(:),u_tgv_gpu(:)); % fprintf('%s %f \n', 'RMSE error for TGV is:', rmseTGV); % figure; imshow(u_tgv_gpu(:,:,3), [0 1]); title('TGV denoised volume (GPU)'); @@ -163,7 +175,7 @@ vol3D_ref(vol3D_ref < 0) = 0; % vol3D_ref = zeros(size(Im),'single'); % pass zero reference (dTV -> TV) iter_fgp = 300; % number of FGP iterations -epsil_tol = 1.0e-05; % tolerance +epsil_tol = 0.0; % tolerance eta = 0.2; % Reference image gradient smoothing constant tic; u_fgp_dtv = FGP_dTV(single(vol3D), single(vol3D_ref), lambda_reg, iter_fgp, epsil_tol, eta); toc; figure; imshow(u_fgp_dtv(:,:,7), [0 1]); title('FGP-dTV denoised volume (CPU)'); @@ -179,7 +191,7 @@ vol3D_ref(vol3D_ref < 0) = 0; % vol3D_ref = zeros(size(Im),'single'); % pass zero reference (dTV -> TV) iter_fgp = 300; % number of FGP iterations -epsil_tol = 1.0e-05; % tolerance +epsil_tol = 0.0; % tolerance eta = 0.2; % Reference image gradient smoothing constant tic; u_fgp_dtv_g = FGP_dTV_GPU(single(vol3D), single(vol3D_ref), lambda_reg, iter_fgp, epsil_tol, eta); toc; figure; imshow(u_fgp_dtv_g(:,:,7), [0 1]); title('FGP-dTV denoised volume (GPU)'); |