Skip to content

Commit 6845172

Browse files
tensorflower-gardenerfyangf
authored andcommitted
Internal change
PiperOrigin-RevId: 399789575
1 parent 921294b commit 6845172

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

official/vision/beta/tasks/maskrcnn.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
from official.vision.beta.dataloaders import tf_example_label_map_decoder
2929
from official.vision.beta.evaluation import coco_evaluator
3030
from official.vision.beta.evaluation import coco_utils
31-
from official.vision.beta.evaluation import wod_detection_evaluator
3231
from official.vision.beta.losses import maskrcnn_losses
3332
from official.vision.beta.modeling import factory
3433

@@ -301,6 +300,18 @@ def build_metrics(self, training: bool = True):
301300
if self._task_config.use_coco_metrics:
302301
self._build_coco_metrics()
303302
if self._task_config.use_wod_metrics:
303+
# To use Waymo open dataset metrics, please install one of the pip
304+
# package `waymo-open-dataset-tf-*` from
305+
# https://github.com/waymo-research/waymo-open-dataset/blob/master/docs/quick_start.md#use-pre-compiled-pippip3-packages-for-linux
306+
# Note that the package is built with specific tensorflow version and
307+
# will produce error if it does not match the tf version that is
308+
# currently used.
309+
try:
310+
from official.vision.beta.evaluation import wod_detection_evaluator # pylint: disable=g-import-not-at-top
311+
except ModuleNotFoundError:
312+
logging.error('waymo-open-dataset should be installed to enable Waymo'
313+
' evaluator.')
314+
raise
304315
self.wod_metric = wod_detection_evaluator.WOD2dDetectionEvaluator()
305316

306317
return metrics

0 commit comments

Comments
 (0)