drhead commited on
Commit
2310671
·
verified ·
1 Parent(s): 4ce3aac

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -1
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()) / (cam_resized.ptp() + 1e-8)
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