tensorflow/models

View on GitHub
research/object_detection/metrics/coco_evaluation.py

Summary

Maintainability
F
3 wks
Test Coverage

File coco_evaluation.py has 1657 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
Severity: Major
Found in research/object_detection/metrics/coco_evaluation.py - About 4 days to fix

    Function add_eval_dict has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
    Open

      def add_eval_dict(self, eval_dict):
        """Observes an evaluation result dict for a single example.
    
        When executing eagerly, once all observations have been observed by this
        method you can use `.evaluate()` to get the final metrics.
    Severity: Minor
    Found in research/object_detection/metrics/coco_evaluation.py - About 4 hrs to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function _match_predictions_to_groundtruths has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
    Open

      def _match_predictions_to_groundtruths(self,
                                             predicted_masks,
                                             predicted_classes,
                                             groundtruth_masks,
                                             groundtruth_classes,
    Severity: Minor
    Found in research/object_detection/metrics/coco_evaluation.py - About 3 hrs to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function add_eval_dict has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
    Open

      def add_eval_dict(self, eval_dict):
        """Observes an evaluation result dict for a single example.
    
        When executing eagerly, once all observations have been observed by this
        method you can use `.evaluate()` to get the final metrics.
    Severity: Minor
    Found in research/object_detection/metrics/coco_evaluation.py - About 3 hrs to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function _evaluate_all_masks has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

      def _evaluate_all_masks(self):
        """Evaluate all masks and compute sum iou/TP/FP/FN."""
    
        sum_num_tp = {category['id']: 0 for category in self._categories}
        sum_num_fp = sum_num_tp.copy()
    Severity: Minor
    Found in research/object_detection/metrics/coco_evaluation.py - About 2 hrs to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function add_eval_dict has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

      def add_eval_dict(self, eval_dict):
        """Observes an evaluation result dict for a single example.
    
        When executing eagerly, once all observations have been observed by this
        method you can use `.evaluate()` to get the final metrics.
    Severity: Minor
    Found in research/object_detection/metrics/coco_evaluation.py - About 1 hr to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function update_op has 13 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def update_op(
    Severity: Major
    Found in research/object_detection/metrics/coco_evaluation.py - About 1 hr to fix

      Function _unpack_evaluation_dictionary_items has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

        def _unpack_evaluation_dictionary_items(self, eval_dict):
          """Unpack items from the evaluation dictionary."""
          input_data_fields = standard_fields.InputDataFields
          detection_fields = standard_fields.DetectionResultFields
          image_id = eval_dict[input_data_fields.key]
      Severity: Minor
      Found in research/object_detection/metrics/coco_evaluation.py - About 1 hr to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function update_op has 10 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def update_op(image_id_batched, groundtruth_boxes_batched,
      Severity: Major
      Found in research/object_detection/metrics/coco_evaluation.py - About 1 hr to fix

        Function update_op has 10 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def update_op(image_id_batched, groundtruth_boxes_batched,
        Severity: Major
        Found in research/object_detection/metrics/coco_evaluation.py - About 1 hr to fix

          Function add_single_detected_image_info has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

            def add_single_detected_image_info(self,
                                               image_id,
                                               detections_dict):
              """Adds detections for a single image to be used for evaluation.
          
          
          Severity: Minor
          Found in research/object_detection/metrics/coco_evaluation.py - About 1 hr to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Function add_single_ground_truth_image_info has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

            def add_single_ground_truth_image_info(self,
                                                   image_id,
                                                   groundtruth_dict):
              """Adds groundtruth for a single image to be used for evaluation.
          
          
          Severity: Minor
          Found in research/object_detection/metrics/coco_evaluation.py - About 55 mins to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Function update_op has 7 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def update_op(image_id_batched, groundtruth_classes_batched,
          Severity: Major
          Found in research/object_detection/metrics/coco_evaluation.py - About 50 mins to fix

            Function _match_predictions_to_groundtruths has 7 arguments (exceeds 4 allowed). Consider refactoring.
            Open

              def _match_predictions_to_groundtruths(self,
            Severity: Major
            Found in research/object_detection/metrics/coco_evaluation.py - About 50 mins to fix

              Function __init__ has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                def __init__(self,
              Severity: Minor
              Found in research/object_detection/metrics/coco_evaluation.py - About 35 mins to fix

                Function _separate_normal_and_crowd_labels has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                  def _separate_normal_and_crowd_labels(self, crowd_gt_indices,
                                                        groundtruth_masks, groundtruth_classes):
                    """Separate normal and crowd groundtruth class_labels and masks.
                
                    Args:
                Severity: Minor
                Found in research/object_detection/metrics/coco_evaluation.py - About 35 mins to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

                Function _compute_panoptic_metrics has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                  def _compute_panoptic_metrics(self, sum_tp_iou, sum_num_tp, sum_num_fp,
                                                sum_num_fn):
                    """Compute PQ metric for each category and average over all classes.
                
                    Args:
                Severity: Minor
                Found in research/object_detection/metrics/coco_evaluation.py - About 25 mins to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

                Function get_estimator_eval_metric_ops has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                  def get_estimator_eval_metric_ops(self, eval_dict):
                    """Returns a dictionary of eval metric ops.
                
                    Note that once value_op is called, the detections and groundtruth added via
                    update_op are cleared.
                Severity: Minor
                Found in research/object_detection/metrics/coco_evaluation.py - About 25 mins to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

                Similar blocks of code found in 3 locations. Consider refactoring.
                Open

                  def get_estimator_eval_metric_ops(self, eval_dict):
                    """Returns a dictionary of eval metric ops.
                
                    Note that once value_op is called, the detections and groundtruth added via
                    update_op are cleared.
                Severity: Major
                Found in research/object_detection/metrics/coco_evaluation.py and 2 other locations - About 2 days to fix
                research/object_detection/metrics/coco_evaluation.py on lines 1315..1370
                research/object_detection/metrics/lvis_evaluation.py on lines 389..444

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 237.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 3 locations. Consider refactoring.
                Open

                  def get_estimator_eval_metric_ops(self, eval_dict):
                    """Returns a dictionary of eval metric ops.
                
                    Note that once value_op is called, the detections and groundtruth added via
                    update_op are cleared.
                Severity: Major
                Found in research/object_detection/metrics/coco_evaluation.py and 2 other locations - About 2 days to fix
                research/object_detection/metrics/coco_evaluation.py on lines 439..498
                research/object_detection/metrics/lvis_evaluation.py on lines 389..444

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 237.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                  def add_single_detected_image_info(self,
                                                     image_id,
                                                     detections_dict):
                    """Adds detections for a single image to be used for evaluation.
                
                
                Severity: Major
                Found in research/object_detection/metrics/coco_evaluation.py and 1 other location - About 1 day to fix
                research/object_detection/metrics/lvis_evaluation.py on lines 169..218

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 204.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                    if not image_id.shape.as_list():
                      # Apply a batch dimension to all tensors.
                      image_id = tf.expand_dims(image_id, 0)
                      groundtruth_boxes = tf.expand_dims(groundtruth_boxes, 0)
                      groundtruth_classes = tf.expand_dims(groundtruth_classes, 0)
                Severity: Major
                Found in research/object_detection/metrics/coco_evaluation.py and 1 other location - About 1 day to fix
                research/object_detection/metrics/calibration_evaluation.py on lines 154..187

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 134.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 3 locations. Consider refactoring.
                Open

                    if not image_id.shape.as_list():
                      # Apply a batch dimension to all tensors.
                      image_id = tf.expand_dims(image_id, 0)
                      groundtruth_boxes = tf.expand_dims(groundtruth_boxes, 0)
                      groundtruth_classes = tf.expand_dims(groundtruth_classes, 0)
                Severity: Major
                Found in research/object_detection/metrics/coco_evaluation.py and 2 other locations - About 6 hrs to fix
                research/object_detection/metrics/coco_evaluation.py on lines 1873..1899
                research/object_detection/metrics/lvis_evaluation.py on lines 348..379

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 107.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 3 locations. Consider refactoring.
                Open

                    if not image_id.shape.as_list():
                      # Apply a batch dimension to all tensors.
                      image_id = tf.expand_dims(image_id, 0)
                      groundtruth_classes = tf.expand_dims(groundtruth_classes, 0)
                      groundtruth_instance_masks = tf.expand_dims(groundtruth_instance_masks, 0)
                Severity: Major
                Found in research/object_detection/metrics/coco_evaluation.py and 2 other locations - About 6 hrs to fix
                research/object_detection/metrics/coco_evaluation.py on lines 1278..1306
                research/object_detection/metrics/lvis_evaluation.py on lines 348..379

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 107.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                    if (standard_fields.InputDataFields.groundtruth_is_crowd in
                        groundtruth_dict.keys()):
                      groundtruth_is_crowd = groundtruth_dict[
                          standard_fields.InputDataFields.groundtruth_is_crowd]
                      filtered_groundtruth_is_crowd = np.take(groundtruth_is_crowd,
                Severity: Major
                Found in research/object_detection/metrics/coco_evaluation.py and 1 other location - About 2 hrs to fix
                research/object_detection/metrics/coco_evaluation.py on lines 614..620

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 61.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                    if (standard_fields.InputDataFields.groundtruth_area in
                        groundtruth_dict.keys()):
                      groundtruth_area = groundtruth_dict[
                          standard_fields.InputDataFields.groundtruth_area]
                      filtered_groundtruth_area = np.take(groundtruth_area, class_indices, 0)
                Severity: Major
                Found in research/object_detection/metrics/coco_evaluation.py and 1 other location - About 2 hrs to fix
                research/object_detection/metrics/coco_evaluation.py on lines 605..612

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 61.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Identical blocks of code found in 2 locations. Consider refactoring.
                Open

                        self.add_single_detected_image_info(
                            image_id, {
                                'detection_scores': detection_scores[:num_det_box],
                                'detection_classes': detection_classes[:num_det_box],
                                'detection_masks': detection_masks[
                Severity: Major
                Found in research/object_detection/metrics/coco_evaluation.py and 1 other location - About 2 hrs to fix
                research/object_detection/metrics/lvis_evaluation.py on lines 315..322

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 56.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                      if groundtruth_keypoint_visibilities is None:
                        groundtruth_keypoint_visibilities = tf.fill([
                            tf.shape(groundtruth_boxes)[1],
                            tf.shape(groundtruth_keypoints)[2]
                        ], tf.constant(2, dtype=tf.int32))
                Severity: Major
                Found in research/object_detection/metrics/coco_evaluation.py and 1 other location - About 2 hrs to fix
                research/object_detection/metrics/coco_evaluation.py on lines 885..888

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 51.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                        groundtruth_keypoint_visibilities = tf.fill([
                            tf.shape(groundtruth_keypoints)[1],
                            tf.shape(groundtruth_keypoints)[2]
                        ], tf.constant(2, dtype=tf.int32))
                Severity: Major
                Found in research/object_detection/metrics/coco_evaluation.py and 1 other location - About 2 hrs to fix
                research/object_detection/metrics/coco_evaluation.py on lines 866..870

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 51.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                          if not is_crowd:
                            overlap = np_mask_ops.iou(predicted_masks[pid:pid + 1],
                                                      groundtruth_masks[gid:gid + 1])[0, 0]
                Severity: Major
                Found in research/object_detection/metrics/coco_evaluation.py and 1 other location - About 1 hr to fix
                research/object_detection/metrics/coco_evaluation.py on lines 1839..1844

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 49.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 12 locations. Consider refactoring.
                Open

                      if num_gt_boxes_per_image is None:
                        num_gt_boxes_per_image = tf.shape(groundtruth_boxes)[1:2]
                      else:
                        num_gt_boxes_per_image = tf.expand_dims(num_gt_boxes_per_image, 0)
                Severity: Major
                Found in research/object_detection/metrics/coco_evaluation.py and 11 other locations - About 1 hr to fix
                research/object_detection/metrics/calibration_evaluation.py on lines 163..166
                research/object_detection/metrics/calibration_evaluation.py on lines 168..171
                research/object_detection/metrics/coco_evaluation.py on lines 411..414
                research/object_detection/metrics/coco_evaluation.py on lines 851..854
                research/object_detection/metrics/coco_evaluation.py on lines 856..859
                research/object_detection/metrics/coco_evaluation.py on lines 1289..1292
                research/object_detection/metrics/coco_evaluation.py on lines 1294..1297
                research/object_detection/metrics/coco_evaluation.py on lines 1882..1885
                research/object_detection/metrics/coco_evaluation.py on lines 1887..1890
                research/object_detection/metrics/lvis_evaluation.py on lines 362..365
                research/object_detection/metrics/lvis_evaluation.py on lines 367..370

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 42.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 12 locations. Consider refactoring.
                Open

                      if num_gt_boxes_per_image is None:
                        num_gt_boxes_per_image = tf.shape(groundtruth_boxes)[1:2]
                      else:
                        num_gt_boxes_per_image = tf.expand_dims(num_gt_boxes_per_image, 0)
                Severity: Major
                Found in research/object_detection/metrics/coco_evaluation.py and 11 other locations - About 1 hr to fix
                research/object_detection/metrics/calibration_evaluation.py on lines 163..166
                research/object_detection/metrics/calibration_evaluation.py on lines 168..171
                research/object_detection/metrics/coco_evaluation.py on lines 406..409
                research/object_detection/metrics/coco_evaluation.py on lines 411..414
                research/object_detection/metrics/coco_evaluation.py on lines 851..854
                research/object_detection/metrics/coco_evaluation.py on lines 856..859
                research/object_detection/metrics/coco_evaluation.py on lines 1294..1297
                research/object_detection/metrics/coco_evaluation.py on lines 1882..1885
                research/object_detection/metrics/coco_evaluation.py on lines 1887..1890
                research/object_detection/metrics/lvis_evaluation.py on lines 362..365
                research/object_detection/metrics/lvis_evaluation.py on lines 367..370

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 42.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 12 locations. Consider refactoring.
                Open

                      if num_gt_masks_per_image is None:
                        num_gt_masks_per_image = tf.shape(groundtruth_classes)[1:2]
                      else:
                        num_gt_masks_per_image = tf.expand_dims(num_gt_masks_per_image, 0)
                Severity: Major
                Found in research/object_detection/metrics/coco_evaluation.py and 11 other locations - About 1 hr to fix
                research/object_detection/metrics/calibration_evaluation.py on lines 163..166
                research/object_detection/metrics/calibration_evaluation.py on lines 168..171
                research/object_detection/metrics/coco_evaluation.py on lines 406..409
                research/object_detection/metrics/coco_evaluation.py on lines 411..414
                research/object_detection/metrics/coco_evaluation.py on lines 851..854
                research/object_detection/metrics/coco_evaluation.py on lines 856..859
                research/object_detection/metrics/coco_evaluation.py on lines 1289..1292
                research/object_detection/metrics/coco_evaluation.py on lines 1294..1297
                research/object_detection/metrics/coco_evaluation.py on lines 1887..1890
                research/object_detection/metrics/lvis_evaluation.py on lines 362..365
                research/object_detection/metrics/lvis_evaluation.py on lines 367..370

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 42.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 12 locations. Consider refactoring.
                Open

                      if num_det_masks_per_image is None:
                        num_det_masks_per_image = tf.shape(detection_classes)[1:2]
                      else:
                        num_det_masks_per_image = tf.expand_dims(num_det_masks_per_image, 0)
                Severity: Major
                Found in research/object_detection/metrics/coco_evaluation.py and 11 other locations - About 1 hr to fix
                research/object_detection/metrics/calibration_evaluation.py on lines 163..166
                research/object_detection/metrics/calibration_evaluation.py on lines 168..171
                research/object_detection/metrics/coco_evaluation.py on lines 406..409
                research/object_detection/metrics/coco_evaluation.py on lines 411..414
                research/object_detection/metrics/coco_evaluation.py on lines 851..854
                research/object_detection/metrics/coco_evaluation.py on lines 856..859
                research/object_detection/metrics/coco_evaluation.py on lines 1289..1292
                research/object_detection/metrics/coco_evaluation.py on lines 1294..1297
                research/object_detection/metrics/coco_evaluation.py on lines 1882..1885
                research/object_detection/metrics/lvis_evaluation.py on lines 362..365
                research/object_detection/metrics/lvis_evaluation.py on lines 367..370

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 42.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 12 locations. Consider refactoring.
                Open

                      if num_det_boxes_per_image is None:
                        num_det_boxes_per_image = tf.shape(detection_boxes)[1:2]
                      else:
                        num_det_boxes_per_image = tf.expand_dims(num_det_boxes_per_image, 0)
                Severity: Major
                Found in research/object_detection/metrics/coco_evaluation.py and 11 other locations - About 1 hr to fix
                research/object_detection/metrics/calibration_evaluation.py on lines 163..166
                research/object_detection/metrics/calibration_evaluation.py on lines 168..171
                research/object_detection/metrics/coco_evaluation.py on lines 406..409
                research/object_detection/metrics/coco_evaluation.py on lines 411..414
                research/object_detection/metrics/coco_evaluation.py on lines 851..854
                research/object_detection/metrics/coco_evaluation.py on lines 1289..1292
                research/object_detection/metrics/coco_evaluation.py on lines 1294..1297
                research/object_detection/metrics/coco_evaluation.py on lines 1882..1885
                research/object_detection/metrics/coco_evaluation.py on lines 1887..1890
                research/object_detection/metrics/lvis_evaluation.py on lines 362..365
                research/object_detection/metrics/lvis_evaluation.py on lines 367..370

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 42.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 12 locations. Consider refactoring.
                Open

                      if num_gt_boxes_per_image is None:
                        num_gt_boxes_per_image = tf.shape(groundtruth_boxes)[1:2]
                      else:
                        num_gt_boxes_per_image = tf.expand_dims(num_gt_boxes_per_image, 0)
                Severity: Major
                Found in research/object_detection/metrics/coco_evaluation.py and 11 other locations - About 1 hr to fix
                research/object_detection/metrics/calibration_evaluation.py on lines 163..166
                research/object_detection/metrics/calibration_evaluation.py on lines 168..171
                research/object_detection/metrics/coco_evaluation.py on lines 406..409
                research/object_detection/metrics/coco_evaluation.py on lines 411..414
                research/object_detection/metrics/coco_evaluation.py on lines 856..859
                research/object_detection/metrics/coco_evaluation.py on lines 1289..1292
                research/object_detection/metrics/coco_evaluation.py on lines 1294..1297
                research/object_detection/metrics/coco_evaluation.py on lines 1882..1885
                research/object_detection/metrics/coco_evaluation.py on lines 1887..1890
                research/object_detection/metrics/lvis_evaluation.py on lines 362..365
                research/object_detection/metrics/lvis_evaluation.py on lines 367..370

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 42.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 12 locations. Consider refactoring.
                Open

                      if num_det_boxes_per_image is None:
                        num_det_boxes_per_image = tf.shape(detection_boxes)[1:2]
                      else:
                        num_det_boxes_per_image = tf.expand_dims(num_det_boxes_per_image, 0)
                Severity: Major
                Found in research/object_detection/metrics/coco_evaluation.py and 11 other locations - About 1 hr to fix
                research/object_detection/metrics/calibration_evaluation.py on lines 163..166
                research/object_detection/metrics/calibration_evaluation.py on lines 168..171
                research/object_detection/metrics/coco_evaluation.py on lines 406..409
                research/object_detection/metrics/coco_evaluation.py on lines 851..854
                research/object_detection/metrics/coco_evaluation.py on lines 856..859
                research/object_detection/metrics/coco_evaluation.py on lines 1289..1292
                research/object_detection/metrics/coco_evaluation.py on lines 1294..1297
                research/object_detection/metrics/coco_evaluation.py on lines 1882..1885
                research/object_detection/metrics/coco_evaluation.py on lines 1887..1890
                research/object_detection/metrics/lvis_evaluation.py on lines 362..365
                research/object_detection/metrics/lvis_evaluation.py on lines 367..370

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 42.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 12 locations. Consider refactoring.
                Open

                      if num_det_boxes_per_image is None:
                        num_det_boxes_per_image = tf.shape(detection_scores)[1:2]
                      else:
                        num_det_boxes_per_image = tf.expand_dims(num_det_boxes_per_image, 0)
                Severity: Major
                Found in research/object_detection/metrics/coco_evaluation.py and 11 other locations - About 1 hr to fix
                research/object_detection/metrics/calibration_evaluation.py on lines 163..166
                research/object_detection/metrics/calibration_evaluation.py on lines 168..171
                research/object_detection/metrics/coco_evaluation.py on lines 406..409
                research/object_detection/metrics/coco_evaluation.py on lines 411..414
                research/object_detection/metrics/coco_evaluation.py on lines 851..854
                research/object_detection/metrics/coco_evaluation.py on lines 856..859
                research/object_detection/metrics/coco_evaluation.py on lines 1289..1292
                research/object_detection/metrics/coco_evaluation.py on lines 1882..1885
                research/object_detection/metrics/coco_evaluation.py on lines 1887..1890
                research/object_detection/metrics/lvis_evaluation.py on lines 362..365
                research/object_detection/metrics/lvis_evaluation.py on lines 367..370

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 42.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 3 locations. Consider refactoring.
                Open

                      self._groundtruth_labeled_classes[image_id] = np.flatnonzero(
                          groundtruth_dict[standard_fields.InputDataFields
                Severity: Major
                Found in research/object_detection/metrics/coco_evaluation.py and 2 other locations - About 1 hr to fix
                research/object_detection/metrics/lvis_evaluation.py on lines 136..138
                research/object_detection/metrics/lvis_evaluation.py on lines 140..142

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 39.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 3 locations. Consider refactoring.
                Open

                      if is_annotated is None:
                        is_annotated = tf.constant([True])
                      else:
                        is_annotated = tf.expand_dims(is_annotated, 0)
                Severity: Major
                Found in research/object_detection/metrics/coco_evaluation.py and 2 other locations - About 50 mins to fix
                research/object_detection/metrics/calibration_evaluation.py on lines 173..176
                research/object_detection/metrics/coco_evaluation.py on lines 416..419

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 36.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 3 locations. Consider refactoring.
                Open

                      if is_annotated is None:
                        is_annotated = tf.constant([True])
                      else:
                        is_annotated = tf.expand_dims(is_annotated, 0)
                Severity: Major
                Found in research/object_detection/metrics/coco_evaluation.py and 2 other locations - About 50 mins to fix
                research/object_detection/metrics/calibration_evaluation.py on lines 173..176
                research/object_detection/metrics/coco_evaluation.py on lines 861..864

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 36.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                          self.add_single_detected_image_info(
                              image_id,
                              {'detection_boxes': det_box[:num_det_box],
                               'detection_scores': det_score[:num_det_box],
                               'detection_classes': det_class[:num_det_box]})
                Severity: Minor
                Found in research/object_detection/metrics/coco_evaluation.py and 1 other location - About 50 mins to fix
                research/object_detection/metrics/coco_evaluation.py on lines 1545..1552

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 36.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                        self.add_single_ground_truth_image_info(
                            image_id, {
                                'groundtruth_classes':
                                    groundtruth_classes[:num_gt_mask],
                                'groundtruth_instance_masks':
                Severity: Minor
                Found in research/object_detection/metrics/coco_evaluation.py and 1 other location - About 50 mins to fix
                research/object_detection/metrics/coco_evaluation.py on lines 356..360

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 36.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                      for (class_id, is_matched) in zip(normal_gt_classes, gt_matched):
                        if not is_matched:
                          sum_num_fn[class_id] += 1
                Severity: Minor
                Found in research/object_detection/metrics/coco_evaluation.py and 1 other location - About 45 mins to fix
                research/object_detection/metrics/coco_evaluation.py on lines 1658..1660

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 35.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                      for (class_id, is_matched) in zip(remained_pred_classes, pred_matched):
                        if not is_matched:
                          sum_num_fp[class_id] += 1
                Severity: Minor
                Found in research/object_detection/metrics/coco_evaluation.py and 1 other location - About 45 mins to fix
                research/object_detection/metrics/coco_evaluation.py on lines 1640..1642

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 35.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                      (panoptic_quality, segmentation_quality,
                       recognition_quality) = self._compute_panoptic_metrics_single_class(
                           sum_tp_iou[class_id], sum_num_tp[class_id], sum_num_fp[class_id],
                           sum_num_fn[class_id])
                Severity: Minor
                Found in research/object_detection/metrics/coco_evaluation.py and 1 other location - About 40 mins to fix
                research/delf/delf/python/detect_to_retrieve/perform_retrieval.py on lines 165..167

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 34.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                      if matched_gt_id >= 0:
                        gt_matched[matched_gt_id] = True
                        pred_matched[pid] = True
                        best_overlaps[pid] = best_overlap
                Severity: Minor
                Found in research/object_detection/metrics/coco_evaluation.py and 1 other location - About 40 mins to fix
                research/object_detection/utils/per_image_evaluation.py on lines 527..530

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 34.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 5 locations. Consider refactoring.
                Open

                    if groundtruth_masks.shape[0] != groundtruth_classes.shape[0]:
                      raise ValueError(
                Severity: Major
                Found in research/object_detection/metrics/coco_evaluation.py and 4 other locations - About 35 mins to fix
                research/object_detection/metrics/coco_evaluation.py on lines 1761..1762
                research/object_detection/metrics/coco_evaluation.py on lines 1768..1769
                research/object_detection/metrics/coco_evaluation.py on lines 1826..1827
                research/object_detection/utils/np_box_mask_list.py on lines 56..57

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 33.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 5 locations. Consider refactoring.
                Open

                    if predicted_masks.shape[0] != predicted_classes.shape[0]:
                      raise ValueError(
                Severity: Major
                Found in research/object_detection/metrics/coco_evaluation.py and 4 other locations - About 35 mins to fix
                research/object_detection/metrics/coco_evaluation.py on lines 1761..1762
                research/object_detection/metrics/coco_evaluation.py on lines 1768..1769
                research/object_detection/metrics/coco_evaluation.py on lines 1823..1824
                research/object_detection/utils/np_box_mask_list.py on lines 56..57

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 33.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 5 locations. Consider refactoring.
                Open

                      if groundtruth_masks.shape[0] != crowd_gt_indices.shape[0]:
                        raise ValueError(
                Severity: Major
                Found in research/object_detection/metrics/coco_evaluation.py and 4 other locations - About 35 mins to fix
                research/object_detection/metrics/coco_evaluation.py on lines 1761..1762
                research/object_detection/metrics/coco_evaluation.py on lines 1823..1824
                research/object_detection/metrics/coco_evaluation.py on lines 1826..1827
                research/object_detection/utils/np_box_mask_list.py on lines 56..57

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 33.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 5 locations. Consider refactoring.
                Open

                    if groundtruth_masks.shape[0] != groundtruth_classes.shape[0]:
                      raise ValueError(
                Severity: Major
                Found in research/object_detection/metrics/coco_evaluation.py and 4 other locations - About 35 mins to fix
                research/object_detection/metrics/coco_evaluation.py on lines 1768..1769
                research/object_detection/metrics/coco_evaluation.py on lines 1823..1824
                research/object_detection/metrics/coco_evaluation.py on lines 1826..1827
                research/object_detection/utils/np_box_mask_list.py on lines 56..57

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 33.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 8 locations. Consider refactoring.
                Open

                    if groundtruth_keypoint_visibilities is not None and not groundtruth_keypoint_visibilities.shape[
                        0]:
                      groundtruth_keypoint_visibilities = None
                Severity: Major
                Found in research/object_detection/metrics/coco_evaluation.py and 7 other locations - About 30 mins to fix
                research/object_detection/metrics/coco_evaluation.py on lines 126..127
                research/object_detection/metrics/coco_evaluation.py on lines 128..129
                research/object_detection/metrics/coco_evaluation.py on lines 130..131
                research/object_detection/metrics/coco_evaluation.py on lines 203..204
                research/object_detection/metrics/coco_evaluation.py on lines 1038..1039
                research/object_detection/metrics/coco_evaluation.py on lines 1040..1041
                research/object_detection/metrics/lvis_evaluation.py on lines 148..149

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 32.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 8 locations. Consider refactoring.
                Open

                    if groundtruth_area is not None and not groundtruth_area.shape[0]:
                      groundtruth_area = None
                Severity: Major
                Found in research/object_detection/metrics/coco_evaluation.py and 7 other locations - About 30 mins to fix
                research/object_detection/metrics/coco_evaluation.py on lines 126..127
                research/object_detection/metrics/coco_evaluation.py on lines 128..129
                research/object_detection/metrics/coco_evaluation.py on lines 130..131
                research/object_detection/metrics/coco_evaluation.py on lines 132..134
                research/object_detection/metrics/coco_evaluation.py on lines 203..204
                research/object_detection/metrics/coco_evaluation.py on lines 1038..1039
                research/object_detection/metrics/lvis_evaluation.py on lines 148..149

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 32.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 8 locations. Consider refactoring.
                Open

                    if groundtruth_is_crowd is not None and not groundtruth_is_crowd.shape[0]:
                      groundtruth_is_crowd = None
                Severity: Major
                Found in research/object_detection/metrics/coco_evaluation.py and 7 other locations - About 30 mins to fix
                research/object_detection/metrics/coco_evaluation.py on lines 126..127
                research/object_detection/metrics/coco_evaluation.py on lines 128..129
                research/object_detection/metrics/coco_evaluation.py on lines 130..131
                research/object_detection/metrics/coco_evaluation.py on lines 132..134
                research/object_detection/metrics/coco_evaluation.py on lines 203..204
                research/object_detection/metrics/coco_evaluation.py on lines 1040..1041
                research/object_detection/metrics/lvis_evaluation.py on lines 148..149

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 32.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 8 locations. Consider refactoring.
                Open

                    if groundtruth_is_crowd is not None and not groundtruth_is_crowd.shape[0]:
                      groundtruth_is_crowd = None
                Severity: Major
                Found in research/object_detection/metrics/coco_evaluation.py and 7 other locations - About 30 mins to fix
                research/object_detection/metrics/coco_evaluation.py on lines 128..129
                research/object_detection/metrics/coco_evaluation.py on lines 130..131
                research/object_detection/metrics/coco_evaluation.py on lines 132..134
                research/object_detection/metrics/coco_evaluation.py on lines 203..204
                research/object_detection/metrics/coco_evaluation.py on lines 1038..1039
                research/object_detection/metrics/coco_evaluation.py on lines 1040..1041
                research/object_detection/metrics/lvis_evaluation.py on lines 148..149

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 32.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 8 locations. Consider refactoring.
                Open

                    if detection_keypoints is not None and not detection_keypoints.shape[0]:
                      detection_keypoints = None
                Severity: Major
                Found in research/object_detection/metrics/coco_evaluation.py and 7 other locations - About 30 mins to fix
                research/object_detection/metrics/coco_evaluation.py on lines 126..127
                research/object_detection/metrics/coco_evaluation.py on lines 128..129
                research/object_detection/metrics/coco_evaluation.py on lines 130..131
                research/object_detection/metrics/coco_evaluation.py on lines 132..134
                research/object_detection/metrics/coco_evaluation.py on lines 1038..1039
                research/object_detection/metrics/coco_evaluation.py on lines 1040..1041
                research/object_detection/metrics/lvis_evaluation.py on lines 148..149

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 32.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 8 locations. Consider refactoring.
                Open

                    if groundtruth_keypoints is not None and not groundtruth_keypoints.shape[0]:
                      groundtruth_keypoints = None
                Severity: Major
                Found in research/object_detection/metrics/coco_evaluation.py and 7 other locations - About 30 mins to fix
                research/object_detection/metrics/coco_evaluation.py on lines 126..127
                research/object_detection/metrics/coco_evaluation.py on lines 128..129
                research/object_detection/metrics/coco_evaluation.py on lines 132..134
                research/object_detection/metrics/coco_evaluation.py on lines 203..204
                research/object_detection/metrics/coco_evaluation.py on lines 1038..1039
                research/object_detection/metrics/coco_evaluation.py on lines 1040..1041
                research/object_detection/metrics/lvis_evaluation.py on lines 148..149

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 32.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 8 locations. Consider refactoring.
                Open

                    if groundtruth_area is not None and not groundtruth_area.shape[0]:
                      groundtruth_area = None
                Severity: Major
                Found in research/object_detection/metrics/coco_evaluation.py and 7 other locations - About 30 mins to fix
                research/object_detection/metrics/coco_evaluation.py on lines 126..127
                research/object_detection/metrics/coco_evaluation.py on lines 130..131
                research/object_detection/metrics/coco_evaluation.py on lines 132..134
                research/object_detection/metrics/coco_evaluation.py on lines 203..204
                research/object_detection/metrics/coco_evaluation.py on lines 1038..1039
                research/object_detection/metrics/coco_evaluation.py on lines 1040..1041
                research/object_detection/metrics/lvis_evaluation.py on lines 148..149

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 32.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 3 locations. Consider refactoring.
                Open

                    keypoint_metrics = {
                        'Keypoints_' + key: value
                        for key, value in iter(keypoint_metrics.items())
                Severity: Minor
                Found in research/object_detection/metrics/coco_evaluation.py and 2 other locations - About 30 mins to fix
                research/object_detection/metrics/coco_evaluation.py on lines 309..310
                research/object_detection/metrics/lvis_evaluation.py on lines 253..254

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 32.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 3 locations. Consider refactoring.
                Open

                    box_metrics = {'DetectionBoxes_'+ key: value
                                   for key, value in iter(box_metrics.items())}
                Severity: Minor
                Found in research/object_detection/metrics/coco_evaluation.py and 2 other locations - About 30 mins to fix
                research/object_detection/metrics/coco_evaluation.py on lines 741..743
                research/object_detection/metrics/lvis_evaluation.py on lines 253..254

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 32.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                There are no issues that match your filters.

                Category
                Status