towhee.models.visualization.transformer_visualizationΒΆ

Functions

generate_attention

Generate attention visualization of the model.

show_image_heatmap

Show image heatmap for transformer model. :param model: Transformer model. :type model: nn.Module :param pil_img: Pil Image. :type pil_img: Image :param method: full, rollout or transformer_attribution. Algorithm for attention vis, default is transformer_attribution :type method: str :param transform: Pytorch transforms or function, can be None by default. :type transform: Any :param device: model device. :type device: str.

Classes

LRP

Layer-wise relevance propagation.