tensorflow/models

View on GitHub
research/object_detection/utils/autoaugment_utils.py

Summary

Maintainability
F
2 wks
Test Coverage

File autoaugment_utils.py has 1155 lines of code (exceeds 250 allowed). Consider refactoring.
Open

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

    Function random_shift_bbox has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    def random_shift_bbox(image, bbox, pixel_scaling, replace,
                          new_min_bbox_coords=None):
      """Move the bbox and the image content to a slightly new random location.
    
      Args:
    Severity: Minor
    Found in research/object_detection/utils/autoaugment_utils.py - About 1 hr to fix

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

        def mask_and_add_image(
      Severity: Major
      Found in research/object_detection/utils/autoaugment_utils.py - About 50 mins to fix

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

        def _apply_bbox_augmentation_wrapper(image, bbox, new_bboxes, prob,
        Severity: Major
        Found in research/object_detection/utils/autoaugment_utils.py - About 50 mins to fix

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

          def _apply_multi_bbox_augmentation(image, bboxes, prob, aug_func,
          Severity: Minor
          Found in research/object_detection/utils/autoaugment_utils.py - About 45 mins to fix

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

            def _apply_multi_bbox_augmentation_wrapper(image, bboxes, prob, aug_func,
            Severity: Minor
            Found in research/object_detection/utils/autoaugment_utils.py - About 45 mins to fix

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

              def _apply_func_with_prob(func, image, args, prob, bboxes):
              Severity: Minor
              Found in research/object_detection/utils/autoaugment_utils.py - About 35 mins to fix

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

                def translate_y_only_bboxes(image, bboxes, prob, pixels, replace):
                Severity: Minor
                Found in research/object_detection/utils/autoaugment_utils.py - About 35 mins to fix

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

                  def _shift_bbox(bbox, image_height, image_width, pixels, shift_horizontal):
                  Severity: Minor
                  Found in research/object_detection/utils/autoaugment_utils.py - About 35 mins to fix

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

                    def translate_bbox(image, bboxes, pixels, replace, shift_horizontal):
                    Severity: Minor
                    Found in research/object_detection/utils/autoaugment_utils.py - About 35 mins to fix

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

                      def _check_bbox_area(min_y, min_x, max_y, max_x, delta=0.05):
                      Severity: Minor
                      Found in research/object_detection/utils/autoaugment_utils.py - About 35 mins to fix

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

                        def shear_with_bboxes(image, bboxes, level, replace, shear_horizontal):
                        Severity: Minor
                        Found in research/object_detection/utils/autoaugment_utils.py - About 35 mins to fix

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

                          def shear_y_only_bboxes(image, bboxes, prob, level, replace):
                          Severity: Minor
                          Found in research/object_detection/utils/autoaugment_utils.py - About 35 mins to fix

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

                            def cutout_only_bboxes(image, bboxes, prob, pad_size, replace):
                            Severity: Minor
                            Found in research/object_detection/utils/autoaugment_utils.py - About 35 mins to fix

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

                              def translate_x_only_bboxes(image, bboxes, prob, pixels, replace):
                              Severity: Minor
                              Found in research/object_detection/utils/autoaugment_utils.py - About 35 mins to fix

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

                                def shear_x_only_bboxes(image, bboxes, prob, level, replace):
                                Severity: Minor
                                Found in research/object_detection/utils/autoaugment_utils.py - About 35 mins to fix

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

                                  def _parse_policy_info(name, prob, level, replace_value, augmentation_hparams):
                                  Severity: Minor
                                  Found in research/object_detection/utils/autoaugment_utils.py - About 35 mins to fix

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

                                    def _shear_bbox(bbox, image_height, image_width, level, shear_horizontal):
                                    Severity: Minor
                                    Found in research/object_detection/utils/autoaugment_utils.py - About 35 mins to fix

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

                                      def random_shift_bbox(image, bbox, pixel_scaling, replace,
                                      Severity: Minor
                                      Found in research/object_detection/utils/autoaugment_utils.py - About 35 mins to fix

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

                                        def rotate_only_bboxes(image, bboxes, prob, degrees, replace):
                                        Severity: Minor
                                        Found in research/object_detection/utils/autoaugment_utils.py - About 35 mins to fix

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

                                          def build_and_apply_nas_policy(policies, image, bboxes,
                                                                         augmentation_hparams):
                                            """Build a policy from the given policies passed in and apply to image.
                                          
                                            Args:
                                          Severity: Minor
                                          Found in research/object_detection/utils/autoaugment_utils.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

                                          def equalize(image):
                                            """Implements Equalize function from PIL using TF ops."""
                                            def scale_channel(im, c):
                                              """Scale the data in the channel to implement equalize."""
                                              im = tf.cast(im[:, :, c], tf.int32)
                                          Severity: Major
                                          Found in research/object_detection/utils/autoaugment_utils.py and 1 other location - About 2 days to fix
                                          official/projects/unified_detector/data_loaders/autoaugment.py on lines 332..370

                                          Duplicated Code

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

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

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

                                          Tuning

                                          This issue has a mass of 301.

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

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

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

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

                                          Refactorings

                                          Further Reading

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

                                          def contrast(image, factor):
                                            """Equivalent of PIL Contrast."""
                                            degenerate = tf.image.rgb_to_grayscale(image)
                                            # Cast before calling tf.histogram.
                                            degenerate = tf.cast(degenerate, tf.int32)
                                          Severity: Major
                                          Found in research/object_detection/utils/autoaugment_utils.py and 1 other location - About 1 day to fix
                                          official/projects/unified_detector/data_loaders/autoaugment.py on lines 196..210

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

                                          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 shear_with_bboxes(image, bboxes, level, replace, shear_horizontal):
                                            """Applies Shear Transformation to the image and shifts the bboxes.
                                          
                                            Args:
                                              image: 3D uint8 Tensor.
                                          Severity: Major
                                          Found in research/object_detection/utils/autoaugment_utils.py and 1 other location - About 7 hrs to fix
                                          research/object_detection/utils/autoaugment_utils.py on lines 932..963

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

                                          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 translate_bbox(image, bboxes, pixels, replace, shift_horizontal):
                                            """Equivalent of PIL Translate in X/Y dimension that shifts image and bbox.
                                          
                                            Args:
                                              image: 3D uint8 Tensor.
                                          Severity: Major
                                          Found in research/object_detection/utils/autoaugment_utils.py and 1 other location - About 7 hrs to fix
                                          research/object_detection/utils/autoaugment_utils.py on lines 1038..1070

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

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

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

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

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

                                          Refactorings

                                          Further Reading

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

                                          def solarize_add(image, addition=0, threshold=128):
                                            # For each pixel in the image less than threshold
                                            # we add 'addition' amount to it and then clip the
                                            # pixel value to be between 0 and 255. The value
                                            # of 'addition' is between -128 and 128.
                                          Severity: Major
                                          Found in research/object_detection/utils/autoaugment_utils.py and 1 other location - About 3 hrs to fix
                                          official/projects/unified_detector/data_loaders/autoaugment.py on lines 180..187

                                          Duplicated Code

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

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

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

                                          Tuning

                                          This issue has a mass of 70.

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

                                            policy = [
                                                [('TranslateX_BBox', 0.6, 4), ('Equalize', 0.8, 10)],
                                                [('TranslateY_Only_BBoxes', 0.2, 2), ('Cutout', 0.8, 8)],
                                                [('Sharpness', 0.0, 8), ('ShearX_BBox', 0.4, 0)],
                                                [('ShearY_BBox', 1.0, 2), ('TranslateY_Only_BBoxes', 0.6, 6)],
                                          Severity: Major
                                          Found in research/object_detection/utils/autoaugment_utils.py and 19 other locations - About 3 hrs to fix
                                          research/autoaugment/policies.py on lines 23..28
                                          research/autoaugment/policies.py on lines 29..34
                                          research/autoaugment/policies.py on lines 35..40
                                          research/autoaugment/policies.py on lines 41..46
                                          research/autoaugment/policies.py on lines 47..52
                                          research/autoaugment/policies.py on lines 53..58
                                          research/autoaugment/policies.py on lines 59..64
                                          research/autoaugment/policies.py on lines 65..70
                                          research/autoaugment/policies.py on lines 71..76
                                          research/autoaugment/policies.py on lines 77..82
                                          research/autoaugment/policies.py on lines 83..88
                                          research/autoaugment/policies.py on lines 89..94
                                          research/autoaugment/policies.py on lines 95..100
                                          research/autoaugment/policies.py on lines 101..106
                                          research/autoaugment/policies.py on lines 107..112
                                          research/autoaugment/policies.py on lines 113..118
                                          research/autoaugment/policies.py on lines 119..124
                                          research/autoaugment/policies.py on lines 125..130
                                          research/autoaugment/policies.py on lines 131..136

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

                                          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

                                            mask_tensor = tf.pad(mask_tensor,
                                                                 [[min_y, (image_height - 1) - max_y],
                                                                  [min_x, (image_width - 1) - max_x],
                                                                  [0, 0]],
                                          Severity: Major
                                          Found in research/object_detection/utils/autoaugment_utils.py and 2 other locations - About 2 hrs to fix
                                          research/object_detection/utils/autoaugment_utils.py on lines 421..424
                                          research/object_detection/utils/autoaugment_utils.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 53.

                                          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

                                              content_tensor = tf.pad(content_tensor,
                                                                      [[min_y_, (image_height - 1) - max_y_],
                                                                       [min_x_, (image_width - 1) - max_x_],
                                                                       [0, 0]], constant_values=0)
                                          Severity: Major
                                          Found in research/object_detection/utils/autoaugment_utils.py and 2 other locations - About 2 hrs to fix
                                          research/object_detection/utils/autoaugment_utils.py on lines 421..424
                                          research/object_detection/utils/autoaugment_utils.py on lines 558..561

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

                                          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

                                              mask = tf.pad(mask,
                                                            [[min_y_, (image_height - 1) - max_y_],
                                                             [min_x_, (image_width - 1) - max_x_],
                                                             [0, 0]], constant_values=1)
                                          Severity: Major
                                          Found in research/object_detection/utils/autoaugment_utils.py and 2 other locations - About 2 hrs to fix
                                          research/object_detection/utils/autoaugment_utils.py on lines 425..428
                                          research/object_detection/utils/autoaugment_utils.py on lines 558..561

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

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

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

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

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

                                          Refactorings

                                          Further Reading

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

                                          def _shrink_level_to_arg(level):
                                            """Converts level to ratio by which we shrink the image content."""
                                            if level == 0:
                                              return (1.0,)  # if level is zero, do not shrink the image
                                            # Maximum shrinking ratio is 2.9.
                                          Severity: Major
                                          Found in research/object_detection/utils/autoaugment_utils.py and 1 other location - About 2 hrs to fix
                                          official/projects/unified_detector/data_loaders/autoaugment.py on lines 419..425

                                          Duplicated Code

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

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

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

                                          Tuning

                                          This issue has a mass of 52.

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

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

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

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

                                          Refactorings

                                          Further Reading

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

                                            kernel = tf.constant(
                                                [[1, 1, 1], [1, 5, 1], [1, 1, 1]], dtype=tf.float32,
                                                shape=[3, 3, 1, 1]) / 13.
                                          Severity: Major
                                          Found in research/object_detection/utils/autoaugment_utils.py and 1 other location - About 1 hr to fix
                                          official/projects/unified_detector/data_loaders/autoaugment.py on lines 308..310

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

                                          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

                                            max_y = -(tf.to_float(tf.reduce_min(new_coords[0, :])) / image_height - 0.5)
                                          Severity: Major
                                          Found in research/object_detection/utils/autoaugment_utils.py and 1 other location - About 1 hr to fix
                                          research/object_detection/utils/autoaugment_utils.py on lines 837..837

                                          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

                                            min_y = -(tf.to_float(tf.reduce_max(new_coords[0, :])) / image_height - 0.5)
                                          Severity: Major
                                          Found in research/object_detection/utils/autoaugment_utils.py and 1 other location - About 1 hr to fix
                                          research/object_detection/utils/autoaugment_utils.py on lines 839..839

                                          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

                                          def posterize(image, bits):
                                            """Equivalent of PIL Posterize."""
                                            shift = 8 - bits
                                            return tf.bitwise.left_shift(tf.bitwise.right_shift(image, shift), shift)
                                          Severity: Major
                                          Found in research/object_detection/utils/autoaugment_utils.py and 1 other location - About 1 hr to fix
                                          official/projects/unified_detector/data_loaders/autoaugment.py on lines 219..222

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

                                          def translate_x_only_bboxes(image, bboxes, prob, pixels, replace):
                                            """Apply translate_x to each bbox in the image with probability prob."""
                                            func_changes_bbox = False
                                            prob = _scale_bbox_only_op_probability(prob)
                                            return _apply_multi_bbox_augmentation_wrapper(
                                          Severity: Major
                                          Found in research/object_detection/utils/autoaugment_utils.py and 5 other locations - About 1 hr to fix
                                          research/object_detection/utils/autoaugment_utils.py on lines 723..728
                                          research/object_detection/utils/autoaugment_utils.py on lines 731..736
                                          research/object_detection/utils/autoaugment_utils.py on lines 739..744
                                          research/object_detection/utils/autoaugment_utils.py on lines 755..760
                                          research/object_detection/utils/autoaugment_utils.py on lines 787..792

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

                                          def cutout_only_bboxes(image, bboxes, prob, pad_size, replace):
                                            """Apply cutout to each bbox in the image with probability prob."""
                                            func_changes_bbox = False
                                            prob = _scale_bbox_only_op_probability(prob)
                                            return _apply_multi_bbox_augmentation_wrapper(
                                          Severity: Major
                                          Found in research/object_detection/utils/autoaugment_utils.py and 5 other locations - About 1 hr to fix
                                          research/object_detection/utils/autoaugment_utils.py on lines 723..728
                                          research/object_detection/utils/autoaugment_utils.py on lines 731..736
                                          research/object_detection/utils/autoaugment_utils.py on lines 739..744
                                          research/object_detection/utils/autoaugment_utils.py on lines 747..752
                                          research/object_detection/utils/autoaugment_utils.py on lines 755..760

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

                                          def translate_y_only_bboxes(image, bboxes, prob, pixels, replace):
                                            """Apply translate_y to each bbox in the image with probability prob."""
                                            func_changes_bbox = False
                                            prob = _scale_bbox_only_op_probability(prob)
                                            return _apply_multi_bbox_augmentation_wrapper(
                                          Severity: Major
                                          Found in research/object_detection/utils/autoaugment_utils.py and 5 other locations - About 1 hr to fix
                                          research/object_detection/utils/autoaugment_utils.py on lines 723..728
                                          research/object_detection/utils/autoaugment_utils.py on lines 731..736
                                          research/object_detection/utils/autoaugment_utils.py on lines 739..744
                                          research/object_detection/utils/autoaugment_utils.py on lines 747..752
                                          research/object_detection/utils/autoaugment_utils.py on lines 787..792

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

                                          def rotate_only_bboxes(image, bboxes, prob, degrees, replace):
                                            """Apply rotate to each bbox in the image with probability prob."""
                                            func_changes_bbox = False
                                            prob = _scale_bbox_only_op_probability(prob)
                                            return _apply_multi_bbox_augmentation_wrapper(
                                          Severity: Major
                                          Found in research/object_detection/utils/autoaugment_utils.py and 5 other locations - About 1 hr to fix
                                          research/object_detection/utils/autoaugment_utils.py on lines 731..736
                                          research/object_detection/utils/autoaugment_utils.py on lines 739..744
                                          research/object_detection/utils/autoaugment_utils.py on lines 747..752
                                          research/object_detection/utils/autoaugment_utils.py on lines 755..760
                                          research/object_detection/utils/autoaugment_utils.py on lines 787..792

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

                                          def shear_x_only_bboxes(image, bboxes, prob, level, replace):
                                            """Apply shear_x to each bbox in the image with probability prob."""
                                            func_changes_bbox = False
                                            prob = _scale_bbox_only_op_probability(prob)
                                            return _apply_multi_bbox_augmentation_wrapper(
                                          Severity: Major
                                          Found in research/object_detection/utils/autoaugment_utils.py and 5 other locations - About 1 hr to fix
                                          research/object_detection/utils/autoaugment_utils.py on lines 723..728
                                          research/object_detection/utils/autoaugment_utils.py on lines 739..744
                                          research/object_detection/utils/autoaugment_utils.py on lines 747..752
                                          research/object_detection/utils/autoaugment_utils.py on lines 755..760
                                          research/object_detection/utils/autoaugment_utils.py on lines 787..792

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

                                          def shear_y_only_bboxes(image, bboxes, prob, level, replace):
                                            """Apply shear_y to each bbox in the image with probability prob."""
                                            func_changes_bbox = False
                                            prob = _scale_bbox_only_op_probability(prob)
                                            return _apply_multi_bbox_augmentation_wrapper(
                                          Severity: Major
                                          Found in research/object_detection/utils/autoaugment_utils.py and 5 other locations - About 1 hr to fix
                                          research/object_detection/utils/autoaugment_utils.py on lines 723..728
                                          research/object_detection/utils/autoaugment_utils.py on lines 731..736
                                          research/object_detection/utils/autoaugment_utils.py on lines 747..752
                                          research/object_detection/utils/autoaugment_utils.py on lines 755..760
                                          research/object_detection/utils/autoaugment_utils.py on lines 787..792

                                          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

                                          def color(image, factor):
                                            """Equivalent of PIL Color."""
                                            degenerate = tf.image.grayscale_to_rgb(tf.image.rgb_to_grayscale(image))
                                            return blend(degenerate, image, factor)
                                          Severity: Major
                                          Found in research/object_detection/utils/autoaugment_utils.py and 1 other location - About 1 hr to fix
                                          official/projects/unified_detector/data_loaders/autoaugment.py on lines 190..193

                                          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

                                            maxval_x = clip_x(
                                                min_x + tf.to_int32(pixel_scaling * tf.to_float(bbox_width) / 2.0))
                                          Severity: Major
                                          Found in research/object_detection/utils/autoaugment_utils.py and 1 other location - About 1 hr to fix
                                          research/object_detection/utils/autoaugment_utils.py on lines 374..375

                                          Duplicated Code

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

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

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

                                          Tuning

                                          This issue has a mass of 39.

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

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

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

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

                                          Refactorings

                                          Further Reading

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

                                            minval_y = clip_y(
                                                min_y - tf.to_int32(pixel_scaling * tf.to_float(bbox_height) / 2.0))
                                          Severity: Major
                                          Found in research/object_detection/utils/autoaugment_utils.py and 1 other location - About 1 hr to fix
                                          research/object_detection/utils/autoaugment_utils.py on lines 376..377

                                          Duplicated Code

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

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

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

                                          Tuning

                                          This issue has a mass of 39.

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

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

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

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

                                          Refactorings

                                          Further Reading

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

                                            min_y, max_y = tf.cond(tf.equal(height, 0.0),
                                                                   lambda: _adjust_bbox_boundaries(min_y, max_y),
                                                                   lambda: (min_y, max_y))
                                          Severity: Major
                                          Found in research/object_detection/utils/autoaugment_utils.py and 1 other location - About 1 hr to fix
                                          research/object_detection/utils/autoaugment_utils.py on lines 490..492

                                          Duplicated Code

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

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

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

                                          Tuning

                                          This issue has a mass of 39.

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

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

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

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

                                          Refactorings

                                          Further Reading

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

                                            maxval_y = clip_y(
                                                min_y + tf.to_int32(pixel_scaling * tf.to_float(bbox_height) / 2.0))
                                          Severity: Major
                                          Found in research/object_detection/utils/autoaugment_utils.py and 1 other location - About 1 hr to fix
                                          research/object_detection/utils/autoaugment_utils.py on lines 378..379

                                          Duplicated Code

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

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

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

                                          Tuning

                                          This issue has a mass of 39.

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

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

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

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

                                          Refactorings

                                          Further Reading

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

                                            min_x, max_x = tf.cond(tf.equal(width, 0.0),
                                                                   lambda: _adjust_bbox_boundaries(min_x, max_x),
                                                                   lambda: (min_x, max_x))
                                          Severity: Major
                                          Found in research/object_detection/utils/autoaugment_utils.py and 1 other location - About 1 hr to fix
                                          research/object_detection/utils/autoaugment_utils.py on lines 487..489

                                          Duplicated Code

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

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

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

                                          Tuning

                                          This issue has a mass of 39.

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

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

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

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

                                          Refactorings

                                          Further Reading

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

                                            minval_x = clip_x(
                                                min_x - tf.to_int32(pixel_scaling * tf.to_float(bbox_width) / 2.0))
                                          Severity: Major
                                          Found in research/object_detection/utils/autoaugment_utils.py and 1 other location - About 1 hr to fix
                                          research/object_detection/utils/autoaugment_utils.py on lines 372..373

                                          Duplicated Code

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

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

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

                                          Tuning

                                          This issue has a mass of 39.

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

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

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

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

                                          Refactorings

                                          Further Reading

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

                                            should_apply_op = tf.cast(
                                                tf.floor(tf.random_uniform([], dtype=tf.float32) + prob), tf.bool)
                                          Severity: Major
                                          Found in research/object_detection/utils/autoaugment_utils.py and 1 other location - About 1 hr to fix
                                          research/object_detection/utils/autoaugment_utils.py on lines 1538..1539

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

                                          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

                                            should_apply_op = tf.cast(
                                                tf.floor(tf.random_uniform([], dtype=tf.float32) + prob), tf.bool)
                                          Severity: Major
                                          Found in research/object_detection/utils/autoaugment_utils.py and 1 other location - About 1 hr to fix
                                          research/object_detection/utils/autoaugment_utils.py on lines 611..612

                                          Duplicated Code

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

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

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

                                          Tuning

                                          This issue has a mass of 38.

                                          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 = tf.where(
                                                tf.equal(mask, 0),
                                                tf.ones_like(image, dtype=image.dtype) * replace,
                                                image)
                                          Severity: Major
                                          Found in research/object_detection/utils/autoaugment_utils.py and 1 other location - About 1 hr to fix
                                          research/object_detection/utils/autoaugment_utils.py on lines 1217..1220

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

                                          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

                                            min_x = tf.to_float(tf.reduce_min(new_coords[1, :])) / image_width + 0.5
                                          Severity: Major
                                          Found in research/object_detection/utils/autoaugment_utils.py and 1 other location - About 1 hr to fix
                                          research/object_detection/utils/autoaugment_utils.py on lines 840..840

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

                                          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

                                            max_x = tf.to_float(tf.reduce_max(new_coords[1, :])) / image_width + 0.5
                                          Severity: Major
                                          Found in research/object_detection/utils/autoaugment_utils.py and 1 other location - About 1 hr to fix
                                          research/object_detection/utils/autoaugment_utils.py on lines 838..838

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

                                          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

                                            flattened_image = tf.where(
                                                tf.equal(alpha_channel, 0),
                                                tf.ones_like(flattened_image, dtype=image.dtype) * replace,
                                                flattened_image)
                                          Severity: Major
                                          Found in research/object_detection/utils/autoaugment_utils.py and 1 other location - About 1 hr to fix
                                          research/object_detection/utils/autoaugment_utils.py on lines 246..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 38.

                                          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

                                          def _shear_level_to_arg(level):
                                            level = (level/_MAX_LEVEL) * 0.3
                                            # Flip level to negative with 50% chance.
                                            level = _randomly_negate_tensor(level)
                                            return (level,)
                                          Severity: Major
                                          Found in research/object_detection/utils/autoaugment_utils.py and 3 other locations - About 55 mins to fix
                                          official/projects/unified_detector/data_loaders/autoaugment.py on lines 413..416
                                          official/projects/unified_detector/data_loaders/autoaugment.py on lines 438..442
                                          research/object_detection/utils/autoaugment_utils.py on lines 1401..1404

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

                                          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

                                              for policy_info in policy:
                                                policy_info = list(policy_info) + [replace_value, augmentation_hparams]
                                          
                                                tf_policy.append(_parse_policy_info(*policy_info))
                                          Severity: Minor
                                          Found in research/object_detection/utils/autoaugment_utils.py and 1 other location - About 55 mins to fix
                                          official/projects/unified_detector/data_loaders/autoaugment.py on lines 600..603

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

                                          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

                                          def _rotate_level_to_arg(level):
                                            level = (level/_MAX_LEVEL) * 30.
                                            level = _randomly_negate_tensor(level)
                                            return (level,)
                                          Severity: Major
                                          Found in research/object_detection/utils/autoaugment_utils.py and 3 other locations - About 55 mins to fix
                                          official/projects/unified_detector/data_loaders/autoaugment.py on lines 413..416
                                          official/projects/unified_detector/data_loaders/autoaugment.py on lines 438..442
                                          research/object_detection/utils/autoaugment_utils.py on lines 1420..1424

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

                                          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 func_changes_bbox:
                                              augmented_image, bbox = tf.cond(
                                                  should_apply_op,
                                                  lambda: augmentation_func(image, bbox, *args),
                                                  lambda: (image, bbox))
                                          Severity: Minor
                                          Found in research/object_detection/utils/autoaugment_utils.py and 1 other location - About 40 mins to fix
                                          research/object_detection/utils/autoaugment_utils.py on lines 1540..1543

                                          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

                                            augmented_image, augmented_bboxes = tf.cond(
                                                should_apply_op,
                                                lambda: func(image, bboxes, *args),
                                                lambda: (image, bboxes))
                                          Severity: Minor
                                          Found in research/object_detection/utils/autoaugment_utils.py and 1 other location - About 40 mins to fix
                                          research/object_detection/utils/autoaugment_utils.py on lines 613..617

                                          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

                                            min_y = -tf.to_int32(image_height * (bbox[0] - 0.5))
                                          Severity: Minor
                                          Found in research/object_detection/utils/autoaugment_utils.py and 1 other location - About 35 mins to fix
                                          research/object_detection/utils/autoaugment_utils.py on lines 824..824

                                          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

                                            bbox_content = image[shifted_min_y:shifted_max_y + 1,
                                                                 shifted_min_x:shifted_max_x + 1, :]
                                          Severity: Minor
                                          Found in research/object_detection/utils/autoaugment_utils.py and 1 other location - About 35 mins to fix
                                          research/object_detection/utils/autoaugment_utils.py on lines 543..543

                                          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

                                            max_y = -tf.to_int32(image_height * (bbox[2] - 0.5))
                                          Severity: Minor
                                          Found in research/object_detection/utils/autoaugment_utils.py and 1 other location - About 35 mins to fix
                                          research/object_detection/utils/autoaugment_utils.py on lines 822..822

                                          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

                                            bbox_content = image[min_y:max_y + 1, min_x:max_x + 1, :]
                                          Severity: Minor
                                          Found in research/object_detection/utils/autoaugment_utils.py and 1 other location - About 35 mins to fix
                                          research/object_detection/utils/autoaugment_utils.py on lines 415..416

                                          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

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

                                            cutout_shape = [image_height - (lower_pad + upper_pad),
                                                            image_width - (left_pad + right_pad)]
                                          Severity: Minor
                                          Found in research/object_detection/utils/autoaugment_utils.py and 1 other location - About 30 mins to fix
                                          research/object_detection/utils/autoaugment_utils.py on lines 238..239

                                          Duplicated Code

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

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

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

                                          Tuning

                                          This issue has a mass of 32.

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

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

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

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

                                          Refactorings

                                          Further Reading

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

                                            min_y = tf.to_float(tf.reduce_min(new_coords[0, :])) / image_height
                                          Severity: Major
                                          Found in research/object_detection/utils/autoaugment_utils.py and 3 other locations - About 30 mins to fix
                                          research/object_detection/utils/autoaugment_utils.py on lines 1028..1028
                                          research/object_detection/utils/autoaugment_utils.py on lines 1029..1029
                                          research/object_detection/utils/autoaugment_utils.py on lines 1030..1030

                                          Duplicated Code

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

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

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

                                          Tuning

                                          This issue has a mass of 32.

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

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

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

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

                                          Refactorings

                                          Further Reading

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

                                            min_x = tf.to_float(tf.reduce_min(new_coords[1, :])) / image_width
                                          Severity: Major
                                          Found in research/object_detection/utils/autoaugment_utils.py and 3 other locations - About 30 mins to fix
                                          research/object_detection/utils/autoaugment_utils.py on lines 1027..1027
                                          research/object_detection/utils/autoaugment_utils.py on lines 1029..1029
                                          research/object_detection/utils/autoaugment_utils.py on lines 1030..1030

                                          Duplicated Code

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

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

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

                                          Tuning

                                          This issue has a mass of 32.

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

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

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

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

                                          Refactorings

                                          Further Reading

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

                                            max_x = tf.to_float(tf.reduce_max(new_coords[1, :])) / image_width
                                          Severity: Major
                                          Found in research/object_detection/utils/autoaugment_utils.py and 3 other locations - About 30 mins to fix
                                          research/object_detection/utils/autoaugment_utils.py on lines 1027..1027
                                          research/object_detection/utils/autoaugment_utils.py on lines 1028..1028
                                          research/object_detection/utils/autoaugment_utils.py on lines 1029..1029

                                          Duplicated Code

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

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

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

                                          Tuning

                                          This issue has a mass of 32.

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

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

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

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

                                          Refactorings

                                          Further Reading

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

                                            max_y = tf.to_float(tf.reduce_max(new_coords[0, :])) / image_height
                                          Severity: Major
                                          Found in research/object_detection/utils/autoaugment_utils.py and 3 other locations - About 30 mins to fix
                                          research/object_detection/utils/autoaugment_utils.py on lines 1027..1027
                                          research/object_detection/utils/autoaugment_utils.py on lines 1028..1028
                                          research/object_detection/utils/autoaugment_utils.py on lines 1030..1030

                                          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

                                            cutout_shape = [image_height - (lower_pad + upper_pad),
                                                            image_width - (left_pad + right_pad)]
                                          Severity: Minor
                                          Found in research/object_detection/utils/autoaugment_utils.py and 1 other location - About 30 mins to fix
                                          research/object_detection/utils/autoaugment_utils.py on lines 1289..1290

                                          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

                                          def solarize(image, threshold=128):
                                            # For each pixel in the image, select the pixel
                                            # if the value is less than the threshold.
                                            # Otherwise, subtract 255 from the pixel.
                                            return tf.where(image < threshold, image, 255 - image)
                                          Severity: Minor
                                          Found in research/object_detection/utils/autoaugment_utils.py and 1 other location - About 30 mins to fix
                                          official/projects/unified_detector/data_loaders/autoaugment.py on lines 173..177

                                          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