Spaces:
Runtime error
Runtime error
update realesrgan_utils
Browse files
CodeFormer/basicsr/utils/realesrgan_utils.py
CHANGED
@@ -74,6 +74,7 @@ class RealESRGANer():
|
|
74 |
self.img = self.img.half()
|
75 |
|
76 |
# pre_pad
|
|
|
77 |
if self.pre_pad != 0:
|
78 |
self.img = F.pad(self.img, (0, self.pre_pad, 0, self.pre_pad), 'reflect')
|
79 |
# mod pad for divisible borders
|
@@ -211,7 +212,7 @@ class RealESRGANer():
|
|
211 |
del output_img_t
|
212 |
torch.cuda.empty_cache()
|
213 |
except RuntimeError as error:
|
214 |
-
output_img = cv2.resize(
|
215 |
print(f"Failed inference for RealESRGAN: {error}")
|
216 |
|
217 |
# ------------------- process the alpha channel if necessary ------------------- #
|
|
|
74 |
self.img = self.img.half()
|
75 |
|
76 |
# pre_pad
|
77 |
+
self.img_pre_pad = self.img.clone()
|
78 |
if self.pre_pad != 0:
|
79 |
self.img = F.pad(self.img, (0, self.pre_pad, 0, self.pre_pad), 'reflect')
|
80 |
# mod pad for divisible borders
|
|
|
212 |
del output_img_t
|
213 |
torch.cuda.empty_cache()
|
214 |
except RuntimeError as error:
|
215 |
+
output_img = cv2.resize(self.img_pre_pad, (w_input * self.scale, h_input * self.scale), interpolation=cv2.INTER_LINEAR)
|
216 |
print(f"Failed inference for RealESRGAN: {error}")
|
217 |
|
218 |
# ------------------- process the alpha channel if necessary ------------------- #
|