Spaces:
Sleeping
Sleeping
Update yolov5.py
Browse files
yolov5.py
CHANGED
@@ -213,7 +213,7 @@ def dff_nmf(image, target_lyr, n_components):
|
|
213 |
boxes = boxes[confidence_mask] # Filter boxes by confidence mask
|
214 |
fig, ax = plt.subplots(1, figsize=(8, 8))
|
215 |
ax.axis("off")
|
216 |
-
ax.imshow(torch.tensor(batch_explanations[0][indx]).cpu().numpy(), cmap="
|
217 |
top_score_idx = scores.argmax(dim=0) # Get the index of the max score
|
218 |
top_score = scores[top_score_idx].item()
|
219 |
top_class_id = class_ids[top_score_idx].item()
|
@@ -242,7 +242,7 @@ def dff_nmf(image, target_lyr, n_components):
|
|
242 |
|
243 |
#temp = image_array.reshape((rgb_img_float.shape[0],rgb_img_float.shape[1]) )
|
244 |
#visualization = show_factorization_on_image(rgb_img_float, image_array.resize((rgb_img_float.shape)) , image_weight=0.3)
|
245 |
-
visualization = show_factorization_on_image(rgb_img_float, np.transpose(rgb_channels, (2, 0, 1)), image_weight=0.
|
246 |
results.append(visualization)
|
247 |
plt.clf()
|
248 |
#return image_array
|
|
|
213 |
boxes = boxes[confidence_mask] # Filter boxes by confidence mask
|
214 |
fig, ax = plt.subplots(1, figsize=(8, 8))
|
215 |
ax.axis("off")
|
216 |
+
ax.imshow(torch.tensor(batch_explanations[0][indx]).cpu().numpy(), cmap="bwr") # Display image
|
217 |
top_score_idx = scores.argmax(dim=0) # Get the index of the max score
|
218 |
top_score = scores[top_score_idx].item()
|
219 |
top_class_id = class_ids[top_score_idx].item()
|
|
|
242 |
|
243 |
#temp = image_array.reshape((rgb_img_float.shape[0],rgb_img_float.shape[1]) )
|
244 |
#visualization = show_factorization_on_image(rgb_img_float, image_array.resize((rgb_img_float.shape)) , image_weight=0.3)
|
245 |
+
visualization = show_factorization_on_image(rgb_img_float, np.transpose(rgb_channels, (2, 0, 1)), image_weight=0.3)
|
246 |
results.append(visualization)
|
247 |
plt.clf()
|
248 |
#return image_array
|