Update app.py
Browse files
app.py
CHANGED
@@ -274,7 +274,7 @@ def create_cam_visualization_pil(cam, alpha=0.6, vis_threshold=0.2):
|
|
274 |
cam_resized = np.array(Image.fromarray(cam).resize((w, h), resample=Image.Resampling.BILINEAR))
|
275 |
|
276 |
# Normalize CAM to [0, 1]
|
277 |
-
cam_norm = (cam_resized - cam_resized.min()) / (
|
278 |
|
279 |
# Apply threshold mask
|
280 |
mask = cam_norm >= vis_threshold
|
|
|
274 |
cam_resized = np.array(Image.fromarray(cam).resize((w, h), resample=Image.Resampling.BILINEAR))
|
275 |
|
276 |
# Normalize CAM to [0, 1]
|
277 |
+
cam_norm = (cam_resized - cam_resized.min()) / (np.ptp(cam_resized) + 1e-8)
|
278 |
|
279 |
# Apply threshold mask
|
280 |
mask = cam_norm >= vis_threshold
|