11
11
class TestRegularisers (unittest .TestCase ):
12
12
def setUp (self ):
13
13
self .filename = os .path .join (os .path .dirname (__file__ ), "test_imageLena.bin" )
14
+ # lena_gray_512.tif
14
15
15
16
def test_ROF_TV_CPU_vs_GPU (self ):
16
17
#print ("tomas debug test function")
17
- #filename = os.path.join("test","lena_gray_512.tif")
18
18
#plt = TiffReader()
19
- filename = os .path .join (os .path .dirname (__file__ ), "test_imageLena.bin" )
20
19
plt = BinReader ()
21
20
# read image
22
21
Im = plt .imread (self .filename )
@@ -83,9 +82,7 @@ def test_ROF_TV_CPU_vs_GPU(self):
83
82
84
83
def test_FGP_TV_CPU_vs_GPU (self ):
85
84
print (__name__ )
86
- #filename = os.path.join("test","lena_gray_512.tif")
87
85
#plt = TiffReader()
88
- # self.filename = os.path.join("test","test_imageLena.bin")
89
86
plt = BinReader ()
90
87
# read image
91
88
Im = plt .imread (self .filename )
@@ -161,9 +158,7 @@ def test_FGP_TV_CPU_vs_GPU(self):
161
158
162
159
def test_PD_TV_CPU_vs_GPU (self ):
163
160
print (__name__ )
164
- #filename = os.path.join("test","lena_gray_512.tif")
165
161
#plt = TiffReader()
166
- # self.filename = os.path.join("test","test_imageLena.bin")
167
162
plt = BinReader ()
168
163
# read image
169
164
Im = plt .imread (self .filename )
@@ -243,10 +238,8 @@ def test_PD_TV_CPU_vs_GPU(self):
243
238
244
239
def test_SB_TV_CPU_vs_GPU (self ):
245
240
print (__name__ )
246
- #filename = os.path.join("test","lena_gray_512.tif")
247
241
#plt = TiffReader()
248
242
# read image
249
- # filename = os.path.join("test","test_imageLena.bin")
250
243
plt = BinReader ()
251
244
Im = plt .imread (self .filename )
252
245
Im = np .asarray (Im , dtype = 'float32' )
@@ -316,9 +309,7 @@ def test_SB_TV_CPU_vs_GPU(self):
316
309
317
310
def test_TGV_CPU_vs_GPU (self ):
318
311
print (__name__ )
319
- #filename = os.path.join("test","lena_gray_512.tif")
320
312
#plt = TiffReader()
321
- # filename = os.path.join("test","test_imageLena.bin")
322
313
plt = BinReader ()
323
314
# read image
324
315
Im = plt .imread (self .filename )
@@ -357,7 +348,7 @@ def test_TGV_CPU_vs_GPU(self):
357
348
print ("#############TGV CPU####################" )
358
349
start_time = timeit .default_timer ()
359
350
infovector = np .zeros ((2 ,), dtype = 'float32' )
360
- tgv_cpu = TGV (pars ['input' ],
351
+ tgv_cpu = TGV (pars ['input' ],
361
352
pars ['regularisation_parameter' ],
362
353
pars ['alpha1' ],
363
354
pars ['alpha0' ],
@@ -374,7 +365,7 @@ def test_TGV_CPU_vs_GPU(self):
374
365
375
366
print ("##############TGV GPU##################" )
376
367
start_time = timeit .default_timer ()
377
- tgv_gpu = TGV (pars ['input' ],
368
+ tgv_gpu = TGV (pars ['input' ],
378
369
pars ['regularisation_parameter' ],
379
370
pars ['alpha1' ],
380
371
pars ['alpha0' ],
@@ -397,10 +388,8 @@ def test_TGV_CPU_vs_GPU(self):
397
388
398
389
def test_LLT_ROF_CPU_vs_GPU (self ):
399
390
print (__name__ )
400
- #filename = os.path.join("test","lena_gray_512.tif")
401
391
#plt = TiffReader()
402
392
# read image
403
- # filename = os.path.join("test","test_imageLena.bin")
404
393
plt = BinReader ()
405
394
Im = plt .imread (self .filename )
406
395
Im = np .asarray (Im , dtype = 'float32' )
@@ -473,10 +462,8 @@ def test_LLT_ROF_CPU_vs_GPU(self):
473
462
474
463
def test_NDF_CPU_vs_GPU (self ):
475
464
print (__name__ )
476
- #filename = os.path.join("test","lena_gray_512.tif")
477
465
#plt = TiffReader()
478
466
# read image
479
- # filename = os.path.join("test","test_imageLena.bin")
480
467
plt = BinReader ()
481
468
Im = plt .imread (self .filename )
482
469
Im = np .asarray (Im , dtype = 'float32' )
@@ -551,10 +538,8 @@ def test_NDF_CPU_vs_GPU(self):
551
538
self .assertLessEqual (diff_im .sum (), 1 )
552
539
553
540
def test_Diff4th_CPU_vs_GPU (self ):
554
- #filename = os.path.join("test","lena_gray_512.tif")
555
541
#plt = TiffReader()
556
542
# read image
557
- # filename = os.path.join(os.path.dirname(__file__), "test_imageLena.bin")
558
543
plt = BinReader ()
559
544
Im = plt .imread (self .filename )
560
545
Im = np .asarray (Im , dtype = 'float32' )
@@ -624,10 +609,8 @@ def test_Diff4th_CPU_vs_GPU(self):
624
609
self .assertLessEqual (diff_im .sum () , 1 )
625
610
626
611
def test_FDGdTV_CPU_vs_GPU (self ):
627
- #filename = os.path.join("test","lena_gray_512.tif")
628
612
#plt = TiffReader()
629
613
# read image
630
- # filename = os.path.join("test","test_imageLena.bin")
631
614
plt = BinReader ()
632
615
Im = plt .imread (self .filename )
633
616
Im = np .asarray (Im , dtype = 'float32' )
@@ -704,8 +687,6 @@ def test_FDGdTV_CPU_vs_GPU(self):
704
687
self .assertLessEqual (diff_im .sum (), 1 )
705
688
"""
706
689
def test_cpu_ROF_TV(self):
707
- #filename = os.path.join(".." , ".." , ".." , "data" ,"testLena.npy")
708
-
709
690
filename = os.path.join("test","lena_gray_512.tif")
710
691
711
692
plt = TiffReader()
@@ -741,8 +722,6 @@ def test_cpu_ROF_TV(self):
741
722
# now compare obtained rms with the expected value
742
723
self.assertLess(abs(rms_rof-rms_rof_exp) , tolerance)
743
724
def test_cpu_FGP_TV(self):
744
- #filename = os.path.join(".." , ".." , ".." , "data" ,"testLena.npy")
745
-
746
725
filename = os.path.join("test","lena_gray_512.tif")
747
726
748
727
plt = TiffReader()
@@ -782,7 +761,6 @@ def test_cpu_FGP_TV(self):
782
761
self.assertLess(abs(rms_fgp-rms_fgp_exp) , tolerance)
783
762
784
763
def test_gpu_ROF(self):
785
- #filename = os.path.join(".." , ".." , ".." , "data" ,"testLena.npy")
786
764
filename = os.path.join("test","lena_gray_512.tif")
787
765
788
766
plt = TiffReader()
@@ -817,7 +795,6 @@ def test_gpu_ROF(self):
817
795
self.assertLess(abs(rms_rof-rms_rof_exp) , tolerance)
818
796
819
797
def test_gpu_FGP(self):
820
- #filename = os.path.join(".." , ".." , ".." , "data" ,"testLena.npy")
821
798
filename = os.path.join("test","lena_gray_512.tif")
822
799
823
800
plt = TiffReader()
0 commit comments