Update DSRNet/test_sirs.py
Browse files- DSRNet/test_sirs.py +4 -5
DSRNet/test_sirs.py
CHANGED
|
@@ -32,9 +32,8 @@ def remove_reflection(image_path):
|
|
| 32 |
img = Image.open(img_file)
|
| 33 |
img.save(temp_image_path)
|
| 34 |
|
| 35 |
-
datadir =
|
| 36 |
-
test_dataset_real = datasets.DSRTestDataset(
|
| 37 |
-
fns=[temp_image_path],
|
| 38 |
if_align=opt.if_align)
|
| 39 |
test_dataloader_real = datasets.DataLoader(test_dataset_real, batch_size=1, shuffle=False, num_workers=opt.nThreads,
|
| 40 |
pin_memory=True)
|
|
@@ -42,11 +41,11 @@ def remove_reflection(image_path):
|
|
| 42 |
engine = Engine(opt)
|
| 43 |
|
| 44 |
# Test the model and get the result
|
| 45 |
-
result_dir = os.path.join('./
|
| 46 |
res = engine.test(test_dataloader_real, savedir=join(result_dir, 'test'))
|
| 47 |
|
| 48 |
# Load the processed image from the result directory
|
| 49 |
-
processed_image_path = join(
|
| 50 |
processed_image = Image.open(processed_image_path)
|
| 51 |
|
| 52 |
temp_dir.cleanup() # Clean up the temporary directory
|
|
|
|
| 32 |
img = Image.open(img_file)
|
| 33 |
img.save(temp_image_path)
|
| 34 |
|
| 35 |
+
datadir = temp_image_path
|
| 36 |
+
test_dataset_real = datasets.DSRTestDataset(temp_image_path
|
|
|
|
| 37 |
if_align=opt.if_align)
|
| 38 |
test_dataloader_real = datasets.DataLoader(test_dataset_real, batch_size=1, shuffle=False, num_workers=opt.nThreads,
|
| 39 |
pin_memory=True)
|
|
|
|
| 41 |
engine = Engine(opt)
|
| 42 |
|
| 43 |
# Test the model and get the result
|
| 44 |
+
result_dir = os.path.join('../')
|
| 45 |
res = engine.test(test_dataloader_real, savedir=join(result_dir, 'test'))
|
| 46 |
|
| 47 |
# Load the processed image from the result directory
|
| 48 |
+
processed_image_path = join(savedir, 'temp_image.png')
|
| 49 |
processed_image = Image.open(processed_image_path)
|
| 50 |
|
| 51 |
temp_dir.cleanup() # Clean up the temporary directory
|