drhead commited on
Commit
db94ebe
·
verified ·
1 Parent(s): eee5b7f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -3
app.py CHANGED
@@ -253,11 +253,9 @@ 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
- 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
 
 
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((216,216), resample=Image.Resampling.NEAREST).resize((size, size), resample=Image.Resampling.BICUBIC)
259
 
260
  cam_image = transforms.CenterCrop((h, w))(cam_resized)
261