コード例 #1
0
    def on_epoch_end(self, epoch, logs=None):
        logs = logs or {}

        # run evaluation
        average_precisions = evaluate(self.generator,
                                      self.active_model,
                                      iou_threshold=self.iou_threshold,
                                      score_threshold=self.score_threshold,
                                      max_detections=self.max_detections,
                                      visualize=False)

        # compute per class average precision
        total_instances = []
        precisions = []
        for label, (average_precision,
                    num_annotations) in average_precisions.items():
            if self.verbose == 1:
                print(
                    '{:.0f} instances of class'.format(num_annotations),
                    self.generator.label_to_name(label),
                    'with average precision: {:.4f}'.format(average_precision))
            total_instances.append(num_annotations)
            precisions.append(average_precision)
        if self.weighted_average:
            self.mean_ap = sum([
                a * b for a, b in zip(total_instances, precisions)
            ]) / sum(total_instances)
        else:
            self.mean_ap = sum(precisions) / sum(x > 0
                                                 for x in total_instances)

        if self.tensorboard is not None:
            if tf.version.VERSION < '2.0.0' and self.tensorboard.writer is not None:
                summary = tf.Summary()
                summary_value = summary.value.add()
                summary_value.simple_value = self.mean_ap
                summary_value.tag = "mAP"
                self.tensorboard.writer.add_summary(summary, epoch)
            else:
                tf.summary.scalar('mAP', self.mean_ap, epoch)

        logs['mAP'] = self.mean_ap

        if self.verbose == 1:
            print('mAP: {:.4f}'.format(self.mean_ap))
コード例 #2
0
ファイル: ship_eval.py プロジェクト: spydr1/EfficientDet
def main():
    phi = 1
    weighted_bifpn = False
    image_sizes = (512, 640, 768, 896, 1024, 1280, 1408)
    image_size = image_sizes[phi]
    score_threshold = 0.9
    nms_threshold = 0.5

    common_args = {
        'batch_size': 1,
        'phi': phi,
        'detect_ship': True,
        'detect_quadrangle': True,
    }

    #ship_path = '/home/minjun/Jupyter/Ship_Detection/Data/train_tfrecorder/train_data2.tfrecords'
    val_dir = '/home/minjun/Jupyter/Ship_Detection/Data/tfrecorder/val_data_1280.tfrecords'
    model_path = 'checkpoints/test4/ship_95_0.2889_0.3075.h5'
    print(model_path)

    #    train_generator = ShipGenerator(
    #        'train/ship_detection',
    #        ship_path,
    #        gen_type='train',
    #        ratio = ratio,
    #        group_method='none',
    #        **common_args
    #    )

    validation_generator = ShipGenerator('val/ship_detection',
                                         val_dir,
                                         gen_type='val',
                                         ratio=1,
                                         shuffle_groups=False,
                                         selection=False,
                                         **common_args)
    num_classes = validation_generator.num_classes()
    num_anchors = validation_generator.num_anchors
    anchor_parameters = AnchorParameters.ship

    model, prediction_model = efficientdet(phi,
                                           num_classes=num_classes,
                                           num_anchors=num_anchors,
                                           freeze_bn=True,
                                           detect_quadrangle=True,
                                           anchor_parameters=anchor_parameters,
                                           score_threshold=score_threshold,
                                           nms_threshold=0.3)
    prediction_model.load_weights(model_path, by_name=True)

    #    print(evaluate(generator=train_generator,
    #             model = prediction_model,
    #             score_threshold=0.01,
    #             max_detections=100,
    #             visualize=False,
    #            )
    #         )
    if False:
        for i in np.arange(0.2, 1, 0.05):
            print(
                evaluate(
                    generator=validation_generator,
                    model=prediction_model,
                    score_threshold=score_threshold,
                    max_detections=300,
                    visualize=False,
                    nms_threshold=i,
                ))
    print(
        evaluate(
            generator=validation_generator,
            model=prediction_model,
            score_threshold=score_threshold,
            max_detections=300,
            visualize=True,
            nms_threshold=nms_threshold,
        ))
