Spaces:
Running
Running
Commit
·
8fbe7c8
1
Parent(s):
d4ada35
Update src/comparison.py
Browse files- src/comparison.py +13 -10
src/comparison.py
CHANGED
@@ -467,23 +467,26 @@ class DamageComparator:
|
|
467 |
|
468 |
# Dòng ~560 trong comparison.py
|
469 |
# Trong match_damages_with_reid, dòng ~560
|
|
|
470 |
for i, j in zip(row_indices, col_indices):
|
471 |
score = combined_matrix[i, j]
|
472 |
iou_score = iou_matrix[i, j]
|
473 |
|
474 |
-
# Logic mới
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
threshold_to_use =
|
|
|
|
|
|
|
481 |
else:
|
482 |
-
|
|
|
483 |
|
484 |
print(f" Pair ({i},{j}): IoU={iou_score:.3f}, Score={score:.3f}, Threshold={threshold_to_use:.3f}")
|
485 |
-
print(f" Classes: '{detections1['classes'][i]}' vs '{detections2['classes'][j]}'")
|
486 |
-
print(f" Will match: {score >= threshold_to_use and detections1['classes'][i] == detections2['classes'][j]}")
|
487 |
|
488 |
if score >= threshold_to_use:
|
489 |
if detections1['classes'][i] == detections2['classes'][j]:
|
|
|
467 |
|
468 |
# Dòng ~560 trong comparison.py
|
469 |
# Trong match_damages_with_reid, dòng ~560
|
470 |
+
# Trong match_damages_with_reid, dòng 556-571
|
471 |
for i, j in zip(row_indices, col_indices):
|
472 |
score = combined_matrix[i, j]
|
473 |
iou_score = iou_matrix[i, j]
|
474 |
|
475 |
+
# Logic mới - phù hợp với config thực tế
|
476 |
+
if iou_score >= self.iou_threshold: # >= 0.35 từ config
|
477 |
+
# Good IoU - dùng threshold thấp
|
478 |
+
threshold_to_use = self.combined_score_threshold # 0.3
|
479 |
+
elif iou_score > 0.1:
|
480 |
+
# Medium IoU - threshold vừa phải
|
481 |
+
threshold_to_use = 0.45
|
482 |
+
elif iou_score > 0.05:
|
483 |
+
# Low IoU - cần score cao hơn
|
484 |
+
threshold_to_use = 0.55
|
485 |
else:
|
486 |
+
# Very low IoU - cần ReID rất tốt
|
487 |
+
threshold_to_use = 0.65
|
488 |
|
489 |
print(f" Pair ({i},{j}): IoU={iou_score:.3f}, Score={score:.3f}, Threshold={threshold_to_use:.3f}")
|
|
|
|
|
490 |
|
491 |
if score >= threshold_to_use:
|
492 |
if detections1['classes'][i] == detections2['classes'][j]:
|