Commit ·
0c051cf
1
Parent(s): e303dd7
Fix TypeError by reverting threshold parameter name back to threshold_ratio
Browse files
backend/app/services/explainability_service.py
CHANGED
|
@@ -430,9 +430,9 @@ class HeatmapFeatureExtractor:
|
|
| 430 |
|
| 431 |
return {'overlay_with_bbox': overlay}
|
| 432 |
|
| 433 |
-
def get_highest_attention_crop(self,
|
| 434 |
heatmap_norm = (self.heatmap - self.heatmap.min()) / (self.heatmap.max() - self.heatmap.min() + 1e-6)
|
| 435 |
-
mask = (heatmap_norm >=
|
| 436 |
|
| 437 |
contours, _ = cv2.findContours(mask, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
|
| 438 |
|
|
|
|
| 430 |
|
| 431 |
return {'overlay_with_bbox': overlay}
|
| 432 |
|
| 433 |
+
def get_highest_attention_crop(self, threshold_ratio=0.6):
|
| 434 |
heatmap_norm = (self.heatmap - self.heatmap.min()) / (self.heatmap.max() - self.heatmap.min() + 1e-6)
|
| 435 |
+
mask = (heatmap_norm >= threshold_ratio).astype(np.uint8) * 255
|
| 436 |
|
| 437 |
contours, _ = cv2.findContours(mask, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
|
| 438 |
|