tensorflow/models

View on GitHub
official/legacy/detection/evaluation/coco_evaluator.py

Summary

Maintainability
F
2 wks
Test Coverage

File coco_evaluator.py has 699 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# Copyright 2024 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 official/legacy/detection/evaluation/coco_evaluator.py - About 1 day to fix

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

      def evaluateImg(self, img_id, cat_id, a_rng, max_det):
        p = self.params
        if p.useCats:
          gt = self._gts[img_id, cat_id]
          dt = self._dts[img_id, cat_id]
    Severity: Minor
    Found in official/legacy/detection/evaluation/coco_evaluator.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 evaluate has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
    Open

      def evaluate(self):
        """Evaluates with detections from all images with COCO API.
    
        Returns:
          coco_metric: float numpy array with shape [24] representing the
    Severity: Minor
    Found in official/legacy/detection/evaluation/coco_evaluator.py - About 6 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 summarize has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

      def summarize(self):
        """Compute and display summary metrics for evaluation results.
    
        Delta to the standard cocoapi function:
          More Averate Recall metrics are produced with different top-K proposals.
    Severity: Minor
    Found in official/legacy/detection/evaluation/coco_evaluator.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 update has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

      def update(self, predictions, groundtruths=None):
        """Update and aggregate detection results and groundtruth data.
    
        Args:
          predictions: a dictionary of numpy arrays including the fields below. See
    Severity: Minor
    Found in official/legacy/detection/evaluation/coco_evaluator.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 evaluate has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

      def evaluate(self):
        """Evaluates with detections from all images with COCO API.
    
        Returns:
          coco_metric: float numpy array with shape [24] representing the
    Severity: Minor
    Found in official/legacy/detection/evaluation/coco_evaluator.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 evaluate has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

      def evaluate(self):
        """Evaluates with detections from all images with COCO API.
    
        Returns:
          coco_metric: float numpy array with shape [24] representing the
    Severity: Minor
    Found in official/legacy/detection/evaluation/coco_evaluator.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

    Avoid deeply nested control flow statements.
    Open

                if ious[dind, gind] < iou:
                  continue
                # if match successful and best so far, store appropriately
                iou = ious[dind, gind]
    Severity: Major
    Found in official/legacy/detection/evaluation/coco_evaluator.py - About 45 mins to fix

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

        def evaluate(self):
          """Evaluates with detections from all images with COCO API.
      
          Returns:
            coco_metric: float numpy array with shape [24] representing the
      Severity: Minor
      Found in official/legacy/detection/evaluation/coco_evaluator.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 __init__ has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        def __init__(self, annotation_file, include_mask, need_rescale_bboxes=True):
          """Constructs COCO evaluation class.
      
          The class provides the interface to metrics_fn in TPUEstimator. The
          _update_op() takes detections from each image and push them to
      Severity: Minor
      Found in official/legacy/detection/evaluation/coco_evaluator.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

      Avoid deeply nested control flow statements.
      Open

                  if gtm[tind, gind] > 0 and not iscrowd[gind]:
                    continue
                  # if dt matched to reg gt, and on ignore gt, stop
                  if m > -1 and gt_ig[m] == 0 and gt_ig[gind] == 1:
      Severity: Major
      Found in official/legacy/detection/evaluation/coco_evaluator.py - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                    if m > -1 and gt_ig[m] == 0 and gt_ig[gind] == 1:
                      break
                    # continue to next gt unless better match made
                    if ious[dind, gind] < iou:
        Severity: Major
        Found in official/legacy/detection/evaluation/coco_evaluator.py - About 45 mins to fix

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

            def __init__(self, annotation_file, include_mask, need_rescale_bboxes=True,
          Severity: Minor
          Found in official/legacy/detection/evaluation/coco_evaluator.py - About 35 mins to fix

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

              def __init__(self, annotation_file, include_mask, need_rescale_bboxes=True,
            Severity: Minor
            Found in official/legacy/detection/evaluation/coco_evaluator.py - About 35 mins to fix

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

                def update_state(self, y_true, y_pred):
                  """Update internal states."""
                  labels = tf.nest.map_structure(lambda x: x.numpy(), y_true)
                  outputs = tf.nest.map_structure(lambda x: x.numpy(), y_pred)
                  groundtruths = {}
              Severity: Minor
              Found in official/legacy/detection/evaluation/coco_evaluator.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 4 locations. Consider refactoring.
              Open

                    if self._include_mask:
                      mcoco_eval_novel = cocoeval.OlnCOCOevalXclassWrapper(
                          coco_gt_novel, coco_dt, iou_type='segm')
                      mcoco_eval_novel.params.maxDets = [10, 20, 50, 100, 200]
                      mcoco_eval_novel.params.imgIds = image_ids
              Severity: Major
              Found in official/legacy/detection/evaluation/coco_evaluator.py and 3 other locations - About 5 hrs to fix
              official/legacy/detection/evaluation/coco_evaluator.py on lines 588..597
              official/legacy/detection/evaluation/coco_evaluator.py on lines 621..630
              official/legacy/detection/evaluation/coco_evaluator.py on lines 741..750

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

              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 self._include_mask:
                    mcoco_eval = cocoeval.OlnCOCOevalWrapper(coco_gt, coco_dt,
                                                             iou_type='segm')
                    mcoco_eval.params.maxDets = [10, 20, 50, 100, 200]
                    mcoco_eval.params.imgIds = image_ids
              Severity: Major
              Found in official/legacy/detection/evaluation/coco_evaluator.py and 3 other locations - About 5 hrs to fix
              official/legacy/detection/evaluation/coco_evaluator.py on lines 588..597
              official/legacy/detection/evaluation/coco_evaluator.py on lines 621..630
              official/legacy/detection/evaluation/coco_evaluator.py on lines 648..657

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

              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 self._include_mask:
                      mcoco_eval_seen = cocoeval.OlnCOCOevalXclassWrapper(
                          coco_gt_seen, coco_dt, iou_type='segm')
                      mcoco_eval_seen.params.maxDets = [10, 20, 50, 100, 200]
                      mcoco_eval_seen.params.imgIds = image_ids
              Severity: Major
              Found in official/legacy/detection/evaluation/coco_evaluator.py and 3 other locations - About 5 hrs to fix
              official/legacy/detection/evaluation/coco_evaluator.py on lines 588..597
              official/legacy/detection/evaluation/coco_evaluator.py on lines 648..657
              official/legacy/detection/evaluation/coco_evaluator.py on lines 741..750

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

              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 self._include_mask:
                    mcoco_eval = cocoeval.OlnCOCOevalXclassWrapper(
                        coco_gt, coco_dt, iou_type='segm')
                    mcoco_eval.params.maxDets = [10, 20, 50, 100, 200]
                    mcoco_eval.params.imgIds = image_ids
              Severity: Major
              Found in official/legacy/detection/evaluation/coco_evaluator.py and 3 other locations - About 5 hrs to fix
              official/legacy/detection/evaluation/coco_evaluator.py on lines 621..630
              official/legacy/detection/evaluation/coco_evaluator.py on lines 648..657
              official/legacy/detection/evaluation/coco_evaluator.py on lines 741..750

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

              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 idx, ann in enumerate(coco_gt.dataset['annotations']):
                      if ann['category_id'] in self._seen_class_ids:
                        coco_gt_seen.dataset['annotations'][idx]['ignored_split'] = 0
                      else:
                        coco_gt_seen.dataset['annotations'][idx]['ignored_split'] = 1
              Severity: Major
              Found in official/legacy/detection/evaluation/coco_evaluator.py and 1 other location - About 5 hrs to fix
              official/legacy/detection/evaluation/coco_evaluator.py on lines 634..638

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

              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 idx, ann in enumerate(coco_gt.dataset['annotations']):
                      if ann['category_id'] in self._seen_class_ids:
                        coco_gt_novel.dataset['annotations'][idx]['ignored_split'] = 1
                      else:
                        coco_gt_novel.dataset['annotations'][idx]['ignored_split'] = 0
              Severity: Major
              Found in official/legacy/detection/evaluation/coco_evaluator.py and 1 other location - About 5 hrs to fix
              official/legacy/detection/evaluation/coco_evaluator.py on lines 607..611

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

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

                  if not self._annotation_file:
                    logging.info('Thre is no annotation_file in COCOEvaluator.')
                    gt_dataset = coco_utils.convert_groundtruths_to_coco_dataset(
                        self._groundtruths)
                    coco_gt = coco_utils.COCOWrapper(
              Severity: Major
              Found in official/legacy/detection/evaluation/coco_evaluator.py and 2 other locations - About 4 hrs to fix
              official/legacy/detection/evaluation/coco_evaluator.py on lines 560..569
              official/legacy/detection/evaluation/coco_evaluator.py on lines 715..724

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

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

                  if not self._annotation_file:
                    logging.info('Thre is no annotation_file in COCOEvaluator.')
                    gt_dataset = coco_utils.convert_groundtruths_to_coco_dataset(
                        self._groundtruths)
                    coco_gt = coco_utils.COCOWrapper(
              Severity: Major
              Found in official/legacy/detection/evaluation/coco_evaluator.py and 2 other locations - About 4 hrs to fix
              official/legacy/detection/evaluation/coco_evaluator.py on lines 377..386
              official/legacy/detection/evaluation/coco_evaluator.py on lines 560..569

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

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

                  if not self._annotation_file:
                    logging.info('Thre is no annotation_file in COCOEvaluator.')
                    gt_dataset = coco_utils.convert_groundtruths_to_coco_dataset(
                        self._groundtruths)
                    coco_gt = coco_utils.COCOWrapper(
              Severity: Major
              Found in official/legacy/detection/evaluation/coco_evaluator.py and 2 other locations - About 4 hrs to fix
              official/legacy/detection/evaluation/coco_evaluator.py on lines 377..386
              official/legacy/detection/evaluation/coco_evaluator.py on lines 715..724

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

              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 self._include_mask:
                    mask_metric_names = ['mask_' + x for x in self._metric_names]
                    self._metric_names.extend(mask_metric_names)
                    self._required_prediction_fields.extend(['detection_masks'])
                    self._required_groundtruth_fields.extend(['masks'])
              Severity: Major
              Found in official/legacy/detection/evaluation/coco_evaluator.py and 1 other location - About 3 hrs to fix
              official/legacy/detection/evaluation/coco_evaluator.py on lines 545..549

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

              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 self._include_mask:
                    mask_metric_names = ['mask_' + x for x in self._metric_names]
                    self._metric_names.extend(mask_metric_names)
                    self._required_prediction_fields.extend(['detection_masks'])
                    self._required_groundtruth_fields.extend(['masks'])
              Severity: Major
              Found in official/legacy/detection/evaluation/coco_evaluator.py and 1 other location - About 3 hrs to fix
              official/legacy/detection/evaluation/coco_evaluator.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 64.

              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 k, v in six.iteritems(predictions):
                    if k not in self._predictions:
                      self._predictions[k] = [v]
                    else:
                      self._predictions[k].append(v)
              Severity: Major
              Found in official/legacy/detection/evaluation/coco_evaluator.py and 1 other location - About 2 hrs to fix
              official/legacy/detection/evaluation/coco_evaluator.py on lines 487..491

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

              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 k, v in six.iteritems(groundtruths):
                      if k not in self._groundtruths:
                        self._groundtruths[k] = [v]
                      else:
                        self._groundtruths[k].append(v)
              Severity: Major
              Found in official/legacy/detection/evaluation/coco_evaluator.py and 1 other location - About 2 hrs to fix
              official/legacy/detection/evaluation/coco_evaluator.py on lines 475..479

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

              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 iou_thr is not None:
                        t = np.where(iou_thr == p.iouThrs)[0]
                        s = s[t]
              Severity: Major
              Found in official/legacy/detection/evaluation/coco_evaluator.py and 1 other location - About 1 hr to fix
              official/legacy/detection/evaluation/coco_evaluator.py on lines 97..99

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

              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 iou_thr is not None:
                        t = np.where(iou_thr == p.iouThrs)[0]
                        s = s[t]
              Severity: Major
              Found in official/legacy/detection/evaluation/coco_evaluator.py and 1 other location - About 1 hr to fix
              official/legacy/detection/evaluation/coco_evaluator.py on lines 90..92

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

              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 idx, ann in enumerate(coco_gt.dataset['annotations']):
                    coco_gt.dataset['annotations'][idx]['ignored_split'] = 0
              Severity: Major
              Found in official/legacy/detection/evaluation/coco_evaluator.py and 1 other location - About 1 hr to fix
              official/legacy/detection/evaluation/coco_evaluator.py on lines 730..731

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

              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 idx, _ in enumerate(coco_gt.dataset['annotations']):
                    coco_gt.dataset['annotations'][idx]['ignored_split'] = 0
              Severity: Major
              Found in official/legacy/detection/evaluation/coco_evaluator.py and 1 other location - About 1 hr to fix
              official/legacy/detection/evaluation/coco_evaluator.py on lines 576..577

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

              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 g['ignore'] or (g['area'] < a_rng[0] or g['area'] > a_rng[1]):
              Severity: Major
              Found in official/legacy/detection/evaluation/coco_evaluator.py and 1 other location - About 1 hr to fix
              official/legacy/detection/evaluation/coco_evaluator.py on lines 249..249

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

                  a = np.array([d['area'] < a_rng[0] or d['area'] > a_rng[1] for d in dt
              Severity: Major
              Found in official/legacy/detection/evaluation/coco_evaluator.py and 1 other location - About 1 hr to fix
              official/legacy/detection/evaluation/coco_evaluator.py on lines 185..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 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

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

                  for i, name in enumerate(self._metric_names):
                    metrics_dict[name] = metrics[i].astype(np.float32)
              Severity: Major
              Found in official/legacy/detection/evaluation/coco_evaluator.py and 3 other locations - About 1 hr to fix
              official/legacy/detection/evaluation/coco_evaluator.py on lines 416..417
              official/legacy/detection/evaluation/coco_evaluator.py on lines 672..673
              official/legacy/detection/evaluation/coco_evaluator.py on lines 761..762

              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

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

                  for i, name in enumerate(self._metric_names):
                    metrics_dict[name] = metrics[i].astype(np.float32)
              Severity: Major
              Found in official/legacy/detection/evaluation/coco_evaluator.py and 3 other locations - About 1 hr to fix
              official/legacy/detection/evaluation/coco_evaluator.py on lines 416..417
              official/legacy/detection/evaluation/coco_evaluator.py on lines 672..673
              official/legacy/detection/evaluation/coco_evaluator.py on lines 845..846

              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

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

                  for i, name in enumerate(self._metric_names):
                    metrics_dict[name] = metrics[i].astype(np.float32)
              Severity: Major
              Found in official/legacy/detection/evaluation/coco_evaluator.py and 3 other locations - About 1 hr to fix
              official/legacy/detection/evaluation/coco_evaluator.py on lines 416..417
              official/legacy/detection/evaluation/coco_evaluator.py on lines 761..762
              official/legacy/detection/evaluation/coco_evaluator.py on lines 845..846

              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

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

                  for i, name in enumerate(self._metric_names):
                    metrics_dict[name] = metrics[i].astype(np.float32)
              Severity: Major
              Found in official/legacy/detection/evaluation/coco_evaluator.py and 3 other locations - About 1 hr to fix
              official/legacy/detection/evaluation/coco_evaluator.py on lines 672..673
              official/legacy/detection/evaluation/coco_evaluator.py on lines 761..762
              official/legacy/detection/evaluation/coco_evaluator.py on lines 845..846

              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

                  image_scale = np.tile(predictions['image_info'][:, 2:3, :], (1, 1, 2))
              Severity: Minor
              Found in official/legacy/detection/evaluation/coco_evaluator.py and 1 other location - About 40 mins to fix
              official/vision/evaluation/wod_detection_evaluator.py on lines 113..113

              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

                def __init__(self, coco_gt, coco_dt, iou_type='box'):
                  super(OlnCOCOevalXclassWrapper, self).__init__(
              Severity: Minor
              Found in official/legacy/detection/evaluation/coco_evaluator.py and 1 other location - About 35 mins to fix
              official/legacy/detection/evaluation/coco_evaluator.py on lines 59..60

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

                def __init__(self, coco_gt, coco_dt, iou_type='box'):
                  super(OlnCOCOevalWrapper, self).__init__(
              Severity: Minor
              Found in official/legacy/detection/evaluation/coco_evaluator.py and 1 other location - About 35 mins to fix
              official/legacy/detection/evaluation/coco_evaluator.py on lines 166..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 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

              There are no issues that match your filters.

              Category
              Status