Spaces:
Sleeping
Sleeping
Update src/localization_eval.py
Browse files- src/localization_eval.py +7 -0
src/localization_eval.py
CHANGED
|
@@ -41,8 +41,11 @@ class Localization:
|
|
| 41 |
"""
|
| 42 |
print("In compute_coco_metrics")
|
| 43 |
# Load ground truth and submission annotations
|
|
|
|
| 44 |
coco_gt = COCO(gt_annotations)
|
| 45 |
coco_sub = coco_gt.loadRes(sub_annotations)
|
|
|
|
|
|
|
| 46 |
|
| 47 |
bbox_mAP = 0.0
|
| 48 |
bbox_AP50 = 0.0
|
|
@@ -59,6 +62,8 @@ class Localization:
|
|
| 59 |
# CORRECTED: stats[0] is mAP, stats[1] is AP50
|
| 60 |
bbox_mAP = coco_eval_bbox.stats[0]
|
| 61 |
bbox_AP50 = coco_eval_bbox.stats[1]
|
|
|
|
|
|
|
| 62 |
|
| 63 |
if self.eval_segm:
|
| 64 |
# Instance Segmentation Evaluation
|
|
@@ -70,6 +75,8 @@ class Localization:
|
|
| 70 |
segm_mAP = coco_eval_mask.stats[0]
|
| 71 |
segm_AP50 = coco_eval_mask.stats[1]
|
| 72 |
|
|
|
|
|
|
|
| 73 |
return bbox_mAP, bbox_AP50, segm_mAP, segm_AP50
|
| 74 |
|
| 75 |
|
|
|
|
| 41 |
"""
|
| 42 |
print("In compute_coco_metrics")
|
| 43 |
# Load ground truth and submission annotations
|
| 44 |
+
logging.info(f"gt_annotations : {if gt_annotations is not None or gt_annotations != '' }\tsub_annotations : {if sub_annotations is not None or sub_annotations != '' }")
|
| 45 |
coco_gt = COCO(gt_annotations)
|
| 46 |
coco_sub = coco_gt.loadRes(sub_annotations)
|
| 47 |
+
|
| 48 |
+
logging.info(f"COCO GT : {coco_gt}\tCOCO SUB : {coco_sub}")
|
| 49 |
|
| 50 |
bbox_mAP = 0.0
|
| 51 |
bbox_AP50 = 0.0
|
|
|
|
| 62 |
# CORRECTED: stats[0] is mAP, stats[1] is AP50
|
| 63 |
bbox_mAP = coco_eval_bbox.stats[0]
|
| 64 |
bbox_AP50 = coco_eval_bbox.stats[1]
|
| 65 |
+
|
| 66 |
+
logging.info(f"In [IF self.eval_bbox] condition : Calculated bbox_mAP : {bbox_mAP} and bbox_AP50 : {bbox_AP50}")
|
| 67 |
|
| 68 |
if self.eval_segm:
|
| 69 |
# Instance Segmentation Evaluation
|
|
|
|
| 75 |
segm_mAP = coco_eval_mask.stats[0]
|
| 76 |
segm_AP50 = coco_eval_mask.stats[1]
|
| 77 |
|
| 78 |
+
logging.info(f"In [IF self.eval_segm] condition : Calculated bbox_mAP : {bbox_mAP} and bbox_AP50 : {bbox_AP50}")
|
| 79 |
+
|
| 80 |
return bbox_mAP, bbox_AP50, segm_mAP, segm_AP50
|
| 81 |
|
| 82 |
|