コード例 #3
0
ファイル: evaluate.py プロジェクト: PhilHuk/EfficientPose
def evaluate_model(model,
                   generator,
                   save_path,
                   score_threshold,
                   iou_threshold=0.5,
                   max_detections=100,
                   diameter_threshold=0.1):
    """
    Evaluates a given model using the data from the given generator.

    Args:
        model: The model that should be evaluated.
        generator: Generator that loads the dataset to evaluate.
        save_path: Where to save the evaluated images with the drawn annotations and predictions. Or None if the images should not be saved.
        score_threshold: Minimum score threshold at which a prediction is not filtered out
        iou_threshold: Intersection-over-Union (IoU) threshold between the GT and predicted 2D bboxes when a detection is considered to be correct.
        max_detections: Maximum detections per image.
        diameter_threshold: The threshold relative to the 3D model's diameter at which a 6D pose is considered correct.
                            If the average distance between the 3D model points transformed with the GT pose and estimated pose respectively, is lower than this threshold the pose is considered to be correct.

    """
    # run evaluation
    average_precisions, add_metric, add_s_metric, metric_5cm_5degree, translation_diff_metric, rotation_diff_metric, metric_2d_projection, mixed_add_and_add_s_metric, average_point_distance_error_metric, average_sym_point_distance_error_metric, mixed_average_point_distance_error_metric = evaluate(
        generator,
        model,
        iou_threshold=iou_threshold,
        score_threshold=score_threshold,
        max_detections=max_detections,
        save_path=save_path,
        diameter_threshold=diameter_threshold)

    verbose = 1
    weighted_average = False
    # compute per class average precision
    total_instances = []
    precisions = []
    for label, (average_precision,
                num_annotations) in average_precisions.items():
        if verbose == 1:
            print('{:.0f} instances of class'.format(num_annotations),
                  generator.label_to_name(label),
                  'with average precision: {:.4f}'.format(average_precision))
        total_instances.append(num_annotations)
        precisions.append(average_precision)
    if weighted_average:
        mean_ap = sum([a * b for a, b in zip(total_instances, precisions)
                       ]) / sum(total_instances)
    else:
        mean_ap = sum(precisions) / sum(x > 0 for x in total_instances)

    # compute per class ADD Accuracy
    total_instances_add = []
    add_accuracys = []
    for label, (add_acc, num_annotations) in add_metric.items():
        if verbose == 1:
            print('{:.0f} instances of class'.format(num_annotations),
                  generator.label_to_name(label),
                  'with ADD accuracy: {:.4f}'.format(add_acc))
        total_instances_add.append(num_annotations)
        add_accuracys.append(add_acc)
    if weighted_average:
        mean_add = sum([
            a * b for a, b in zip(total_instances_add, add_accuracys)
        ]) / sum(total_instances_add)
    else:
        mean_add = sum(add_accuracys) / sum(x > 0 for x in total_instances_add)

    #same for add-s metric
    total_instances_add_s = []
    add_s_accuracys = []
    for label, (add_s_acc, num_annotations) in add_s_metric.items():
        if verbose == 1:
            print('{:.0f} instances of class'.format(num_annotations),
                  generator.label_to_name(label),
                  'with ADD-S-Accuracy: {:.4f}'.format(add_s_acc))
        total_instances_add_s.append(num_annotations)
        add_s_accuracys.append(add_s_acc)
    if weighted_average:
        mean_add_s = sum([
            a * b for a, b in zip(total_instances_add_s, add_s_accuracys)
        ]) / sum(total_instances_add_s)
    else:
        mean_add_s = sum(add_s_accuracys) / sum(x > 0
                                                for x in total_instances_add_s)

    #same for 5cm 5degree metric
    total_instances_5cm_5degree = []
    accuracys_5cm_5degree = []
    for label, (acc_5cm_5_degree,
                num_annotations) in metric_5cm_5degree.items():
        if verbose == 1:
            print('{:.0f} instances of class'.format(num_annotations),
                  generator.label_to_name(label),
                  'with 5cm-5degree-Accuracy: {:.4f}'.format(acc_5cm_5_degree))
        total_instances_5cm_5degree.append(num_annotations)
        accuracys_5cm_5degree.append(acc_5cm_5_degree)
    if weighted_average:
        mean_5cm_5degree = sum([
            a * b
            for a, b in zip(total_instances_5cm_5degree, accuracys_5cm_5degree)
        ]) / sum(total_instances_5cm_5degree)
    else:
        mean_5cm_5degree = sum(accuracys_5cm_5degree) / sum(
            x > 0 for x in total_instances_5cm_5degree)

    #same for translation diffs
    translation_diffs_mean = []
    translation_diffs_std = []
    for label, (t_mean, t_std) in translation_diff_metric.items():
        print(
            'class', generator.label_to_name(label),
            'with Translation Differences in mm: Mean: {:.4f} and Std: {:.4f}'.
            format(t_mean, t_std))
        translation_diffs_mean.append(t_mean)
        translation_diffs_std.append(t_std)
    mean_translation_mean = sum(translation_diffs_mean) / len(
        translation_diffs_mean)
    mean_translation_std = sum(translation_diffs_std) / len(
        translation_diffs_std)

    #same for rotation diffs
    rotation_diffs_mean = []
    rotation_diffs_std = []
    for label, (r_mean, r_std) in rotation_diff_metric.items():
        if verbose == 1:
            print(
                'class', generator.label_to_name(label),
                'with Rotation Differences in degree: Mean: {:.4f} and Std: {:.4f}'
                .format(r_mean, r_std))
        rotation_diffs_mean.append(r_mean)
        rotation_diffs_std.append(r_std)
    mean_rotation_mean = sum(rotation_diffs_mean) / len(rotation_diffs_mean)
    mean_rotation_std = sum(rotation_diffs_std) / len(rotation_diffs_std)

    #same for 2d projection metric
    total_instances_2d_projection = []
    accuracys_2d_projection = []
    for label, (acc_2d_projection,
                num_annotations) in metric_2d_projection.items():
        if verbose == 1:
            print(
                '{:.0f} instances of class'.format(num_annotations),
                generator.label_to_name(label),
                'with 2d-projection-Accuracy: {:.4f}'.format(
                    acc_2d_projection))
        total_instances_2d_projection.append(num_annotations)
        accuracys_2d_projection.append(acc_2d_projection)
    if weighted_average:
        mean_2d_projection = sum([
            a * b for a, b in zip(total_instances_2d_projection,
                                  accuracys_2d_projection)
        ]) / sum(total_instances_2d_projection)
    else:
        mean_2d_projection = sum(accuracys_2d_projection) / sum(
            x > 0 for x in total_instances_2d_projection)

    #same for mixed_add_and_add_s_metric
    total_instances_mixed_add_and_add_s_metric = []
    accuracys_mixed_add_and_add_s_metric = []
    for label, (acc_mixed_add_and_add_s_metric,
                num_annotations) in mixed_add_and_add_s_metric.items():
        if verbose == 1:
            print(
                '{:.0f} instances of class'.format(num_annotations),
                generator.label_to_name(label),
                'with ADD(-S)-Accuracy: {:.4f}'.format(
                    acc_mixed_add_and_add_s_metric))
        total_instances_mixed_add_and_add_s_metric.append(num_annotations)
        accuracys_mixed_add_and_add_s_metric.append(
            acc_mixed_add_and_add_s_metric)
    if weighted_average:
        mean_mixed_add_and_add_s_metric = sum([
            a * b for a, b in zip(total_instances_mixed_add_and_add_s_metric,
                                  accuracys_mixed_add_and_add_s_metric)
        ]) / sum(total_instances_mixed_add_and_add_s_metric)
    else:
        mean_mixed_add_and_add_s_metric = sum(
            accuracys_mixed_add_and_add_s_metric) / sum(
                x > 0 for x in total_instances_mixed_add_and_add_s_metric)

    #same for average transformed point distances
    transformed_diffs_mean = []
    transformed_diffs_std = []
    for label, (t_mean, t_std) in average_point_distance_error_metric.items():
        print(
            'class', generator.label_to_name(label),
            'with Transformed Point Distances in mm: Mean: {:.4f} and Std: {:.4f}'
            .format(t_mean, t_std))
        transformed_diffs_mean.append(t_mean)
        transformed_diffs_std.append(t_std)
    mean_transformed_mean = sum(transformed_diffs_mean) / len(
        transformed_diffs_mean)
    mean_transformed_std = sum(transformed_diffs_std) / len(
        transformed_diffs_std)

    #same for average symmetric transformed point distances
    transformed_sym_diffs_mean = []
    transformed_sym_diffs_std = []
    for label, (t_mean,
                t_std) in average_sym_point_distance_error_metric.items():
        print(
            'class', generator.label_to_name(label),
            'with Transformed Symmetric Point Distances in mm: Mean: {:.4f} and Std: {:.4f}'
            .format(t_mean, t_std))
        transformed_sym_diffs_mean.append(t_mean)
        transformed_sym_diffs_std.append(t_std)
    mean_transformed_sym_mean = sum(transformed_sym_diffs_mean) / len(
        transformed_sym_diffs_mean)
    mean_transformed_sym_std = sum(transformed_sym_diffs_std) / len(
        transformed_sym_diffs_std)

    #same for mixed average transformed point distances for symmetric and asymmetric objects
    mixed_transformed_diffs_mean = []
    mixed_transformed_diffs_std = []
    for label, (t_mean,
                t_std) in mixed_average_point_distance_error_metric.items():
        print(
            'class', generator.label_to_name(label),
            'with Mixed Transformed Point Distances in mm: Mean: {:.4f} and Std: {:.4f}'
            .format(t_mean, t_std))
        mixed_transformed_diffs_mean.append(t_mean)
        mixed_transformed_diffs_std.append(t_std)
    mean_mixed_transformed_mean = sum(mixed_transformed_diffs_mean) / len(
        mixed_transformed_diffs_mean)
    mean_mixed_transformed_std = sum(mixed_transformed_diffs_std) / len(
        mixed_transformed_diffs_std)

    print('mAP: {:.4f}'.format(mean_ap))
    print('ADD: {:.4f}'.format(mean_add))
    print('ADD-S: {:.4f}'.format(mean_add_s))
    print('5cm_5degree: {:.4f}'.format(mean_5cm_5degree))
    print('TranslationErrorMean_in_mm: {:.4f}'.format(mean_translation_mean))
    print('TranslationErrorStd_in_mm: {:.4f}'.format(mean_translation_std))
    print('RotationErrorMean_in_degree: {:.4f}'.format(mean_rotation_mean))
    print('RotationErrorStd_in_degree: {:.4f}'.format(mean_rotation_std))
    print('2D-Projection: {:.4f}'.format(mean_2d_projection))
    print('Summed_Translation_Rotation_Error: {:.4f}'.format(
        mean_translation_mean + mean_translation_std + mean_rotation_mean +
        mean_rotation_std))
    print('ADD(-S): {:.4f}'.format(mean_mixed_add_and_add_s_metric))
    print(
        'AveragePointDistanceMean_in_mm: {:.4f}'.format(mean_transformed_mean))
    print('AveragePointDistanceStd_in_mm: {:.4f}'.format(mean_transformed_std))
    print('AverageSymmetricPointDistanceMean_in_mm: {:.4f}'.format(
        mean_transformed_sym_mean))
    print('AverageSymmetricPointDistanceStd_in_mm: {:.4f}'.format(
        mean_transformed_sym_std))
    print('MixedAveragePointDistanceMean_in_mm: {:.4f}'.format(
        mean_mixed_transformed_mean))
    print('MixedAveragePointDistanceStd_in_mm: {:.4f}'.format(
        mean_mixed_transformed_std))
