Spaces:
Running
on
Zero
Running
on
Zero
Make the comparison effect of the results more obvious
Browse filesMake the comparison effect of the results more obvious
Simultaneously fixing the issue of slight image misalignment in the results caused by different sizes of image and image_preds [0]
app.py
CHANGED
@@ -77,9 +77,9 @@ def predict(image, resolution='1024x1024'):
|
|
77 |
preds.append(torch.nn.functional.interpolate(pred_tensor.unsqueeze(0), size=image_shape, mode='bilinear', align_corners=True).squeeze().numpy())
|
78 |
image_preds = []
|
79 |
for image, pred in zip(images, preds):
|
80 |
-
|
81 |
-
|
82 |
-
)
|
83 |
|
84 |
return image, image_preds[0]
|
85 |
|
|
|
77 |
preds.append(torch.nn.functional.interpolate(pred_tensor.unsqueeze(0), size=image_shape, mode='bilinear', align_corners=True).squeeze().numpy())
|
78 |
image_preds = []
|
79 |
for image, pred in zip(images, preds):
|
80 |
+
image = image.resize(pred.shape[::-1])
|
81 |
+
pred = np.repeat(np.expand_dims(pred, axis=-1), 3, axis=-1)
|
82 |
+
image_preds.append((pred * image).astype(np.uint8))
|
83 |
|
84 |
return image, image_preds[0]
|
85 |
|