Skip to content
Snippets Groups Projects
Commit 2715050c authored by Sanghyun Son's avatar Sanghyun Son
Browse files

Changed image io function

parent 4ec09d0f
No related branches found
No related tags found
1 merge request!1Jan 09, 2018 updates
......@@ -21,6 +21,7 @@ class Demo(data.Dataset):
for f in os.listdir(apath):
if f.find('.png') >= 0 or f.find('.jp') >= 0:
self.filelist.append(os.path.join(apath, f))
self.filelist.sort()
def __getitem__(self, idx):
filename = os.path.split(self.filelist[idx])[-1]
......
......@@ -9,11 +9,11 @@ matplotlib.use('Agg')
import matplotlib.pyplot as plt
import numpy as np
import scipy.misc as misc
import torch
import torch.optim as optim
import torch.optim.lr_scheduler as lrs
import torchvision.utils as tu
class timer():
def __init__(self):
......@@ -130,11 +130,8 @@ class checkpoint():
filename = '{}/results/{}_x{}_'.format(self.dir, filename, scale)
postfix = ('SR', 'LR', 'HR')
for v, p in zip(save_list, postfix):
tu.save_image(
v.data[0].div(255),
'{}{}.png'.format(filename, p),
padding=0
)
ndarr = v[0].data.byte().permute(1, 2, 0).cpu().numpy()
misc.imsave('{}{}.png'.format(filename, p), ndarr)
def quantize(img, rgb_range):
return img.mul(255 / rgb_range).clamp(0, 255).round()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment