tensorflow/models

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

Summary

Maintainability
F
1 wk
Test Coverage

File coco_tools.py has 833 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_tools.py - About 2 days to fix

    Function ComputeMetrics has a Cognitive Complexity of 53 (exceeds 5 allowed). Consider refactoring.
    Open

      def ComputeMetrics(self,
                         include_metrics_per_category=False,
                         all_metrics_per_category=False,
                         super_categories=None):
        """Computes detection/keypoint metrics.
    Severity: Minor
    Found in research/object_detection/metrics/coco_tools.py - About 1 day 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 ExportSingleImageGroundtruthToCoco has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
    Open

    def ExportSingleImageGroundtruthToCoco(image_id,
                                           next_annotation_id,
                                           category_id_set,
                                           groundtruth_boxes,
                                           groundtruth_classes,
    Severity: Minor
    Found in research/object_detection/metrics/coco_tools.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 ExportSingleImageDetectionBoxesToCoco has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

    def ExportSingleImageDetectionBoxesToCoco(image_id,
                                              category_id_set,
                                              detection_boxes,
                                              detection_scores,
                                              detection_classes,
    Severity: Minor
    Found in research/object_detection/metrics/coco_tools.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 ExportKeypointsToCOCO has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

    def ExportKeypointsToCOCO(image_ids,
                              detection_keypoints,
                              detection_scores,
                              detection_classes,
                              categories,
    Severity: Minor
    Found in research/object_detection/metrics/coco_tools.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 ExportSingleImageGroundtruthToCoco has 10 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def ExportSingleImageGroundtruthToCoco(image_id,
    Severity: Major
    Found in research/object_detection/metrics/coco_tools.py - About 1 hr to fix

      Function ExportSegmentsToCOCO has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

      def ExportSegmentsToCOCO(image_ids,
                               detection_masks,
                               detection_scores,
                               detection_classes,
                               categories,
      Severity: Minor
      Found in research/object_detection/metrics/coco_tools.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 ExportSingleImageDetectionBoxesToCoco has 7 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def ExportSingleImageDetectionBoxesToCoco(image_id,
      Severity: Major
      Found in research/object_detection/metrics/coco_tools.py - About 50 mins to fix

        Function LoadAnnotations has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

          def LoadAnnotations(self, annotations):
            """Load annotations dictionary into COCO datastructure.
        
            See http://mscoco.org/dataset/#format for a description of the annotations
            format.  As above, this function replicates the default behavior of the API
        Severity: Minor
        Found in research/object_detection/metrics/coco_tools.py - About 45 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 ExportKeypointsToCOCO has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        def ExportKeypointsToCOCO(image_ids,
        Severity: Minor
        Found in research/object_detection/metrics/coco_tools.py - About 45 mins to fix

          Function ExportSegmentsToCOCO has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          def ExportSegmentsToCOCO(image_ids,
          Severity: Minor
          Found in research/object_detection/metrics/coco_tools.py - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                      if int(visibility) > 0:
                        num_valid_keypoints = num_valid_keypoints + 1
                    export_dict['keypoints'] = coco_keypoints
            Severity: Major
            Found in research/object_detection/metrics/coco_tools.py - About 45 mins to fix

              Function ExportDetectionsToCOCO has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              def ExportDetectionsToCOCO(image_ids,
              Severity: Minor
              Found in research/object_detection/metrics/coco_tools.py - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                            if all_metrics_per_category:
                              for metric_name, index in COCO_METRIC_NAMES_AND_INDEX:
                                metric_key = '{} BySuperCategory/{}'.format(metric_name, key)
                                super_category_ap[metric_key] += (
                                    self.category_stats[index][category_index])
                Severity: Major
                Found in research/object_detection/metrics/coco_tools.py - About 45 mins to fix

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

                  def ExportGroundtruthToCOCO(image_ids,
                  Severity: Minor
                  Found in research/object_detection/metrics/coco_tools.py - About 35 mins to fix

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

                      def __init__(self, groundtruth=None, detections=None, agnostic_mode=False,
                    Severity: Minor
                    Found in research/object_detection/metrics/coco_tools.py - About 35 mins to fix

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

                      def ExportSingleImageDetectionMasksToCoco(image_id,
                      Severity: Minor
                      Found in research/object_detection/metrics/coco_tools.py - About 35 mins to fix

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

                              if groundtruth_area is not None and groundtruth_area[i] > 0:
                                area = float(groundtruth_area[i])
                              else:
                                area = float((groundtruth_boxes[i, 2] - groundtruth_boxes[i, 0]) *
                                             (groundtruth_boxes[i, 3] - groundtruth_boxes[i, 1]))
                        Severity: Major
                        Found in research/object_detection/metrics/coco_tools.py and 1 other location - About 6 hrs to fix
                        research/object_detection/metrics/lvis_tools.py on lines 181..185

                        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 106.

                        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

                        def _ConvertBoxToCOCOFormat(box):
                          """Converts a box in [ymin, xmin, ymax, xmax] format to COCO format.
                        
                          This is a utility function for converting from our internal
                          [ymin, xmin, ymax, xmax] convention to the convention used by the COCO API
                        Severity: Major
                        Found in research/object_detection/metrics/coco_tools.py and 1 other location - About 4 hrs to fix
                        research/object_detection/metrics/lvis_tools.py on lines 60..74

                        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 81.

                        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

                          if not num_boxes == len(detection_masks) == detection_scores.shape[0]:
                            raise ValueError('Corresponding entries in detection_classes, '
                                             'detection_scores and detection_masks should have '
                                             'compatible lengths and shapes '
                                             'Classes length: %d.  Masks length: %d. '
                        Severity: Major
                        Found in research/object_detection/metrics/coco_tools.py and 1 other location - About 3 hrs to fix
                        research/object_detection/metrics/lvis_tools.py on lines 241..248

                        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 65.

                        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 _RleCompress(masks):
                          """Compresses mask using Run-length encoding provided by pycocotools.
                        
                          Args:
                            masks: uint8 numpy array of shape [mask_height, mask_width] with values in
                        Severity: Major
                        Found in research/object_detection/metrics/coco_tools.py and 1 other location - About 2 hrs to fix
                        research/object_detection/metrics/lvis_tools.py on lines 45..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 52.

                        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

                          if num_boxes != groundtruth_boxes.shape[0]:
                            raise ValueError('Corresponding entries in groundtruth_classes, '
                                             'and groundtruth_boxes should have '
                                             'compatible shapes (i.e., agree on the 0th dimension).'
                                             'Classes shape: %d. Boxes shape: %d. Image ID: %s' % (
                        Severity: Major
                        Found in research/object_detection/metrics/coco_tools.py and 1 other location - About 2 hrs to fix
                        research/object_detection/metrics/lvis_tools.py on lines 170..176

                        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 3 locations. Consider refactoring.
                        Open

                          if not (len(image_ids) == len(detection_keypoints) ==
                                  len(detection_scores) == len(detection_classes)):
                            raise ValueError('Input lists must have the same length')
                        Severity: Major
                        Found in research/object_detection/metrics/coco_tools.py and 2 other locations - About 1 hr to fix
                        research/object_detection/metrics/coco_tools.py on lines 786..788
                        research/object_detection/metrics/coco_tools.py on lines 852..854

                        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 41.

                        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 (len(image_ids) == len(detection_masks) == len(detection_scores) ==
                                  len(detection_classes)):
                            raise ValueError('Input lists must have the same length')
                        Severity: Major
                        Found in research/object_detection/metrics/coco_tools.py and 2 other locations - About 1 hr to fix
                        research/object_detection/metrics/coco_tools.py on lines 786..788
                        research/object_detection/metrics/coco_tools.py on lines 930..932

                        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 41.

                        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 (len(image_ids) == len(detection_boxes) == len(detection_scores) ==
                                  len(detection_classes)):
                            raise ValueError('Input lists must have the same length')
                        Severity: Major
                        Found in research/object_detection/metrics/coco_tools.py and 2 other locations - About 1 hr to fix
                        research/object_detection/metrics/coco_tools.py on lines 852..854
                        research/object_detection/metrics/coco_tools.py on lines 930..932

                        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 41.

                        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 len(detection_classes.shape) != 1 or len(detection_scores.shape) != 1:
                            raise ValueError('All entries in detection_classes and detection_scores'
                        Severity: Major
                        Found in research/object_detection/metrics/coco_tools.py and 4 other locations - About 1 hr to fix
                        research/object_detection/metrics/coco_tools.py on lines 715..716
                        research/object_detection/metrics/coco_tools.py on lines 861..862
                        research/object_detection/metrics/coco_tools.py on lines 938..939
                        research/object_detection/metrics/lvis_tools.py on lines 237..238

                        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 40.

                        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 len(classes.shape) != 1 or len(scores.shape) != 1:
                              raise ValueError('All entries in detection_classes and detection_scores'
                        Severity: Major
                        Found in research/object_detection/metrics/coco_tools.py and 4 other locations - About 1 hr to fix
                        research/object_detection/metrics/coco_tools.py on lines 630..631
                        research/object_detection/metrics/coco_tools.py on lines 715..716
                        research/object_detection/metrics/coco_tools.py on lines 861..862
                        research/object_detection/metrics/lvis_tools.py on lines 237..238

                        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 40.

                        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 len(detection_classes.shape) != 1 or len(detection_scores.shape) != 1:
                            raise ValueError('All entries in detection_classes and detection_scores'
                        Severity: Major
                        Found in research/object_detection/metrics/coco_tools.py and 4 other locations - About 1 hr to fix
                        research/object_detection/metrics/coco_tools.py on lines 630..631
                        research/object_detection/metrics/coco_tools.py on lines 861..862
                        research/object_detection/metrics/coco_tools.py on lines 938..939
                        research/object_detection/metrics/lvis_tools.py on lines 237..238

                        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 40.

                        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 len(classes.shape) != 1 or len(scores.shape) != 1:
                              raise ValueError('All entries in detection_classes and detection_scores'
                        Severity: Major
                        Found in research/object_detection/metrics/coco_tools.py and 4 other locations - About 1 hr to fix
                        research/object_detection/metrics/coco_tools.py on lines 630..631
                        research/object_detection/metrics/coco_tools.py on lines 715..716
                        research/object_detection/metrics/coco_tools.py on lines 938..939
                        research/object_detection/metrics/lvis_tools.py on lines 237..238

                        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 40.

                        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 num_boxes == keypoints.shape[0] == scores.shape[0]:
                              raise ValueError('Corresponding entries in detection_classes, '
                        Severity: Major
                        Found in research/object_detection/metrics/coco_tools.py and 1 other location - About 1 hr to fix
                        research/object_detection/metrics/coco_tools.py on lines 869..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 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 2 locations. Consider refactoring.
                        Open

                            if not num_boxes == masks.shape[0] == scores.shape[0]:
                              raise ValueError('Corresponding entries in segment_classes, '
                        Severity: Major
                        Found in research/object_detection/metrics/coco_tools.py and 1 other location - About 1 hr to fix
                        research/object_detection/metrics/coco_tools.py on lines 946..947

                        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 2 locations. Consider refactoring.
                        Open

                            if (set(annotation_img_ids) != (set(annotation_img_ids)
                                                            & set(self.getImgIds()))):
                              raise ValueError('Results do not correspond to current coco set')
                        Severity: Major
                        Found in research/object_detection/metrics/coco_tools.py and 1 other location - About 1 hr to fix
                        official/legacy/detection/evaluation/coco_utils.py on lines 92..93

                        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 4 locations. Consider refactoring.
                        Open

                          if output_path:
                            with tf.gfile.GFile(output_path, 'w') as fid:
                              json_utils.Dump(segment_export_list, fid, float_digits=4, indent=2)
                        Severity: Major
                        Found in research/object_detection/metrics/coco_tools.py and 3 other locations - About 50 mins to fix
                        research/object_detection/metrics/coco_tools.py on lines 582..584
                        research/object_detection/metrics/coco_tools.py on lines 798..800
                        research/object_detection/metrics/coco_tools.py on lines 977..979

                        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 4 locations. Consider refactoring.
                        Open

                          if output_path:
                            with tf.gfile.GFile(output_path, 'w') as fid:
                              json_utils.Dump(keypoints_export_list, fid, float_digits=4, indent=2)
                        Severity: Major
                        Found in research/object_detection/metrics/coco_tools.py and 3 other locations - About 50 mins to fix
                        research/object_detection/metrics/coco_tools.py on lines 582..584
                        research/object_detection/metrics/coco_tools.py on lines 798..800
                        research/object_detection/metrics/coco_tools.py on lines 878..880

                        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 4 locations. Consider refactoring.
                        Open

                          if output_path:
                            with tf.gfile.GFile(output_path, 'w') as fid:
                              json_utils.Dump(groundtruth_dict, fid, float_digits=4, indent=2)
                        Severity: Major
                        Found in research/object_detection/metrics/coco_tools.py and 3 other locations - About 50 mins to fix
                        research/object_detection/metrics/coco_tools.py on lines 798..800
                        research/object_detection/metrics/coco_tools.py on lines 878..880
                        research/object_detection/metrics/coco_tools.py on lines 977..979

                        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 4 locations. Consider refactoring.
                        Open

                          if output_path:
                            with tf.gfile.GFile(output_path, 'w') as fid:
                              json_utils.Dump(detections_export_list, fid, float_digits=4, indent=2)
                        Severity: Major
                        Found in research/object_detection/metrics/coco_tools.py and 3 other locations - About 50 mins to fix
                        research/object_detection/metrics/coco_tools.py on lines 582..584
                        research/object_detection/metrics/coco_tools.py on lines 878..880
                        research/object_detection/metrics/coco_tools.py on lines 977..979

                        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

                          if not len(image_ids) == len(groundtruth_boxes) == len(groundtruth_classes):
                            raise ValueError('Input lists must have the same length')
                        Severity: Minor
                        Found in research/object_detection/metrics/coco_tools.py and 1 other location - About 45 mins to fix
                        research/object_detection/core/losses.py on lines 691..692

                        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

                        There are no issues that match your filters.

                        Category
                        Status