LRP#
- class txv.exp.LRP(model: Module)#
Layer-wise Relevance Propagation(LRP). Link to the paper: On Pixel-Wise Explanations for Non-Linear Classifier Decisions by Layer-Wise Relevance Propagation
- __init__(model: Module) None #
- Parameters:
model (torch.nn.Module) – A model from
txv.vit
Caution
The model must be an LRP model. You can use the LRP version of a model by passing
lrp=True
in the model function.
- explain(input: Tensor, index: int | None = None, alpha: float = 0.5, abm: bool = True) Tensor #
Explain the model prediction using Layer-wise Relevance Propagation(LRP)
- Parameters:
input (torch.Tensor) – Input tensor
index (int, optional) – Index of the class to explain, by default the predicted class is explained
alpha (float, optional) – Alpha value for LRP, by default 0.5
abm (bool, optional) – Architecture based modification, by default True