diff options
-rw-r--r-- | Wrappers/Python/setup-regularizers.py.in | 6 | ||||
-rw-r--r-- | Wrappers/Python/test/test_gpu_regularizers.py | 30 |
2 files changed, 20 insertions, 16 deletions
diff --git a/Wrappers/Python/setup-regularizers.py.in b/Wrappers/Python/setup-regularizers.py.in index a125261..8655a2e 100644 --- a/Wrappers/Python/setup-regularizers.py.in +++ b/Wrappers/Python/setup-regularizers.py.in @@ -34,7 +34,9 @@ extra_libraries = ['cilreg'] extra_include_dirs += [os.path.join(".." , ".." , "Core"), os.path.join(".." , ".." , "Core", "regularizers_CPU"), - os.path.join(".." , ".." , "Core", "regularizers_GPU") , + os.path.join(".." , ".." , "Core", "regularizers_GPU" , "Diffus_HO" ) , + os.path.join(".." , ".." , "Core", "regularizers_GPU" , "NL_Regul" ) , + os.path.join(".." , ".." , "Core", "regularizers_GPU" , "TV_ROF" ) , "."] if platform.system() == 'Windows': @@ -81,4 +83,4 @@ setup( ) -@SETUP_GPU_WRAPPERS@
\ No newline at end of file +@SETUP_GPU_WRAPPERS@ diff --git a/Wrappers/Python/test/test_gpu_regularizers.py b/Wrappers/Python/test/test_gpu_regularizers.py index ff8af44..9e37627 100644 --- a/Wrappers/Python/test/test_gpu_regularizers.py +++ b/Wrappers/Python/test/test_gpu_regularizers.py @@ -50,14 +50,15 @@ u0 = f(u0).astype('float32') ## plot fig = plt.figure() -a=fig.add_subplot(2,3,1) +a=fig.add_subplot(2,4,1) a.set_title('noise') imgplot = plt.imshow(u0,cmap="gray") ## Diff4thHajiaboli start_time = timeit.default_timer() -pars = {'algorithm' : Diff4thHajiaboli , \ +pars = { +'algorithm' : Diff4thHajiaboli , \ 'input' : u0, 'edge_preserv_parameter':0.1 , \ 'number_of_iterations' :250 ,\ @@ -76,7 +77,7 @@ pars['rmse'] = rms txtstr = printParametersToString(pars) txtstr += "%s = %.3fs" % ('elapsed time',timeit.default_timer() - start_time) print (txtstr) -a=fig.add_subplot(2,3,2) +a=fig.add_subplot(2,4,2) # these are matplotlib.patch.Patch properties props = dict(boxstyle='round', facecolor='wheat', alpha=0.75) @@ -85,14 +86,14 @@ a.text(0.15, 0.25, txtstr, transform=a.transAxes, fontsize=12, verticalalignment='top', bbox=props) imgplot = plt.imshow(d4h, cmap="gray") -a=fig.add_subplot(2,3,5) +a=fig.add_subplot(2,4,6) # these are matplotlib.patch.Patch properties props = dict(boxstyle='round', facecolor='wheat', alpha=0.5) # place a text box in upper left in axes coords a.text(0.05, 0.95, 'd4h - u0', transform=a.transAxes, fontsize=12, verticalalignment='top', bbox=props) -imgplot = plt.imshow((d4h - u0)**2, cmap="gray") +imgplot = plt.imshow((d4h - u0), cmap="gray") ## Patch Based Regul NML @@ -107,6 +108,7 @@ pars = {'algorithm' : NML , \ } """ pars = { +'algorithm' : NML , \ 'input' : u0, 'regularization_parameter': 0.01,\ 'searching_window_ratio':3, \ @@ -124,7 +126,7 @@ pars['rmse'] = rms txtstr = printParametersToString(pars) txtstr += "%s = %.3fs" % ('elapsed time',timeit.default_timer() - start_time) print (txtstr) -a=fig.add_subplot(2,3,3) +a=fig.add_subplot(2,4,3) # these are matplotlib.patch.Patch properties props = dict(boxstyle='round', facecolor='wheat', alpha=0.75) @@ -133,22 +135,22 @@ a.text(0.15, 0.25, txtstr, transform=a.transAxes, fontsize=12, verticalalignment='top', bbox=props) imgplot = plt.imshow(nml, cmap="gray") -a=fig.add_subplot(2,3,6) +a=fig.add_subplot(2,4,7) # these are matplotlib.patch.Patch properties props = dict(boxstyle='round', facecolor='wheat', alpha=0.5) # place a text box in upper left in axes coords a.text(0.05, 0.95, 'nml - u0', transform=a.transAxes, fontsize=14, verticalalignment='top', bbox=props) -imgplot = plt.imshow((nml - u0)**2, cmap="gray") +imgplot = plt.imshow((nml - u0), cmap="gray") -plt.show() ## Rudin-Osher-Fatemi (ROF) TV regularization start_time = timeit.default_timer() pars = { +'algorithm' : GPU_ROF_TV , \ 'input' : u0, 'regularization_parameter': 1,\ 'time_marching_parameter': 0.003, \ @@ -158,29 +160,29 @@ pars = { rof_tv = GPU_ROF_TV(pars['input'], pars['number_of_iterations'], pars['time_marching_parameter'], - pars['number_of_iterations']) + pars['regularization_parameter']) rms = rmse(Im, rof_tv) pars['rmse'] = rms txtstr = printParametersToString(pars) txtstr += "%s = %.3fs" % ('elapsed time',timeit.default_timer() - start_time) print (txtstr) -a=fig.add_subplot(2,4,1) +a=fig.add_subplot(2,4,4) # these are matplotlib.patch.Patch properties props = dict(boxstyle='round', facecolor='wheat', alpha=0.75) # place a text box in upper left in axes coords a.text(0.15, 0.25, txtstr, transform=a.transAxes, fontsize=12, verticalalignment='top', bbox=props) -imgplot = plt.imshow(nml, cmap="gray") +imgplot = plt.imshow(rof_tv, cmap="gray") -a=fig.add_subplot(2,4,2) +a=fig.add_subplot(2,4,8) # these are matplotlib.patch.Patch properties props = dict(boxstyle='round', facecolor='wheat', alpha=0.5) # place a text box in upper left in axes coords a.text(0.05, 0.95, 'rof_tv - u0', transform=a.transAxes, fontsize=14, verticalalignment='top', bbox=props) -imgplot = plt.imshow((rof_tv - u0)**2, cmap="gray") +imgplot = plt.imshow((rof_tv - u0), cmap="gray") plt.show() |