Update app.py
Browse files
app.py
CHANGED
|
@@ -253,9 +253,11 @@ def create_cam_visualization_pil(image_pil, cam, alpha=0.6, vis_threshold=0.2):
|
|
| 253 |
cam_alpha = (cam_norm >= vis_threshold).astype(np.float32) * alpha # Alpha mask
|
| 254 |
|
| 255 |
cam_rgba = np.dstack((cam_colored, cam_alpha)) # Shape: (H, W, 4)
|
|
|
|
|
|
|
| 256 |
|
| 257 |
# Resize CAM to match image
|
| 258 |
-
cam_resized = Image.fromarray((cam_rgba * 255).astype(np.uint8), mode="RGBA").resize((size
|
| 259 |
|
| 260 |
cam_image = transforms.CenterCrop((h, w))(cam_resized)
|
| 261 |
|
|
|
|
| 253 |
cam_alpha = (cam_norm >= vis_threshold).astype(np.float32) * alpha # Alpha mask
|
| 254 |
|
| 255 |
cam_rgba = np.dstack((cam_colored, cam_alpha)) # Shape: (H, W, 4)
|
| 256 |
+
|
| 257 |
+
cam_rgba = np.repeat(np.repeat(cam_rgba, 8, axis=0), 8, axis=1)
|
| 258 |
|
| 259 |
# Resize CAM to match image
|
| 260 |
+
cam_resized = Image.fromarray((cam_rgba * 255).astype(np.uint8), mode="RGBA").resize((size, size), resample=Image.Resampling.BICUBIC)
|
| 261 |
|
| 262 |
cam_image = transforms.CenterCrop((h, w))(cam_resized)
|
| 263 |
|