コード例 #4
0
    def on_epoch_end(self, epoch, logs = None):
        logs = logs or {}

        # run evaluation
        average_precisions, add_metric, add_s_metric, metric_5cm_5degree, translation_diff_metric, rotation_diff_metric, metric_2d_projection, mixed_add_and_add_s_metric, average_point_distance_error_metric, average_sym_point_distance_error_metric, mixed_average_point_distance_error_metric = evaluate(
            self.generator,
            self.active_model,
            iou_threshold=self.iou_threshold,
            score_threshold=self.score_threshold,
            max_detections=self.max_detections,
            save_path=self.save_path,
            diameter_threshold = self.diameter_threshold
        )

        # compute per class average precision
        total_instances = []
        precisions = []
        for label, (average_precision, num_annotations ) in average_precisions.items():
            if self.verbose == 1:
                print('{:.0f} instances of class'.format(num_annotations),
                      self.generator.label_to_name(label), 'with average precision: {:.4f}'.format(average_precision))
            total_instances.append(num_annotations)
            precisions.append(average_precision)
        if self.weighted_average:
            self.mean_ap = sum([a * b for a, b in zip(total_instances, precisions)]) / sum(total_instances)
        else:
            self.mean_ap = sum(precisions) / sum(x > 0 for x in total_instances)
            
        # compute per class ADD Accuracy
        total_instances_add = []
        add_accuracys = []
        for label, (add_acc, num_annotations) in add_metric.items():
            if self.verbose == 1:
                print('{:.0f} instances of class'.format(num_annotations),
                      self.generator.label_to_name(label), 'with ADD accuracy: {:.4f}'.format(add_acc))
            total_instances_add.append(num_annotations)
            add_accuracys.append(add_acc)
        if self.weighted_average:
            self.mean_add = sum([a * b for a, b in zip(total_instances_add, add_accuracys)]) / sum(total_instances_add)
        else:
            self.mean_add = sum(add_accuracys) / sum(x > 0 for x in total_instances_add)
            
        #same for add-s metric
        total_instances_add_s = []
        add_s_accuracys = []
        for label, (add_s_acc, num_annotations) in add_s_metric.items():
            if self.verbose == 1:
                print('{:.0f} instances of class'.format(num_annotations),
                      self.generator.label_to_name(label), 'with ADD-S-Accuracy: {:.4f}'.format(add_s_acc))
            total_instances_add_s.append(num_annotations)
            add_s_accuracys.append(add_s_acc)
        if self.weighted_average:
            self.mean_add_s = sum([a * b for a, b in zip(total_instances_add_s, add_s_accuracys)]) / sum(total_instances_add_s)
        else:
            self.mean_add_s = sum(add_s_accuracys) / sum(x > 0 for x in total_instances_add_s)
            
        #same for 5cm 5degree metric
        total_instances_5cm_5degree = []
        accuracys_5cm_5degree = []
        for label, (acc_5cm_5_degree, num_annotations) in metric_5cm_5degree.items():
            if self.verbose == 1:
                print('{:.0f} instances of class'.format(num_annotations),
                      self.generator.label_to_name(label), 'with 5cm-5degree-Accuracy: {:.4f}'.format(acc_5cm_5_degree))
            total_instances_5cm_5degree.append(num_annotations)
            accuracys_5cm_5degree.append(acc_5cm_5_degree)
        if self.weighted_average:
            self.mean_5cm_5degree = sum([a * b for a, b in zip(total_instances_5cm_5degree, accuracys_5cm_5degree)]) / sum(total_instances_5cm_5degree)
        else:
            self.mean_5cm_5degree = sum(accuracys_5cm_5degree) / sum(x > 0 for x in total_instances_5cm_5degree)
            
        #same for translation diffs
        translation_diffs_mean = []
        translation_diffs_std = []
        for label, (t_mean, t_std) in translation_diff_metric.items():
            print('class', self.generator.label_to_name(label), 'with Translation Differences in mm: Mean: {:.4f} and Std: {:.4f}'.format(t_mean, t_std))
            translation_diffs_mean.append(t_mean)
            translation_diffs_std.append(t_std)
        self.mean_translation_mean = sum(translation_diffs_mean) / len(translation_diffs_mean)
        self.mean_translation_std = sum(translation_diffs_std) / len(translation_diffs_std)
            
        #same for rotation diffs
        rotation_diffs_mean = []
        rotation_diffs_std = []
        for label, (r_mean, r_std) in rotation_diff_metric.items():
            if self.verbose == 1:
                print('class', self.generator.label_to_name(label), 'with Rotation Differences in degree: Mean: {:.4f} and Std: {:.4f}'.format(r_mean, r_std))
            rotation_diffs_mean.append(r_mean)
            rotation_diffs_std.append(r_std)
        self.mean_rotation_mean = sum(rotation_diffs_mean) / len(rotation_diffs_mean)
        self.mean_rotation_std = sum(rotation_diffs_std) / len(rotation_diffs_std)
            
        #same for 2d projection metric
        total_instances_2d_projection = []
        accuracys_2d_projection = []
        for label, (acc_2d_projection, num_annotations) in metric_2d_projection.items():
            if self.verbose == 1:
                print('{:.0f} instances of class'.format(num_annotations),
                      self.generator.label_to_name(label), 'with 2d-projection-Accuracy: {:.4f}'.format(acc_2d_projection))
            total_instances_2d_projection.append(num_annotations)
            accuracys_2d_projection.append(acc_2d_projection)
        if self.weighted_average:
            self.mean_2d_projection = sum([a * b for a, b in zip(total_instances_2d_projection, accuracys_2d_projection)]) / sum(total_instances_2d_projection)
        else:
            self.mean_2d_projection = sum(accuracys_2d_projection) / sum(x > 0 for x in total_instances_2d_projection)
            
        #same for mixed_add_and_add_s_metric
        total_instances_mixed_add_and_add_s_metric = []
        accuracys_mixed_add_and_add_s_metric = []
        for label, (acc_mixed_add_and_add_s_metric, num_annotations) in mixed_add_and_add_s_metric.items():
            if self.verbose == 1:
                print('{:.0f} instances of class'.format(num_annotations),
                      self.generator.label_to_name(label), 'with ADD(-S)-Accuracy: {:.4f}'.format(acc_mixed_add_and_add_s_metric))
            total_instances_mixed_add_and_add_s_metric.append(num_annotations)
            accuracys_mixed_add_and_add_s_metric.append(acc_mixed_add_and_add_s_metric)
        if self.weighted_average:
            self.mean_mixed_add_and_add_s_metric = sum([a * b for a, b in zip(total_instances_mixed_add_and_add_s_metric, accuracys_mixed_add_and_add_s_metric)]) / sum(total_instances_mixed_add_and_add_s_metric)
        else:
            self.mean_mixed_add_and_add_s_metric = sum(accuracys_mixed_add_and_add_s_metric) / sum(x > 0 for x in total_instances_mixed_add_and_add_s_metric)
            
        #same for average transformed point distances
        transformed_diffs_mean = []
        transformed_diffs_std = []
        for label, (t_mean, t_std) in average_point_distance_error_metric.items():
            print('class', self.generator.label_to_name(label), 'with Transformed Point Distances in mm: Mean: {:.4f} and Std: {:.4f}'.format(t_mean, t_std))
            transformed_diffs_mean.append(t_mean)
            transformed_diffs_std.append(t_std)
        self.mean_transformed_mean = sum(transformed_diffs_mean) / len(transformed_diffs_mean)
        self.mean_transformed_std = sum(transformed_diffs_std) / len(transformed_diffs_std)
        
        #same for average symmetric transformed point distances
        transformed_sym_diffs_mean = []
        transformed_sym_diffs_std = []
        for label, (t_mean, t_std) in average_sym_point_distance_error_metric.items():
            print('class', self.generator.label_to_name(label), 'with Transformed Symmetric Point Distances in mm: Mean: {:.4f} and Std: {:.4f}'.format(t_mean, t_std))
            transformed_sym_diffs_mean.append(t_mean)
            transformed_sym_diffs_std.append(t_std)
        self.mean_transformed_sym_mean = sum(transformed_sym_diffs_mean) / len(transformed_sym_diffs_mean)
        self.mean_transformed_sym_std = sum(transformed_sym_diffs_std) / len(transformed_sym_diffs_std)
        
        #same for mixed average transformed point distances for symmetric and asymmetric objects
        mixed_transformed_diffs_mean = []
        mixed_transformed_diffs_std = []
        for label, (t_mean, t_std) in mixed_average_point_distance_error_metric.items():
            print('class', self.generator.label_to_name(label), 'with Mixed Transformed Point Distances in mm: Mean: {:.4f} and Std: {:.4f}'.format(t_mean, t_std))
            mixed_transformed_diffs_mean.append(t_mean)
            mixed_transformed_diffs_std.append(t_std)
        self.mean_mixed_transformed_mean = sum(mixed_transformed_diffs_mean) / len(mixed_transformed_diffs_mean)
        self.mean_mixed_transformed_std = sum(mixed_transformed_diffs_std) / len(mixed_transformed_diffs_std)

        if self.tensorboard is not None:
            if tf.version.VERSION < '2.0.0' and self.tensorboard.writer is not None:
                summary = tf.Summary()
                #mAP
                summary_value_map = summary.value.add()
                summary_value_map.simple_value = self.mean_ap
                summary_value_map.tag = "mAP"
                #ADD
                summary_value_add = summary.value.add()
                summary_value_add.simple_value = self.mean_add
                summary_value_add.tag = "ADD"
                #ADD-S
                summary_value_add_s = summary.value.add()
                summary_value_add_s.simple_value = self.mean_add_s
                summary_value_add_s.tag = "ADD-S"
                #5cm 5degree
                summary_value_5cm_5degree = summary.value.add()
                summary_value_5cm_5degree.simple_value = self.mean_5cm_5degree
                summary_value_5cm_5degree.tag = "5cm_5degree"
                #translation
                summary_value_translation_mean = summary.value.add()
                summary_value_translation_mean.simple_value = self.mean_translation_mean
                summary_value_translation_mean.tag = "TranslationErrorMean_in_mm"
                summary_value_translation_std = summary.value.add()
                summary_value_translation_std.simple_value = self.mean_translation_std
                summary_value_translation_std.tag = "TranslationErrorStd_in_mm"
                #rotation
                summary_value_rotation_mean = summary.value.add()
                summary_value_rotation_mean.simple_value = self.mean_rotation_mean
                summary_value_rotation_mean.tag = "RotationErrorMean_in_degree"
                summary_value_rotation_std = summary.value.add()
                summary_value_rotation_std.simple_value = self.mean_rotation_std
                summary_value_rotation_std.tag = "RotationErrorStd_in_degree"
                #2d projection
                summary_value_2d_projection = summary.value.add()
                summary_value_2d_projection.simple_value = self.mean_2d_projection
                summary_value_2d_projection.tag = "2D_Projection"
                #summed translation and rotation errors for lr scheduling
                summary_value_summed_error = summary.value.add()
                summary_value_summed_error.simple_value = self.mean_translation_mean + self.mean_translation_std + self.mean_rotation_mean + self.mean_rotation_std
                summary_value_summed_error.tag = "Summed_Translation_Rotation_Error"
                #ADD(-S)
                summary_value_mixed_add_and_add_s_metric = summary.value.add()
                summary_value_mixed_add_and_add_s_metric.simple_value = self.mean_mixed_add_and_add_s_metric
                summary_value_mixed_add_and_add_s_metric.tag = "ADD(-S)"
                #average point distances
                summary_value_transformed_sym_mean = summary.value.add()
                summary_value_transformed_sym_mean.simple_value = self.mean_transformed_sym_mean
                summary_value_transformed_sym_mean.tag = "AverageSymmetricPointDistanceMean_in_mm"
                summary_value_transformed_sym_std = summary.value.add()
                summary_value_transformed_sym_std.simple_value = self.mean_transformed_sym_std
                summary_value_transformed_sym_std.tag = "AverageSymmetricPointDistanceStd_in_mm"
                #average point distances
                summary_value_transformed_mean = summary.value.add()
                summary_value_transformed_mean.simple_value = self.mean_transformed_mean
                summary_value_transformed_mean.tag = "AveragePointDistanceMean_in_mm"
                summary_value_transformed_std = summary.value.add()
                summary_value_transformed_std.simple_value = self.mean_transformed_std
                summary_value_transformed_std.tag = "AveragePointDistanceStd_in_mm"
                #average point distances
                summary_value_mixed_transformed_mean = summary.value.add()
                summary_value_mixed_transformed_mean.simple_value = self.mean_mixed_transformed_mean
                summary_value_mixed_transformed_mean.tag = "MixedAveragePointDistanceMean_in_mm"
                summary_value_mixed_transformed_std = summary.value.add()
                summary_value_mixed_transformed_std.simple_value = self.mean_mixed_transformed_std
                summary_value_mixed_transformed_std.tag = "MixedAveragePointDistanceStd_in_mm"
                
                self.tensorboard.writer.add_summary(summary, epoch)
            else:
                tf.summary.scalar('mAP', self.mean_ap, epoch)
                tf.summary.scalar("ADD", self.mean_add, epoch)
                tf.summary.scalar("ADD-S", self.mean_add_s, epoch)
                tf.summary.scalar("5cm_5degree", self.mean_5cm_5degree, epoch)
                tf.summary.scalar("TranslationErrorMean_in_mm", self.mean_translation_mean, epoch)
                tf.summary.scalar("TranslationErrorStd_in_mm", self.mean_translation_std, epoch)
                tf.summary.scalar("RotationErrorMean_in_degree", self.mean_rotation_mean, epoch)
                tf.summary.scalar("RotationErrorStd_in_degree", self.mean_rotation_std, epoch)
                tf.summary.scalar("2D_Projection", self.mean_2d_projection, epoch)
                tf.summary.scalar("Summed_Translation_Rotation_Error", self.mean_translation_mean + self.mean_translation_std + self.mean_rotation_mean + self.mean_rotation_std, epoch)
                tf.summary.scalar("ADD(-S)", self.mean_mixed_add_and_add_s_metric, epoch)
                tf.summary.scalar("AverageSymmetricPointDistanceMean_in_mm", self.mean_transformed_sym_mean, epoch)
                tf.summary.scalar("AverageSymmetricPointDistanceStd_in_mm", self.mean_transformed_sym_std, epoch)
                tf.summary.scalar("AveragePointDistanceMean_in_mm", self.mean_transformed_mean, epoch)
                tf.summary.scalar("AveragePointDistanceStd_in_mm", self.mean_transformed_std, epoch)
                tf.summary.scalar("MixedAveragePointDistanceMean_in_mm", self.mean_mixed_transformed_mean, epoch)
                tf.summary.scalar("MixedAveragePointDistanceStd_in_mm", self.mean_mixed_transformed_std, epoch)

        logs['mAP'] = self.mean_ap
        logs['ADD'] = self.mean_add
        logs['ADD-S'] = self.mean_add_s
        logs['5cm_5degree'] = self.mean_5cm_5degree
        logs['TranslationErrorMean_in_mm'] = self.mean_translation_mean
        logs['TranslationErrorStd_in_mm'] = self.mean_translation_std
        logs['RotationErrorMean_in_degree'] = self.mean_rotation_mean
        logs['RotationErrorStd_in_degree'] = self.mean_rotation_std
        logs['2D-Projection'] = self.mean_2d_projection
        logs['Summed_Translation_Rotation_Error'] = self.mean_translation_mean + self.mean_translation_std + self.mean_rotation_mean + self.mean_rotation_std
        logs['ADD(-S)'] = self.mean_mixed_add_and_add_s_metric
        logs['AveragePointDistanceMean_in_mm'] = self.mean_transformed_mean
        logs['AveragePointDistanceStd_in_mm'] = self.mean_transformed_std
        logs['AverageSymmetricPointDistanceMean_in_mm'] = self.mean_transformed_sym_mean
        logs['AverageSymmetricPointDistanceStd_in_mm'] = self.mean_transformed_sym_std
        logs['MixedAveragePointDistanceMean_in_mm'] = self.mean_mixed_transformed_mean
        logs['MixedAveragePointDistanceStd_in_mm'] = self.mean_mixed_transformed_std

        if self.verbose == 1:
            print('mAP: {:.4f}'.format(self.mean_ap))
            print('ADD: {:.4f}'.format(self.mean_add))
            print('ADD-S: {:.4f}'.format(self.mean_add_s))
            print('5cm_5degree: {:.4f}'.format(self.mean_5cm_5degree))
            print('TranslationErrorMean_in_mm: {:.4f}'.format(self.mean_translation_mean))
            print('TranslationErrorStd_in_mm: {:.4f}'.format(self.mean_translation_std))
            print('RotationErrorMean_in_degree: {:.4f}'.format(self.mean_rotation_mean))
            print('RotationErrorStd_in_degree: {:.4f}'.format(self.mean_rotation_std))
            print('2D-Projection: {:.4f}'.format(self.mean_2d_projection))
            print('Summed_Translation_Rotation_Error: {:.4f}'.format(self.mean_translation_mean + self.mean_translation_std + self.mean_rotation_mean + self.mean_rotation_std))
            print('ADD(-S): {:.4f}'.format(self.mean_mixed_add_and_add_s_metric))
            print('AveragePointDistanceMean_in_mm: {:.4f}'.format(self.mean_transformed_mean))
            print('AveragePointDistanceStd_in_mm: {:.4f}'.format(self.mean_transformed_std))
            print('AverageSymmetricPointDistanceMean_in_mm: {:.4f}'.format(self.mean_transformed_sym_mean))
            print('AverageSymmetricPointDistanceStd_in_mm: {:.4f}'.format(self.mean_transformed_sym_std))
            print('MixedAveragePointDistanceMean_in_mm: {:.4f}'.format(self.mean_mixed_transformed_mean))
            print('MixedAveragePointDistanceStd_in_mm: {:.4f}'.format(self.mean_mixed_transformed_std))