pull/30/head
Kritik Soman 4 years ago
parent d15c89f594
commit 0ec7c5f11c

7
.gitignore vendored

@ -0,0 +1,7 @@
.DS_Store
*~
*$py.class
*.so
*.py[cod]
gimpenv/
weights/

@ -17,7 +17,7 @@ limit_set = [[0,75], [0, 80]]
def img_normalize(data):
return data/255.
def denoiser(Img, c, pss, model, model_est, opt):
def denoiser(Img, c, pss, model, model_est, opt, cFlag):
w, h, _ = Img.shape
Img = pixelshuffle(Img, pss)
@ -43,7 +43,7 @@ def denoiser(Img, c, pss, model, model_est, opt):
INoisy = np2ts(noisy_img, opt.color)
INoisy = torch.clamp(INoisy, 0., 1.)
True_Res = INoisy - ISource
if torch.cuda.is_available():
if torch.cuda.is_available() and not cFlag:
ISource, INoisy, True_Res = Variable(ISource.cuda(),volatile=True), Variable(INoisy.cuda(),volatile=True), Variable(True_Res.cuda(),volatile=True)
else:
ISource, INoisy, True_Res = Variable(ISource,volatile=True), Variable(INoisy,volatile=True), Variable(True_Res,volatile=True)

@ -58,14 +58,14 @@ def clrImg(Img,cFlag):
wbin = opt.wbin
i = 0
idx=0
t=(w*h)/(wbin*wbin)
t=float(w*h)/float(wbin*wbin)
while i < w:
i_end = min(i + wbin, w)
j = 0
while j < h:
j_end = min(j + wbin, h)
patch = Img[i:i_end, j:j_end, :]
patch_merge_out_numpy = denoiser(patch, c, pss, model, model_est, opt)
patch_merge_out_numpy = denoiser(patch, c, pss, model, model_est, opt, cFlag)
merge_out[i:i_end, j:j_end, :] = patch_merge_out_numpy
j = j_end
idx=idx+1

Loading…
Cancel
Save