yizhangliu commited on
Commit
039e64f
1 Parent(s): f4e2d95

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -144,7 +144,7 @@ def model_process(input):
144
  interpolation = cv2.INTER_CUBIC
145
 
146
  # form = request.form
147
- print(f'liuyz_3_here_', original_shape, alpha_channel)
148
 
149
  size_limit = "Original" # image.shape[1] # : Union[int, str] = form.get("sizeLimit", "1080")
150
  if size_limit == "Original":
@@ -186,12 +186,12 @@ def model_process(input):
186
  print(f"Origin image shape: {original_shape} / {image[250][250]}")
187
  image = resize_max_size(image, size_limit=size_limit, interpolation=interpolation)
188
  # logger.info(f"Resized image shape: {image.shape}")
189
- print(f"Resized image shape: {image.shape} / {image[250][250]}")
190
 
191
  # mask, _ = load_img(mask, gray=True)
192
  mask = np.array(mask_pil)
193
  mask = resize_max_size(mask, size_limit=size_limit, interpolation=interpolation)
194
- print(f"mask image shape: {mask.shape} / {type(mask)} / {mask[250][250]}")
195
 
196
  if model is None:
197
  return None
@@ -199,7 +199,7 @@ def model_process(input):
199
  start = time.time()
200
  res_np_img = model(image, mask, config)
201
  logger.info(f"process time: {(time.time() - start) * 1000}ms, {res_np_img.shape}")
202
- print(f"process time_1_: {(time.time() - start) * 1000}ms, {alpha_channel.shape}, {res_np_img.shape} / {res_np_img[250][250]}")
203
 
204
  torch.cuda.empty_cache()
205
 
@@ -210,7 +210,7 @@ def model_process(input):
210
  alpha_channel = cv2.resize(
211
  alpha_channel, dsize=(res_np_img.shape[1], res_np_img.shape[0])
212
  )
213
- print(f"liuyz_here_30_: {alpha_channel.shape} / {res_np_img.shape}")
214
  res_np_img = np.concatenate(
215
  (res_np_img, alpha_channel[:, :, np.newaxis]), axis=-1
216
  )
 
144
  interpolation = cv2.INTER_CUBIC
145
 
146
  # form = request.form
147
+ print(f'liuyz_3_here_', original_shape, alpha_channel, image.dtype, mask.dtype)
148
 
149
  size_limit = "Original" # image.shape[1] # : Union[int, str] = form.get("sizeLimit", "1080")
150
  if size_limit == "Original":
 
186
  print(f"Origin image shape: {original_shape} / {image[250][250]}")
187
  image = resize_max_size(image, size_limit=size_limit, interpolation=interpolation)
188
  # logger.info(f"Resized image shape: {image.shape}")
189
+ print(f"Resized image shape: {image.shape} / {image[250][250]} / {iamge.dtype}")
190
 
191
  # mask, _ = load_img(mask, gray=True)
192
  mask = np.array(mask_pil)
193
  mask = resize_max_size(mask, size_limit=size_limit, interpolation=interpolation)
194
+ print(f"mask image shape: {mask.shape} / {type(mask)} / {mask[250][250]} / {mask.dtype}")
195
 
196
  if model is None:
197
  return None
 
199
  start = time.time()
200
  res_np_img = model(image, mask, config)
201
  logger.info(f"process time: {(time.time() - start) * 1000}ms, {res_np_img.shape}")
202
+ print(f"process time_1_: {(time.time() - start) * 1000}ms, {alpha_channel.shape}, {res_np_img.shape} / {res_np_img[250][250]} / {res_np_img.dtype}")
203
 
204
  torch.cuda.empty_cache()
205
 
 
210
  alpha_channel = cv2.resize(
211
  alpha_channel, dsize=(res_np_img.shape[1], res_np_img.shape[0])
212
  )
213
+ print(f"liuyz_here_30_: {alpha_channel.shape} / {res_np_img.shape}")
214
  res_np_img = np.concatenate(
215
  (res_np_img, alpha_channel[:, :, np.newaxis]), axis=-1
216
  )