drhead commited on
Commit
f554333
·
verified ·
1 Parent(s): 0d0b3f9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -255,9 +255,9 @@ def create_cam_visualization_pil(image_pil, cam, alpha=0.6, vis_threshold=0.2):
255
  cam_rgba = np.dstack((cam_colored, cam_alpha)) # Shape: (H, W, 4)
256
 
257
  # Resize CAM to match image
258
- cam_resized = np.array(Image.fromarray(cam_rgba).resize((size, size), resample=Image.Resampling.BILINEAR))
259
 
260
- cam_resized = transforms.CenterCrop((h, w))(torch.tensor(cam_resized)).numpy()
261
 
262
  cam_image = Image.fromarray((cam_resized * 255).astype(np.uint8), mode="RGBA")
263
 
 
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).resize((size, size), resample=Image.Resampling.BILINEAR)
259
 
260
+ cam_resized = transforms.CenterCrop((h, w))(cam_resized).numpy()
261
 
262
  cam_image = Image.fromarray((cam_resized * 255).astype(np.uint8), mode="RGBA")
263