Spaces:
Running
Running
yizhangliu
commited on
Commit
•
843d0b7
1
Parent(s):
a15a169
Update app.py
Browse files
app.py
CHANGED
@@ -180,25 +180,25 @@ def model_process(image, mask, alpha_channel, ext):
|
|
180 |
start = time.time()
|
181 |
res_np_img = model(image, mask, config)
|
182 |
logger.info(f"process time: {(time.time() - start) * 1000}ms, {res_np_img.shape}")
|
183 |
-
print(f"process time_1_: {(time.time() - start) * 1000}ms,
|
184 |
|
185 |
torch.cuda.empty_cache()
|
186 |
|
187 |
alpha_channel = None
|
188 |
if alpha_channel is not None:
|
189 |
-
print(f"liuyz_here_10_: {alpha_channel.shape} /
|
190 |
if alpha_channel.shape[:2] != res_np_img.shape[:2]:
|
191 |
-
print(f"liuyz_here_20_:
|
192 |
alpha_channel = cv2.resize(
|
193 |
alpha_channel, dsize=(res_np_img.shape[1], res_np_img.shape[0])
|
194 |
)
|
195 |
-
print(f"liuyz_here_30_: {
|
196 |
res_np_img = np.concatenate(
|
197 |
(res_np_img, alpha_channel[:, :, np.newaxis]), axis=-1
|
198 |
)
|
199 |
-
print(f"liuyz_here_40_:
|
200 |
|
201 |
-
print(f"process time_2_: {(time.time() - start) * 1000}ms, {
|
202 |
|
203 |
image = Image.open(io.BytesIO(numpy_to_bytes(res_np_img, ext)))
|
204 |
return image # image
|
|
|
180 |
start = time.time()
|
181 |
res_np_img = model(image, mask, config)
|
182 |
logger.info(f"process time: {(time.time() - start) * 1000}ms, {res_np_img.shape}")
|
183 |
+
print(f"process time_1_: {(time.time() - start) * 1000}ms, {res_np_img.shape} / {res_np_img[250][250]} / {res_np_img.dtype}")
|
184 |
|
185 |
torch.cuda.empty_cache()
|
186 |
|
187 |
alpha_channel = None
|
188 |
if alpha_channel is not None:
|
189 |
+
print(f"liuyz_here_10_: {alpha_channel.shape} / {res_np_img.dtype}")
|
190 |
if alpha_channel.shape[:2] != res_np_img.shape[:2]:
|
191 |
+
print(f"liuyz_here_20_: {res_np_img.shape}")
|
192 |
alpha_channel = cv2.resize(
|
193 |
alpha_channel, dsize=(res_np_img.shape[1], res_np_img.shape[0])
|
194 |
)
|
195 |
+
print(f"liuyz_here_30_: {res_np_img.dtype}")
|
196 |
res_np_img = np.concatenate(
|
197 |
(res_np_img, alpha_channel[:, :, np.newaxis]), axis=-1
|
198 |
)
|
199 |
+
print(f"liuyz_here_40_: {res_np_img.dtype}")
|
200 |
|
201 |
+
print(f"process time_2_: {(time.time() - start) * 1000}ms, {res_np_img.shape} / {res_np_img[250][250]} / {res_np_img.dtype} /{ext}")
|
202 |
|
203 |
image = Image.open(io.BytesIO(numpy_to_bytes(res_np_img, ext)))
|
204 |
return image # image
|