Skip to content

Commit

Permalink
Adds a merge functionality for the COCOEvaluator for distributed work…
Browse files Browse the repository at this point in the history
…flow.

PiperOrigin-RevId: 621024221
  • Loading branch information
genehwung authored and danjan1234 committed Apr 19, 2024
1 parent 347fc79 commit bb2193e
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions models/official/detection/evaluation/coco_evaluator.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,20 @@ def update(self, predictions, groundtruths=None):
else:
self._groundtruths[k].append(v)

def merge(self, other):
"""Merges the states from the other CocoEvaluator."""
for k, v in other._predictions.items(): # pylint: disable=protected-access
if k not in self._predictions:
self._predictions[k] = v
else:
self._predictions[k].extend(v)

for k, v in other._groundtruths.items(): # pylint: disable=protected-access
if k not in self._groundtruths:
self._groundtruths[k] = v
else:
self._groundtruths[k].extend(v)


class ShapeMaskCOCOEvaluator(COCOEvaluator):
"""COCO evaluation metric class for ShapeMask."""
Expand Down

0 comments on commit bb2193e

Please sign in to comment.