MadhurGarg commited on
Commit
9631ed9
·
1 Parent(s): e739698

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -66,7 +66,7 @@ def image_classifier(input_image, top_classes=3, show_cam=True, target_layers=[2
66
  for layer in target_layers:
67
  grayscale_cam = get_gradcam_image(input_image, label, layer)
68
  output_image = show_cam_on_image(orig_image / 255, grayscale_cam, use_rgb=True, image_weight=transparency)
69
- outputs.append((output_image, f"Layer {layer - 4}"))
70
 
71
  return outputs, confidences
72
 
@@ -93,8 +93,8 @@ def show_incorrect(num_examples=10):
93
  for i in range(num_examples):
94
  j = np.random.randint(0,wrong_img_no)
95
  image = np.asarray(Image.open(f'misclassified-images/{j}.jpg'))
96
- actual = classes(wrong_img['actual'][j])
97
- predicted = classes(wrong_img['predicted'][j])
98
 
99
  result.append((image, f"{actual} / {predicted}"))
100
 
 
66
  for layer in target_layers:
67
  grayscale_cam = get_gradcam_image(input_image, label, layer)
68
  output_image = show_cam_on_image(orig_image / 255, grayscale_cam, use_rgb=True, image_weight=transparency)
69
+ outputs.append((output_image, f"Layer {layer - 5}"))
70
 
71
  return outputs, confidences
72
 
 
93
  for i in range(num_examples):
94
  j = np.random.randint(0,wrong_img_no)
95
  image = np.asarray(Image.open(f'misclassified-images/{j}.jpg'))
96
+ actual = classes(wrong_imgloc[0].at["actual"])
97
+ predicted = classes(wrong_img.loc[0].at["predicted"])
98
 
99
  result.append((image, f"{actual} / {predicted}"))
100