sczhou commited on
Commit
d4d8d91
1 Parent(s): 11889d0
CodeFormer/basicsr/utils/realesrgan_utils.py CHANGED
@@ -211,6 +211,7 @@ class RealESRGANer():
211
  del output_img_t
212
  torch.cuda.empty_cache()
213
  except RuntimeError as error:
 
214
  print(f"Failed inference for RealESRGAN: {error}")
215
 
216
  # ------------------- process the alpha channel if necessary ------------------- #
 
211
  del output_img_t
212
  torch.cuda.empty_cache()
213
  except RuntimeError as error:
214
+ output_img = cv2.resize(output_img, (w_input * self.scale, h_input * self.scale), interpolation=cv2.INTER_LINEAR)
215
  print(f"Failed inference for RealESRGAN: {error}")
216
 
217
  # ------------------- process the alpha channel if necessary ------------------- #
app.py CHANGED
@@ -110,10 +110,10 @@ def inference(image, background_enhance, face_upsample, upscale, codeformer_fide
110
  draw_box = False
111
  detection_model = "retinaface_resnet50"
112
  print('Inp:', image, background_enhance, face_upsample, upscale, codeformer_fidelity)
113
-
114
- if background_enhance is None: background_enhance = True
115
- if face_upsample is None: face_upsample = True
116
- if upscale is None: upscale = 2
117
 
118
  img = cv2.imread(str(image), cv2.IMREAD_COLOR)
119
  print('\timage size:', img.shape)
 
110
  draw_box = False
111
  detection_model = "retinaface_resnet50"
112
  print('Inp:', image, background_enhance, face_upsample, upscale, codeformer_fidelity)
113
+
114
+ background_enhance = background_enhance if background_enhance is not None else True
115
+ face_upsample = face_upsample if face_upsample is not None else True
116
+ upscale = upscale if (upscale is not None and upscale > 0) else 2
117
 
118
  img = cv2.imread(str(image), cv2.IMREAD_COLOR)
119
  print('\timage size:', img.shape)