diff options
Diffstat (limited to 'demos')
-rw-r--r-- | demos/demo_cpu_regularisers.py | 12 | ||||
-rw-r--r-- | demos/demo_gpu_regularisers.py | 32 |
2 files changed, 21 insertions, 23 deletions
diff --git a/demos/demo_cpu_regularisers.py b/demos/demo_cpu_regularisers.py index 32b97ce..4866811 100644 --- a/demos/demo_cpu_regularisers.py +++ b/demos/demo_cpu_regularisers.py @@ -32,7 +32,7 @@ def printParametersToString(pars): ############################################################################### #filename = os.path.join( "data" ,"lena_gray_512.tif") -filename = "/home/algol/Documents/DEV/CCPi-Regularisation-Toolkit/test/lena_gray_512.tif" +filename = "/home/kjy41806/Documents/SOFT/CCPi-Regularisation-Toolkit/test/lena_gray_512.tif" # read image Im = plt.imread(filename) @@ -86,13 +86,13 @@ imgplot = plt.imshow(u0,cmap="gray") pars = {'algorithm': ROF_TV, \ 'input' : u0,\ 'regularisation_parameter':0.02,\ - 'number_of_iterations': 5000,\ - 'time_marching_parameter': 0.000385,\ + 'number_of_iterations': 1000,\ + 'time_marching_parameter': 0.001,\ 'tolerance_constant':1e-06} print ("#############ROF TV CPU####################") start_time = timeit.default_timer() -(rof_cpu,info_vec) = ROF_TV(pars['input'], +(rof_cpu,info_vec_cpu) = ROF_TV(pars['input'], pars['regularisation_parameter'], pars['number_of_iterations'], pars['time_marching_parameter'], @@ -130,14 +130,14 @@ imgplot = plt.imshow(u0,cmap="gray") pars = {'algorithm' : FGP_TV, \ 'input' : u0,\ 'regularisation_parameter':0.02, \ - 'number_of_iterations' :800 ,\ + 'number_of_iterations' :200 ,\ 'tolerance_constant':1e-06,\ 'methodTV': 0 ,\ 'nonneg': 0} print ("#############FGP TV CPU####################") start_time = timeit.default_timer() -fgp_cpu,info_vec = FGP_TV(pars['input'], +fgp_cpu,info_vec_cpu = FGP_TV(pars['input'], pars['regularisation_parameter'], pars['number_of_iterations'], pars['tolerance_constant'], diff --git a/demos/demo_gpu_regularisers.py b/demos/demo_gpu_regularisers.py index 89bb948..212ad5a 100644 --- a/demos/demo_gpu_regularisers.py +++ b/demos/demo_gpu_regularisers.py @@ -83,16 +83,18 @@ imgplot = plt.imshow(u0,cmap="gray") # set parameters pars = {'algorithm': ROF_TV, \ 'input' : u0,\ - 'regularisation_parameter':0.04,\ - 'number_of_iterations': 1200,\ - 'time_marching_parameter': 0.0025 - } + 'regularisation_parameter':0.02,\ + 'number_of_iterations': 5000,\ + 'time_marching_parameter': 0.001,\ + 'tolerance_constant':1e-06} + print ("##############ROF TV GPU##################") start_time = timeit.default_timer() -rof_gpu = ROF_TV(pars['input'], - pars['regularisation_parameter'], - pars['number_of_iterations'], - pars['time_marching_parameter'],'gpu') +(rof_gpu, info_vec_gpu) = ROF_TV(pars['input'], + pars['regularisation_parameter'], + pars['number_of_iterations'], + pars['time_marching_parameter'], + pars['tolerance_constant'], 'gpu') Qtools = QualityTools(Im, rof_gpu) pars['rmse'] = Qtools.rmse() @@ -125,23 +127,20 @@ imgplot = plt.imshow(u0,cmap="gray") # set parameters pars = {'algorithm' : FGP_TV, \ 'input' : u0,\ - 'regularisation_parameter':0.04, \ - 'number_of_iterations' :1200 ,\ + 'regularisation_parameter':0.02, \ + 'number_of_iterations' :300 ,\ 'tolerance_constant':1e-06,\ 'methodTV': 0 ,\ - 'nonneg': 0 ,\ - 'printingOut': 0 - } + 'nonneg': 0} print ("##############FGP TV GPU##################") start_time = timeit.default_timer() -fgp_gpu = FGP_TV(pars['input'], +(fgp_gpu, info_vec_gpu) = FGP_TV(pars['input'], pars['regularisation_parameter'], pars['number_of_iterations'], pars['tolerance_constant'], pars['methodTV'], - pars['nonneg'], - pars['printingOut'],'gpu') + pars['nonneg'],'gpu') Qtools = QualityTools(Im, fgp_gpu) pars['rmse'] = Qtools.rmse() pars['algorithm'] = FGP_TV @@ -157,7 +156,6 @@ a.text(0.15, 0.25, txtstr, transform=a.transAxes, fontsize=14, verticalalignment='top', bbox=props) imgplot = plt.imshow(fgp_gpu, cmap="gray") plt.title('{}'.format('GPU results')) - #%% print ("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%") print ("____________SB-TV regulariser______________") |