tensorflow/models

View on GitHub
official/vision/utils/object_detection/target_assigner.py

Summary

Maintainability
F
5 days
Test Coverage

File target_assigner.py has 435 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: Minor
Found in official/vision/utils/object_detection/target_assigner.py - About 6 hrs to fix

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

      def assign(self,
                 anchors,
                 groundtruth_boxes,
                 groundtruth_labels=None,
                 groundtruth_weights=None,
    Severity: Minor
    Found in official/vision/utils/object_detection/target_assigner.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 __init__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

      def __init__(self,
    Severity: Minor
    Found in official/vision/utils/object_detection/target_assigner.py - About 45 mins to fix

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

        def assign(self,
      Severity: Minor
      Found in official/vision/utils/object_detection/target_assigner.py - About 35 mins to fix

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

          def __init__(self,
        Severity: Minor
        Found in official/vision/utils/object_detection/target_assigner.py - About 35 mins to fix

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

            def assign(self,
          Severity: Minor
          Found in official/vision/utils/object_detection/target_assigner.py - About 35 mins to fix

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

              def assign(self,
                         anchors,
                         groundtruth_boxes,
                         groundtruth_labels=None,
                         groundtruth_weights=None,
            Severity: Minor
            Found in official/vision/utils/object_detection/target_assigner.py - About 35 mins to fix

            Cognitive Complexity

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

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

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

            Further reading

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

                if groundtruth_boxes.has_field(KEYPOINTS_FIELD_NAME):
                  groundtruth_keypoints = groundtruth_boxes.get_field(KEYPOINTS_FIELD_NAME)
                  matched_keypoints = match.gather_based_on_match(
                      groundtruth_keypoints,
                      unmatched_value=tf.zeros(groundtruth_keypoints.get_shape()[1:]),
            Severity: Major
            Found in official/vision/utils/object_detection/target_assigner.py and 1 other location - About 4 hrs to fix
            official/vision/utils/object_detection/target_assigner.py on lines 206..212

            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 groundtruth_boxes.has_field(KEYPOINTS_FIELD_NAME):
                  groundtruth_keypoints = groundtruth_boxes.get_field(KEYPOINTS_FIELD_NAME)
                  matched_keypoints = match.gather_based_on_match(
                      groundtruth_keypoints,
                      unmatched_value=tf.zeros(groundtruth_keypoints.get_shape()[1:]),
            Severity: Major
            Found in official/vision/utils/object_detection/target_assigner.py and 1 other location - About 4 hrs to fix
            official/vision/utils/object_detection/target_assigner.py on lines 500..506

            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 num_anchors is not None:
                  reg_targets = self._reset_target_shape(reg_targets, num_anchors)
                  cls_targets = self._reset_target_shape(cls_targets, num_anchors)
                  reg_weights = self._reset_target_shape(reg_weights, num_anchors)
                  cls_weights = self._reset_target_shape(cls_weights, num_anchors)
            Severity: Major
            Found in official/vision/utils/object_detection/target_assigner.py and 1 other location - About 2 hrs to fix
            official/vision/utils/object_detection/target_assigner.py on lines 166..170

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

            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_anchors is not None:
                  reg_targets = self._reset_target_shape(reg_targets, num_anchors)
                  cls_targets = self._reset_target_shape(cls_targets, num_anchors)
                  reg_weights = self._reset_target_shape(reg_weights, num_anchors)
                  cls_weights = self._reset_target_shape(cls_weights, num_anchors)
            Severity: Major
            Found in official/vision/utils/object_detection/target_assigner.py and 1 other location - About 2 hrs to fix
            official/vision/utils/object_detection/target_assigner.py on lines 469..473

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

            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 groundtruth_weights is None:
                  num_gt_boxes = groundtruth_boxes.num_boxes_static()
                  if not num_gt_boxes:
                    num_gt_boxes = groundtruth_boxes.num_boxes()
                  groundtruth_weights = tf.ones([num_gt_boxes], dtype=tf.float32)
            Severity: Major
            Found in official/vision/utils/object_detection/target_assigner.py and 1 other location - About 2 hrs to fix
            official/vision/utils/object_detection/target_assigner.py on lines 438..442

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

            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 groundtruth_weights is None:
                  num_gt_boxes = groundtruth_boxes.num_boxes_static()
                  if not num_gt_boxes:
                    num_gt_boxes = groundtruth_boxes.num_boxes()
                  groundtruth_weights = tf.ones([num_gt_boxes], dtype=tf.float32)
            Severity: Major
            Found in official/vision/utils/object_detection/target_assigner.py and 1 other location - About 2 hrs to fix
            official/vision/utils/object_detection/target_assigner.py on lines 147..151

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

            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 groundtruth_labels is None:
                  groundtruth_labels = tf.ones(
                      tf.expand_dims(groundtruth_boxes.num_boxes(), 0))
                  groundtruth_labels = tf.expand_dims(groundtruth_labels, -1)
            Severity: Major
            Found in official/vision/utils/object_detection/target_assigner.py and 1 other location - About 1 hr to fix
            official/vision/utils/object_detection/target_assigner.py on lines 134..137

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

            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 groundtruth_labels is None:
                  groundtruth_labels = tf.ones(
                      tf.expand_dims(groundtruth_boxes.num_boxes(), 0))
                  groundtruth_labels = tf.expand_dims(groundtruth_labels, -1)
            Severity: Major
            Found in official/vision/utils/object_detection/target_assigner.py and 1 other location - About 1 hr to fix
            official/vision/utils/object_detection/target_assigner.py on lines 425..428

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

            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

                labels_and_box_shapes_assert = shape_utils.assert_shape_equal(
                    shape_utils.combined_static_and_dynamic_shape(groundtruth_labels)[:1],
                    shape_utils.combined_static_and_dynamic_shape(
                        groundtruth_boxes.get())[:1])
            Severity: Major
            Found in official/vision/utils/object_detection/target_assigner.py and 1 other location - About 1 hr to fix
            official/vision/utils/object_detection/target_assigner.py on lines 142..145

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

                labels_and_box_shapes_assert = shape_utils.assert_shape_equal(
                    shape_utils.combined_static_and_dynamic_shape(groundtruth_labels)[:1],
                    shape_utils.combined_static_and_dynamic_shape(
                        groundtruth_boxes.get())[:1])
            Severity: Major
            Found in official/vision/utils/object_detection/target_assigner.py and 1 other location - About 1 hr to fix
            official/vision/utils/object_detection/target_assigner.py on lines 433..436

            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

              def _reset_target_shape(self, target, num_anchors):
                """Sets the static shape of the target.
            
                Args:
                  target: the target tensor. Its first dimension will be overwritten.
            Severity: Major
            Found in official/vision/utils/object_detection/target_assigner.py and 1 other location - About 1 hr to fix
            research/object_detection/utils/shape_utils.py on lines 43..56

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

                matched_gt_boxes = match.gather_based_on_match(
                    groundtruth_boxes.get(),
                    unmatched_value=tf.zeros(4),
                    ignored_value=tf.zeros(4))
            Severity: Major
            Found in official/vision/utils/object_detection/target_assigner.py and 2 other locations - About 40 mins to fix
            official/vision/utils/object_detection/target_assigner.py on lines 461..464
            official/vision/utils/object_detection/target_assigner.py on lines 495..498

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

                matched_anchors_mask_tiled = tf.tile(
                    tf.expand_dims(matched_anchors_mask, 1),
                    [1, tf.shape(matched_reg_targets)[1]])
            Severity: Major
            Found in official/vision/utils/object_detection/target_assigner.py and 2 other locations - About 40 mins to fix
            official/legacy/detection/dataloader/anchor.py on lines 417..418
            official/vision/utils/object_detection/target_assigner.py on lines 223..225

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

                    center_matched_gt_boxes = center_match.gather_based_on_match(
                        groundtruth_boxes.get(),
                        unmatched_value=tf.zeros(4),
                        ignored_value=tf.zeros(4))
            Severity: Major
            Found in official/vision/utils/object_detection/target_assigner.py and 2 other locations - About 40 mins to fix
            official/vision/utils/object_detection/target_assigner.py on lines 201..204
            official/vision/utils/object_detection/target_assigner.py on lines 495..498

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

                matched_gt_boxes = match.gather_based_on_match(
                    groundtruth_boxes.get(),
                    unmatched_value=tf.zeros(4),
                    ignored_value=tf.zeros(4))
            Severity: Major
            Found in official/vision/utils/object_detection/target_assigner.py and 2 other locations - About 40 mins to fix
            official/vision/utils/object_detection/target_assigner.py on lines 201..204
            official/vision/utils/object_detection/target_assigner.py on lines 461..464

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

                matched_anchors_mask = tf.tile(
                    tf.expand_dims(matched_anchors_mask, 1),
                    [1, tf.shape(matched_reg_targets)[1]])
            Severity: Major
            Found in official/vision/utils/object_detection/target_assigner.py and 2 other locations - About 40 mins to fix
            official/legacy/detection/dataloader/anchor.py on lines 417..418
            official/vision/utils/object_detection/target_assigner.py on lines 517..519

            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

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

                unmatched_shape_assert = shape_utils.assert_shape_equal(
                    shape_utils.combined_static_and_dynamic_shape(groundtruth_labels)[1:],
                    shape_utils.combined_static_and_dynamic_shape(
                        self._unmatched_cls_target))
            Severity: Minor
            Found in official/vision/utils/object_detection/target_assigner.py and 1 other location - About 30 mins to fix
            official/vision/utils/object_detection/target_assigner.py on lines 429..432

            Duplicated Code

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

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

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

            Tuning

            This issue has a mass of 32.

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

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

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

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

            Refactorings

            Further Reading

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

                unmatched_shape_assert = shape_utils.assert_shape_equal(
                    shape_utils.combined_static_and_dynamic_shape(groundtruth_labels)[1:],
                    shape_utils.combined_static_and_dynamic_shape(
                        self._unmatched_cls_target))
            Severity: Minor
            Found in official/vision/utils/object_detection/target_assigner.py and 1 other location - About 30 mins to fix
            official/vision/utils/object_detection/target_assigner.py on lines 138..141

            Duplicated Code

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

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

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

            Tuning

            This issue has a mass of 32.

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

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

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

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

            Refactorings

            Further Reading

            There are no issues that match your filters.

            Category
            Status