grad_cam
- fgvc.special.grad_cam.plot_grad_cam(image: ndarray, model: Module, *, target_layer: str | None = None, device: device | None = None, target_cls: int | None = None, reduction: str | callable = 'mean', colsize: int = 5, rowsize: int = 4, use_min_zero: bool = True)
Apply Grad-CAM and visualize the results.
The visualization includes input image and heatmaps of attentions, features, and gradients.
- fgvc.special.grad_cam.plot_heatmap(features: ndarray, *, ax=None, cmap: str = 'viridis', scale_format: str = '%.4f')
Plot features, gradients, or weighted features (attentions) as a heatmap.
- fgvc.special.grad_cam.plot_image_heatmap(weighted_features: ndarray, image: ndarray, max_value: float = 1, *, ax=None, scale_format: str = '%.4f', use_shadow: bool = False, use_min_zero: bool = True)
Plot image with features, gradients, or weighted features (attentions) as a heatmap.