Skip to content

Commit ff8779c

Browse files
committed
Readme
1 parent 6b8c611 commit ff8779c

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

README.md

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -124,26 +124,21 @@ target_layers = [model.layer4[-1]]
124124
input_tensor = # Create an input tensor image for your model..
125125
# Note: input_tensor can be a batch tensor with several images!
126126

127-
128-
# We have to specify the target we want to generate
129-
# the Class Activation Maps for.
127+
# We have to specify the target we want to generate the CAM for.
130128
targets = [ClassifierOutputTarget(281)]
131129

132130
# Construct the CAM object once, and then re-use it on many images.
133131
with GradCAM(model=model, target_layers=target_layers) as cam:
134-
135132
# You can also pass aug_smooth=True and eigen_smooth=True, to apply smoothing.
136133
grayscale_cam = cam(input_tensor=input_tensor, targets=targets)
137-
138134
# In this example grayscale_cam has only one image in the batch:
139135
grayscale_cam = grayscale_cam[0, :]
140136
visualization = show_cam_on_image(rgb_img, grayscale_cam, use_rgb=True)
141-
142137
# You can also get the model outputs without having to redo inference
143138
model_outputs = cam.outputs
144139
```
145140

146-
cam.py has a more detailed usage example.
141+
[cam.py](https://github.com/jacobgil/pytorch-grad-cam/blob/master/cam.py) has a more detailed usage example.
147142

148143
----------
149144

0 commit comments

Comments
 (0)