ohayonguy commited on
Commit
3b1fe09
1 Parent(s): c19a747

increased image size limit

Browse files
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -27,7 +27,7 @@ if not os.path.exists(realesr_model_path):
27
  # background enhancer with RealESRGAN
28
  model = SRVGGNetCompact(num_in_ch=3, num_out_ch=3, num_feat=64, num_conv=32, upscale=4, act_type='prelu')
29
  half = True if torch.cuda.is_available() else False
30
- upsampler = RealESRGANer(scale=4, model_path=realesr_model_path, model=model, tile=0, tile_pad=10, pre_pad=0, half=half)
31
 
32
  pmrf = MMSERectifiedFlow.from_pretrained('ohayonguy/PMRF_blind_face_image_restoration').to(device=device)
33
 
@@ -112,7 +112,7 @@ def inference(img, aligned, scale, num_flow_steps):
112
  img = cv2.cvtColor(img, cv2.COLOR_GRAY2BGR)
113
 
114
  h, w = img.shape[0:2]
115
- if h > 3500 or w > 3500:
116
  print('Image size too large.')
117
  return None, None
118
 
@@ -158,7 +158,10 @@ You may use this demo to enhance the quality of any image which contains faces.
158
  1. If your input image has only one face and it is aligned, please mark "Yes" to the answer below.
159
  2. Otherwise, your image may contain any number of faces (>=1), and the quality of each face will be enhanced separately.
160
 
161
- <b>NOTE</b>: Our model is designed to restore aligned face images, but here we incorporate mechanisms that allow restoring the quality of any image that contains any number of faces. Thus, the resulting quality of such general images is not guaranteed.
 
 
 
162
  """
163
 
164
 
 
27
  # background enhancer with RealESRGAN
28
  model = SRVGGNetCompact(num_in_ch=3, num_out_ch=3, num_feat=64, num_conv=32, upscale=4, act_type='prelu')
29
  half = True if torch.cuda.is_available() else False
30
+ upsampler = RealESRGANer(scale=4, model_path=realesr_model_path, model=model, tile=400, tile_pad=10, pre_pad=0, half=half)
31
 
32
  pmrf = MMSERectifiedFlow.from_pretrained('ohayonguy/PMRF_blind_face_image_restoration').to(device=device)
33
 
 
112
  img = cv2.cvtColor(img, cv2.COLOR_GRAY2BGR)
113
 
114
  h, w = img.shape[0:2]
115
+ if h > 4500 or w > 4500:
116
  print('Image size too large.')
117
  return None, None
118
 
 
158
  1. If your input image has only one face and it is aligned, please mark "Yes" to the answer below.
159
  2. Otherwise, your image may contain any number of faces (>=1), and the quality of each face will be enhanced separately.
160
 
161
+ <b>NOTEs</b>:
162
+
163
+ 1. Our model is designed to restore aligned face images, but here we incorporate mechanisms that allow restoring the quality of any image that contains any number of faces. Thus, the resulting quality of such general images is not guaranteed.
164
+ 2. Images that are too large won't work due to memory constraints.
165
  """
166
 
167