Spaces:
Runtime error
Runtime error
Upload Model_Class.py
Browse files- Model_Class.py +2 -1
Model_Class.py
CHANGED
@@ -79,12 +79,13 @@ def load_and_classify_image(image_path, device):
|
|
79 |
|
80 |
def make_GradCAM(image, device):
|
81 |
|
|
|
82 |
gpu_model = model.to(device)
|
83 |
image = image.to(device)
|
84 |
model.eval()
|
85 |
target_layers = [gpu_model.model.layer4[-1]]
|
86 |
|
87 |
-
|
88 |
cam = GradCAM(model=gpu_model, target_layers=target_layers)
|
89 |
targets = None
|
90 |
grayscale_cam = cam(
|
|
|
79 |
|
80 |
def make_GradCAM(image, device):
|
81 |
|
82 |
+
arr = image.numpy().squeeze()
|
83 |
gpu_model = model.to(device)
|
84 |
image = image.to(device)
|
85 |
model.eval()
|
86 |
target_layers = [gpu_model.model.layer4[-1]]
|
87 |
|
88 |
+
|
89 |
cam = GradCAM(model=gpu_model, target_layers=target_layers)
|
90 |
targets = None
|
91 |
grayscale_cam = cam(
|