You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -357,6 +359,34 @@ The following `opts` are supported:
357
359
> **Note** You can use alt on an image pane to view the x/y coordinates of the cursor. You can also ctrl-scroll to zoom, alt scroll to pan vertically, and alt-shift scroll to pan horizontally. Double click inside the pane to restore the image to default.
358
360
359
361
362
+
#### vis.image_heatmap
363
+
364
+
This function overlays a saliency or attention heatmap on top of an image. It takes a `CxHxW` or `HxW` array `img` (uint8 or float) and an `HxW` float array `heatmap` with values in `[0, 1]`. The blending is per-pixel — pixels where the heatmap is near zero stay close to the original image, so a zero-gradient background does not get tinted by the colormap.
365
+
366
+
```python
367
+
import numpy as np
368
+
from visdom import Visdom
369
+
370
+
viz = Visdom()
371
+
372
+
# img: CxHxW uint8 or float in [0, 1]
373
+
# heatmap: HxW float in [0, 1] — e.g. from a saliency method or attention map
Any attribution method that produces an `HxW` numpy array works — gradient saliency, GradCAM, SHAP, or a hand-computed attention map.
378
+
379
+
The following `opts` are supported:
380
+
381
+
-`alpha`: blend strength (`float` in `[0, 1]`; default = `0.5`). Higher values make the heatmap more visible.
382
+
-`colormap`: matplotlib colormap name (`string`; default = `'jet'`). Falls back to a blue-red gradient if matplotlib is not installed.
383
+
-`caption`: caption for the image pane
384
+
-`jpgquality`: JPG quality (`number` 0-100). If set, the result is encoded as JPEG. Otherwise PNG.
385
+
-`normalize`: normalize the image to `[0, 1]` before blending (`boolean`; default = `False`)
386
+
387
+
> **Note**`heatmap` accepts any finite float range. Values outside `[0, 1]` are rescaled automatically via min-max normalization, so methods like SHAP or Integrated Gradients that return signed or unnormalized values work without any pre-processing. NaN maps to 0; infinite values are clamped to the `[0, 1]` boundary.
388
+
389
+
360
390
#### vis.images
361
391
362
392
This function draws a list of `images`. It takes an input `B x C x H x W` tensor or a `list of images` all of the same size. It makes a grid of images of size (B / nrow, nrow).
@@ -469,6 +499,7 @@ The function accepts the following arguments:
469
499
-`labels`: a list of corresponding labels for the tensors provided for `features`
470
500
-`data_getter=fn`: (optional) a function that takes as a parameter an index into the features array and returns a summary representation of the tensor. If this is set, `data_type` must also be set.
471
501
-`data_type=str`: (optional) currently the only acceptable value here is `"html"`
502
+
-`opts.register_embedding_events`: (optional) set to `False` to skip registering the default Python client event handler for hover previews and lasso drilldown. This leaves embeddings interaction events for external server or frontend code to handle.
472
503
473
504
We currently assume that there are no more than 10 unique labels, in the future we hope to provide a colormap in opts for other cases.
474
505
@@ -581,6 +612,29 @@ The following `opts` are supported:
This function draws named machine-learning metrics as line plots. It accepts a mapping from metric names to scalar values or equal-length 1D series and forwards to [`vis.line`](#visline).
0 commit comments