From c42eb846f1a9b2b326c86ec08c2ba10f5903a460 Mon Sep 17 00:00:00 2001 From: DLPerf <1870988096@qq.com> Date: Thu, 2 Sep 2021 22:08:48 +0800 Subject: [PATCH] Improve performance --- .../projects/points_to_3Dobjects/utils/evaluator.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tensorflow_graphics/projects/points_to_3Dobjects/utils/evaluator.py b/tensorflow_graphics/projects/points_to_3Dobjects/utils/evaluator.py index 911909e45..03a7c43da 100644 --- a/tensorflow_graphics/projects/points_to_3Dobjects/utils/evaluator.py +++ b/tensorflow_graphics/projects/points_to_3Dobjects/utils/evaluator.py @@ -588,6 +588,8 @@ def add_detections(self, sample, detections): result_dict = {'iou_mean': -1, 'iou_min': -1, 'collisions': 0, 'collision_intersection': 0, 'collision_iou': 0} num_boxes = sample['num_boxes'].numpy() + labeled_boxes_init = tf.gather( + sample['groundtruth_boxes'], axis=1, indices=[1, 0, 3, 2]) * 256.0 for _, metric in self.metrics.items(): if isinstance(metric, ShapeAccuracyMetric): @@ -598,8 +600,7 @@ def add_detections(self, sample, detections): scene_id = str(sample['scene_filename'].numpy(), 'utf-8') # Get ground truth boxes - labeled_boxes = tf.gather( - sample['groundtruth_boxes'], axis=1, indices=[1, 0, 3, 2]) * 256.0 + labeled_boxes = labeled_boxes_init if metric.threed: rotations_y = tf.concat([tf_utils.euler_from_rotation_matrix( tf.reshape(detections['rotations_3d'][i], [3, 3]),