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

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -1
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//8, size//8), resample=Image.Resampling.NEAREST).resize((size, size), resample=Image.Resampling.BILINEAR)
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