Update app.py
Browse files
app.py
CHANGED
@@ -222,7 +222,7 @@ def make_gradcam(image_pil, model, last_conv_layer_name, class_index, progress=N
|
|
222 |
img_resized = cv2.resize(img_np, input_size)
|
223 |
img_array_preprocessed = preprocessor(np.expand_dims(img_resized, axis=0))
|
224 |
|
225 |
-
_update_progress(progress, 25, desc="Calcul des gradients...")
|
226 |
|
227 |
try:
|
228 |
conv_layer = model.get_layer(last_conv_layer_name)
|
@@ -246,7 +246,7 @@ def make_gradcam(image_pil, model, last_conv_layer_name, class_index, progress=N
|
|
246 |
if grads is None:
|
247 |
return img_resized
|
248 |
|
249 |
-
_update_progress(progress, 50, desc="Génération de la heatmap...")
|
250 |
|
251 |
pooled_grads = tf.reduce_mean(grads, axis=(0, 1, 2))
|
252 |
last_conv_layer_output = last_conv_layer_output[0]
|
@@ -263,7 +263,7 @@ def make_gradcam(image_pil, model, last_conv_layer_name, class_index, progress=N
|
|
263 |
|
264 |
heatmap_np = heatmap.numpy()
|
265 |
|
266 |
-
_update_progress(progress, 75, desc="Application de la superposition...", sleep=0.
|
267 |
|
268 |
heatmap_np = np.clip(heatmap_np.astype(np.float32), 0, 1)
|
269 |
heatmap_resized = cv2.resize(heatmap_np, (img_resized.shape[1], img_resized.shape[0]))
|
|
|
222 |
img_resized = cv2.resize(img_np, input_size)
|
223 |
img_array_preprocessed = preprocessor(np.expand_dims(img_resized, axis=0))
|
224 |
|
225 |
+
_update_progress(progress, 25, desc="Calcul des gradients...", sleep=0.005)
|
226 |
|
227 |
try:
|
228 |
conv_layer = model.get_layer(last_conv_layer_name)
|
|
|
246 |
if grads is None:
|
247 |
return img_resized
|
248 |
|
249 |
+
_update_progress(progress, 50, desc="Génération de la heatmap...", sleep=0.005)
|
250 |
|
251 |
pooled_grads = tf.reduce_mean(grads, axis=(0, 1, 2))
|
252 |
last_conv_layer_output = last_conv_layer_output[0]
|
|
|
263 |
|
264 |
heatmap_np = heatmap.numpy()
|
265 |
|
266 |
+
_update_progress(progress, 75, desc="Application de la superposition...", sleep=0.005)
|
267 |
|
268 |
heatmap_np = np.clip(heatmap_np.astype(np.float32), 0, 1)
|
269 |
heatmap_resized = cv2.resize(heatmap_np, (img_resized.shape[1], img_resized.shape[0]))
|