Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ModelZoo
ResNet50_tensorflow
Commits
21ab9cf7
Commit
21ab9cf7
authored
Dec 15, 2020
by
A. Unique TensorFlower
Committed by
TF Object Detection Team
Dec 15, 2020
Browse files
Making NMS flag visible through ObjectDetectionEvaluator constructor. Note that
by default NMS is off. PiperOrigin-RevId: 347613472
parent
690e44ed
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
5 deletions
+22
-5
research/object_detection/utils/object_detection_evaluation.py
...rch/object_detection/utils/object_detection_evaluation.py
+22
-5
No files found.
research/object_detection/utils/object_detection_evaluation.py
View file @
21ab9cf7
...
@@ -159,7 +159,9 @@ class ObjectDetectionEvaluator(DetectionEvaluator):
...
@@ -159,7 +159,9 @@ class ObjectDetectionEvaluator(DetectionEvaluator):
metric_prefix
=
None
,
metric_prefix
=
None
,
use_weighted_mean_ap
=
False
,
use_weighted_mean_ap
=
False
,
evaluate_masks
=
False
,
evaluate_masks
=
False
,
group_of_weight
=
0.0
):
group_of_weight
=
0.0
,
nms_iou_threshold
=
1.0
,
nms_max_output_boxes
=
10000
):
"""Constructor.
"""Constructor.
Args:
Args:
...
@@ -187,6 +189,8 @@ class ObjectDetectionEvaluator(DetectionEvaluator):
...
@@ -187,6 +189,8 @@ class ObjectDetectionEvaluator(DetectionEvaluator):
matching_iou_threshold, weight group_of_weight is added to true
matching_iou_threshold, weight group_of_weight is added to true
positives. Consequently, if no detection falls within a group-of box,
positives. Consequently, if no detection falls within a group-of box,
weight group_of_weight is added to false negatives.
weight group_of_weight is added to false negatives.
nms_iou_threshold: NMS IoU threashold.
nms_max_output_boxes: maximal number of boxes after NMS.
Raises:
Raises:
ValueError: If the category ids are not 1-indexed.
ValueError: If the category ids are not 1-indexed.
...
@@ -202,6 +206,8 @@ class ObjectDetectionEvaluator(DetectionEvaluator):
...
@@ -202,6 +206,8 @@ class ObjectDetectionEvaluator(DetectionEvaluator):
self
.
_label_id_offset
=
1
self
.
_label_id_offset
=
1
self
.
_evaluate_masks
=
evaluate_masks
self
.
_evaluate_masks
=
evaluate_masks
self
.
_group_of_weight
=
group_of_weight
self
.
_group_of_weight
=
group_of_weight
self
.
_nms_iou_threshold
=
nms_iou_threshold
self
.
_nms_max_output_boxes
=
nms_max_output_boxes
self
.
_evaluation
=
ObjectDetectionEvaluation
(
self
.
_evaluation
=
ObjectDetectionEvaluation
(
num_groundtruth_classes
=
self
.
_num_classes
,
num_groundtruth_classes
=
self
.
_num_classes
,
matching_iou_threshold
=
self
.
_matching_iou_threshold
,
matching_iou_threshold
=
self
.
_matching_iou_threshold
,
...
@@ -209,7 +215,9 @@ class ObjectDetectionEvaluator(DetectionEvaluator):
...
@@ -209,7 +215,9 @@ class ObjectDetectionEvaluator(DetectionEvaluator):
recall_upper_bound
=
self
.
_recall_upper_bound
,
recall_upper_bound
=
self
.
_recall_upper_bound
,
use_weighted_mean_ap
=
self
.
_use_weighted_mean_ap
,
use_weighted_mean_ap
=
self
.
_use_weighted_mean_ap
,
label_id_offset
=
self
.
_label_id_offset
,
label_id_offset
=
self
.
_label_id_offset
,
group_of_weight
=
self
.
_group_of_weight
)
group_of_weight
=
self
.
_group_of_weight
,
nms_iou_threshold
=
self
.
_nms_iou_threshold
,
nms_max_output_boxes
=
self
.
_nms_max_output_boxes
)
self
.
_image_ids
=
set
([])
self
.
_image_ids
=
set
([])
self
.
_evaluate_corlocs
=
evaluate_corlocs
self
.
_evaluate_corlocs
=
evaluate_corlocs
self
.
_evaluate_precision_recall
=
evaluate_precision_recall
self
.
_evaluate_precision_recall
=
evaluate_precision_recall
...
@@ -454,7 +462,10 @@ class ObjectDetectionEvaluator(DetectionEvaluator):
...
@@ -454,7 +462,10 @@ class ObjectDetectionEvaluator(DetectionEvaluator):
num_groundtruth_classes
=
self
.
_num_classes
,
num_groundtruth_classes
=
self
.
_num_classes
,
matching_iou_threshold
=
self
.
_matching_iou_threshold
,
matching_iou_threshold
=
self
.
_matching_iou_threshold
,
use_weighted_mean_ap
=
self
.
_use_weighted_mean_ap
,
use_weighted_mean_ap
=
self
.
_use_weighted_mean_ap
,
label_id_offset
=
self
.
_label_id_offset
)
label_id_offset
=
self
.
_label_id_offset
,
nms_iou_threshold
=
self
.
_nms_iou_threshold
,
nms_max_output_boxes
=
self
.
_nms_max_output_boxes
,
)
self
.
_image_ids
.
clear
()
self
.
_image_ids
.
clear
()
def
add_eval_dict
(
self
,
eval_dict
):
def
add_eval_dict
(
self
,
eval_dict
):
...
@@ -549,13 +560,19 @@ class ObjectDetectionEvaluator(DetectionEvaluator):
...
@@ -549,13 +560,19 @@ class ObjectDetectionEvaluator(DetectionEvaluator):
class
PascalDetectionEvaluator
(
ObjectDetectionEvaluator
):
class
PascalDetectionEvaluator
(
ObjectDetectionEvaluator
):
"""A class to evaluate detections using PASCAL metrics."""
"""A class to evaluate detections using PASCAL metrics."""
def
__init__
(
self
,
categories
,
matching_iou_threshold
=
0.5
):
def
__init__
(
self
,
categories
,
matching_iou_threshold
=
0.5
,
nms_iou_threshold
=
1.0
,
nms_max_output_boxes
=
10000
):
super
(
PascalDetectionEvaluator
,
self
).
__init__
(
super
(
PascalDetectionEvaluator
,
self
).
__init__
(
categories
,
categories
,
matching_iou_threshold
=
matching_iou_threshold
,
matching_iou_threshold
=
matching_iou_threshold
,
evaluate_corlocs
=
False
,
evaluate_corlocs
=
False
,
metric_prefix
=
'PascalBoxes'
,
metric_prefix
=
'PascalBoxes'
,
use_weighted_mean_ap
=
False
)
use_weighted_mean_ap
=
False
,
nms_iou_threshold
=
nms_iou_threshold
,
nms_max_output_boxes
=
nms_max_output_boxes
)
class
WeightedPascalDetectionEvaluator
(
ObjectDetectionEvaluator
):
class
WeightedPascalDetectionEvaluator
(
ObjectDetectionEvaluator
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment