taesiri commited on
Commit
71ff69f
1 Parent(s): ee44327

fix emd borders

Browse files
Files changed (2) hide show
  1. app.py +2 -2
  2. image_utils.py +13 -5
app.py CHANGED
@@ -34,7 +34,7 @@ classifier_predictions = {}
34
  selected_dataset = "Final"
35
 
36
  root_visualization_dir = "./visualizations/"
37
- viz_url = "https://static.taesiri.com/xai/Final.zip"
38
  viz_archivefile = "Final.zip"
39
 
40
  demonstration_url = "https://static.taesiri.com/xai/demonstrations.zip"
@@ -175,7 +175,7 @@ def render_experiment(query):
175
  def render_results():
176
  user_correct_guess = 0
177
  for q in session_state.user_feedback.keys():
178
- uf = True if session_state.user_feedback[q] == 'Correct' else False
179
  if session_state.is_classifier_correct[q] == uf:
180
  user_correct_guess += 1
181
 
 
34
  selected_dataset = "Final"
35
 
36
  root_visualization_dir = "./visualizations/"
37
+ viz_url = "https://static.taesiri.com/xai/Final-Task1.zip"
38
  viz_archivefile = "Final.zip"
39
 
40
  demonstration_url = "https://static.taesiri.com/xai/demonstrations.zip"
 
175
  def render_results():
176
  user_correct_guess = 0
177
  for q in session_state.user_feedback.keys():
178
+ uf = True if session_state.user_feedback[q] == "Correct" else False
179
  if session_state.is_classifier_correct[q] == uf:
180
  user_correct_guess += 1
181
 
image_utils.py CHANGED
@@ -26,7 +26,7 @@ def load_query(image_path):
26
 
27
  # Crop the center of the image
28
  cropped_image = image.crop(
29
- (left + 75, top + 145, right - 2025, bottom - 2915)
30
  ).resize((300, 300))
31
 
32
  return cropped_image
@@ -47,7 +47,9 @@ def load_chm_nns(image_path):
47
  bottom = (height + new_height) / 2
48
 
49
  # Crop the center of the image
50
- cropped_image = image.crop((left + 475, top + 140, right - 280, bottom - 2920))
 
 
51
  return cropped_image
52
 
53
 
@@ -65,7 +67,9 @@ def load_chm_corrs(image_path):
65
  bottom = (height + new_height) / 2
66
 
67
  # Crop the center of the image
68
- cropped_image = image.crop((left + 475, top + 875, right - 280, bottom - 1810))
 
 
69
  return cropped_image
70
 
71
 
@@ -86,7 +90,9 @@ def load_knn_nns(image_path):
86
  bottom = (height + new_height) / 2
87
 
88
  # Crop the center of the image
89
- cropped_image = image.crop((left + 475, top + 510, right - 280, bottom - 2550))
 
 
90
  return cropped_image
91
 
92
 
@@ -107,7 +113,9 @@ def load_emd_nns(image_path):
107
  bottom = (height + new_height) / 2
108
 
109
  # Crop the center of the image
110
- cropped_image = image.crop((left + 10, top + 2075, right - 420, bottom - 925))
 
 
111
  return cropped_image
112
 
113
 
 
26
 
27
  # Crop the center of the image
28
  cropped_image = image.crop(
29
+ (left + 75, top + 145, right - 2025, bottom - (2915 + 25 + 10))
30
  ).resize((300, 300))
31
 
32
  return cropped_image
 
47
  bottom = (height + new_height) / 2
48
 
49
  # Crop the center of the image
50
+ cropped_image = image.crop(
51
+ (left + 475, top + 140, right - 280, bottom - (2920 + 25 + 10))
52
+ )
53
  return cropped_image
54
 
55
 
 
67
  bottom = (height + new_height) / 2
68
 
69
  # Crop the center of the image
70
+ cropped_image = image.crop(
71
+ (left + 475, top + 875, right - 280, bottom - (1810 + 25 + 10))
72
+ )
73
  return cropped_image
74
 
75
 
 
90
  bottom = (height + new_height) / 2
91
 
92
  # Crop the center of the image
93
+ cropped_image = image.crop(
94
+ (left + 475, top + 510, right - 280, bottom - (2550 + 25 + 10))
95
+ )
96
  return cropped_image
97
 
98
 
 
113
  bottom = (height + new_height) / 2
114
 
115
  # Crop the center of the image
116
+ cropped_image = image.crop(
117
+ (left + 10, top + 2075, right - 420, bottom - (925 + 25 + 10))
118
+ )
119
  return cropped_image
120
 
121