Spaces:
Sleeping
Sleeping
Changed form cuda to cpu
Browse files
utils.py
CHANGED
@@ -94,7 +94,7 @@ def get_gradcam(model,input_img, opacity):
|
|
94 |
outputs = model(input_img)
|
95 |
_, prediction = torch.max(outputs, 1)
|
96 |
target_layers = [model.convlayer3[-2]]
|
97 |
-
cam = GradCAM(model=model, target_layers=target_layers, use_cuda=
|
98 |
grayscale_cam = cam(input_tensor=input_img, targets=targets)
|
99 |
grayscale_cam = grayscale_cam[0, :]
|
100 |
img = input_img.squeeze(0).to('cpu')
|
|
|
94 |
outputs = model(input_img)
|
95 |
_, prediction = torch.max(outputs, 1)
|
96 |
target_layers = [model.convlayer3[-2]]
|
97 |
+
cam = GradCAM(model=model, target_layers=target_layers, use_cuda=False)
|
98 |
grayscale_cam = cam(input_tensor=input_img, targets=targets)
|
99 |
grayscale_cam = grayscale_cam[0, :]
|
100 |
img = input_img.squeeze(0).to('cpu')
|