Skip to content

Commit 6b8c611

Browse files
committed
Readme
1 parent da83f1f commit 6b8c611

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ The aim is also to serve as a benchmark of algorithms and metrics for research o
9797

9898
----------
9999
# Choosing the Target Layer
100-
You need to choose the target layer to compute CAM for.
100+
You need to choose the target layer to compute the CAM for.
101101
Some common choices are:
102102
- FasterRCNN: model.backbone
103103
- Resnet18 and 50: model.layer4[-1]
@@ -143,7 +143,7 @@ with GradCAM(model=model, target_layers=target_layers) as cam:
143143
model_outputs = cam.outputs
144144
```
145145

146-
Cam.py has a more detailed usage example.
146+
cam.py has a more detailed usage example.
147147

148148
----------
149149

@@ -176,7 +176,7 @@ scores = cam_metric(input_tensor, grayscale_cams, targets, model)
176176
----------
177177

178178

179-
# Advanced use cases and tutorials:
179+
# Adapting for new architectures and tasks
180180

181181
Methods like GradCAM were designed for and were originally mostly applied on classification models,
182182
and specifically CNN classification models.
@@ -186,15 +186,15 @@ The be able to adapt to non standard cases, we have two concepts.
186186
- The reshape transform - how do we convert activations to represent spatial images ?
187187
- The model targets - What exactly should the explainability method try to explain ?
188188

189-
## The reshape transform
189+
## The reshape_transform argument
190190
In a CNN the intermediate activations in the model are a mult-channel image that have the dimensions channel x rows x cols,
191191
and the various explainabiltiy methods work with these to produce a new image.
192192

193193
In case of another architecture, like the Vision Transformer, the shape might be different, like (rows x cols + 1) x channels, or something else.
194194
The reshape transform converts the activations back into a multi-channel image, for example by removing the class token in a vision transformer.
195195
For examples, check [here](https://github.com/jacobgil/pytorch-grad-cam/blob/master/pytorch_grad_cam/utils/reshape_transforms.py)
196196

197-
## Model Targets
197+
## The model_target argument
198198
The model target is just a callable that is able to get the model output, and filter it out for the specific scalar output we want to explain.
199199

200200
For classification tasks, the model target will typically be the output from a specific category.

0 commit comments

Comments
 (0)