tensorflow/models

View on GitHub
research/object_detection/core/preprocessor.py

Summary

Maintainability
F
1 mo
Test Coverage

File preprocessor.py has 4060 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/core/preprocessor.py - About 1 wk to fix

    Function preprocess has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
    Open

    def preprocess(tensor_dict,
                   preprocess_options,
                   func_arg_map=None,
                   preprocess_vars_cache=None):
      """Preprocess images and bounding boxes.
    Severity: Minor
    Found in research/object_detection/core/preprocessor.py - About 4 hrs to fix

    Cognitive Complexity

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

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

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

    Further reading

    Function _strict_random_crop_image has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
    Open

    def _strict_random_crop_image(image,
                                  boxes,
                                  labels,
                                  label_weights,
                                  label_confidences=None,
    Severity: Minor
    Found in research/object_detection/core/preprocessor.py - About 3 hrs to fix

    Cognitive Complexity

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

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

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

    Further reading

    Function random_crop_image has 21 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def random_crop_image(image,
    Severity: Major
    Found in research/object_detection/core/preprocessor.py - About 2 hrs to fix

      Function random_crop_image has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

      def random_crop_image(image,
                            boxes,
                            labels,
                            label_weights,
                            label_confidences=None,
      Severity: Minor
      Found in research/object_detection/core/preprocessor.py - About 2 hrs to fix

      Cognitive Complexity

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

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

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

      Further reading

      Function ssd_random_crop_pad_fixed_aspect_ratio has 19 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def ssd_random_crop_pad_fixed_aspect_ratio(
      Severity: Major
      Found in research/object_detection/core/preprocessor.py - About 2 hrs to fix

        Function _strict_random_crop_image has 19 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        def _strict_random_crop_image(image,
        Severity: Major
        Found in research/object_detection/core/preprocessor.py - About 2 hrs to fix

          Function random_crop_pad_image has 17 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          def random_crop_pad_image(image,
          Severity: Major
          Found in research/object_detection/core/preprocessor.py - About 2 hrs to fix

            Function ssd_random_crop_pad has 17 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            def ssd_random_crop_pad(image,
            Severity: Major
            Found in research/object_detection/core/preprocessor.py - About 2 hrs to fix

              Function ssd_random_crop_fixed_aspect_ratio has 16 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              def ssd_random_crop_fixed_aspect_ratio(
              Severity: Major
              Found in research/object_detection/core/preprocessor.py - About 2 hrs to fix

                Function ssd_random_crop has 16 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                def ssd_random_crop(image,
                Severity: Major
                Found in research/object_detection/core/preprocessor.py - About 2 hrs to fix

                  Function random_crop_to_aspect_ratio has 14 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                  def random_crop_to_aspect_ratio(image,
                  Severity: Major
                  Found in research/object_detection/core/preprocessor.py - About 1 hr to fix

                    Function random_horizontal_flip has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def random_horizontal_flip(image,
                                               boxes=None,
                                               masks=None,
                                               keypoints=None,
                                               keypoint_visibilities=None,
                    Severity: Minor
                    Found in research/object_detection/core/preprocessor.py - About 1 hr to fix

                    Cognitive Complexity

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

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

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

                    Further reading

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

                    def random_horizontal_flip(image,
                    Severity: Major
                    Found in research/object_detection/core/preprocessor.py - About 1 hr to fix

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

                      def random_square_crop_by_scale(image, boxes, labels, label_weights,
                      Severity: Major
                      Found in research/object_detection/core/preprocessor.py - About 1 hr to fix

                        Function random_square_crop_by_scale has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        def random_square_crop_by_scale(image, boxes, labels, label_weights,
                                                        label_confidences=None, masks=None,
                                                        keypoints=None, max_border=128, scale_min=0.6,
                                                        scale_max=1.3, num_scales=8, seed=None,
                                                        preprocess_vars_cache=None):
                        Severity: Minor
                        Found in research/object_detection/core/preprocessor.py - About 1 hr to fix

                          Function random_scale_crop_and_pad_to_square has 12 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                          def random_scale_crop_and_pad_to_square(
                          Severity: Major
                          Found in research/object_detection/core/preprocessor.py - About 1 hr to fix

                            Function random_crop_to_aspect_ratio has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                            Open

                            def random_crop_to_aspect_ratio(image,
                                                            boxes,
                                                            labels,
                                                            label_weights,
                                                            label_confidences=None,
                            Severity: Minor
                            Found in research/object_detection/core/preprocessor.py - About 1 hr to fix

                            Cognitive Complexity

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

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

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

                            Further reading

                            Function resize_to_range has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                            Open

                            def resize_to_range(image,
                                                masks=None,
                                                min_dimension=None,
                                                max_dimension=None,
                                                method=tf.image.ResizeMethod.BILINEAR,
                            Severity: Minor
                            Found in research/object_detection/core/preprocessor.py - About 1 hr to fix

                            Cognitive Complexity

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

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

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

                            Further reading

                            Function random_pad_image has 11 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                            def random_pad_image(image,
                            Severity: Major
                            Found in research/object_detection/core/preprocessor.py - About 1 hr to fix

                              Function random_pad_image has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              def random_pad_image(image,
                                                   boxes,
                                                   masks=None,
                                                   keypoints=None,
                                                   densepose_surface_coords=None,
                              Severity: Minor
                              Found in research/object_detection/core/preprocessor.py - About 1 hr to fix

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

                                def drop_label_probabilistically(boxes,
                                Severity: Major
                                Found in research/object_detection/core/preprocessor.py - About 1 hr to fix

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

                                  def random_self_concat_image(
                                  Severity: Major
                                  Found in research/object_detection/core/preprocessor.py - About 1 hr to fix

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

                                    def random_absolute_pad_image(image,
                                    Severity: Major
                                    Found in research/object_detection/core/preprocessor.py - About 1 hr to fix

                                      Function random_scale_crop_and_pad_to_square has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                      def random_scale_crop_and_pad_to_square(
                                          image,
                                          boxes,
                                          labels,
                                          label_weights,
                                      Severity: Minor
                                      Found in research/object_detection/core/preprocessor.py - About 1 hr to fix

                                        Function get_default_func_arg_map has 9 arguments (exceeds 4 allowed). Consider refactoring.
                                        Open

                                        def get_default_func_arg_map(include_label_weights=True,
                                        Severity: Major
                                        Found in research/object_detection/core/preprocessor.py - About 1 hr to fix

                                          Function random_pad_to_aspect_ratio has 9 arguments (exceeds 4 allowed). Consider refactoring.
                                          Open

                                          def random_pad_to_aspect_ratio(image,
                                          Severity: Major
                                          Found in research/object_detection/core/preprocessor.py - About 1 hr to fix

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

                                            def ssd_random_crop(image,
                                                                boxes,
                                                                labels,
                                                                label_weights,
                                                                label_confidences=None,
                                            Severity: Minor
                                            Found in research/object_detection/core/preprocessor.py - About 1 hr to fix

                                            Cognitive Complexity

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

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

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

                                            Further reading

                                            Function random_patch_gaussian has 8 arguments (exceeds 4 allowed). Consider refactoring.
                                            Open

                                            def random_patch_gaussian(image,
                                            Severity: Major
                                            Found in research/object_detection/core/preprocessor.py - About 1 hr to fix

                                              Function retain_boxes_above_threshold has 8 arguments (exceeds 4 allowed). Consider refactoring.
                                              Open

                                              def retain_boxes_above_threshold(boxes,
                                              Severity: Major
                                              Found in research/object_detection/core/preprocessor.py - About 1 hr to fix

                                                Function random_rotation90 has 8 arguments (exceeds 4 allowed). Consider refactoring.
                                                Open

                                                def random_rotation90(image,
                                                Severity: Major
                                                Found in research/object_detection/core/preprocessor.py - About 1 hr to fix

                                                  Function resize_to_range has 8 arguments (exceeds 4 allowed). Consider refactoring.
                                                  Open

                                                  def resize_to_range(image,
                                                  Severity: Major
                                                  Found in research/object_detection/core/preprocessor.py - About 1 hr to fix

                                                    Function random_vertical_flip has 8 arguments (exceeds 4 allowed). Consider refactoring.
                                                    Open

                                                    def random_vertical_flip(image,
                                                    Severity: Major
                                                    Found in research/object_detection/core/preprocessor.py - About 1 hr to fix

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

                                                      def random_jitter_boxes(boxes, ratio=0.05, jitter_mode='default', seed=None):
                                                        """Randomly jitters boxes in image.
                                                      
                                                        Args:
                                                          boxes: rank 2 float32 tensor containing the bounding boxes -> [N, 4].
                                                      Severity: Minor
                                                      Found in research/object_detection/core/preprocessor.py - About 55 mins to fix

                                                      Cognitive Complexity

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

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

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

                                                      Further reading

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

                                                      def get_default_func_arg_map(include_label_weights=True,
                                                                                   include_label_confidences=False,
                                                                                   include_multiclass_scores=False,
                                                                                   include_instance_masks=False,
                                                                                   include_instance_mask_weights=False,
                                                      Severity: Minor
                                                      Found in research/object_detection/core/preprocessor.py - About 55 mins to fix

                                                      Cognitive Complexity

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

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

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

                                                      Further reading

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

                                                      def random_downscale_to_target_pixels(image,
                                                      Severity: Major
                                                      Found in research/object_detection/core/preprocessor.py - About 50 mins to fix

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

                                                        def random_jpeg_quality(image,
                                                        Severity: Minor
                                                        Found in research/object_detection/core/preprocessor.py - About 45 mins to fix

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

                                                          def random_image_scale(image,
                                                          Severity: Minor
                                                          Found in research/object_detection/core/preprocessor.py - About 45 mins to fix

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

                                                            def random_black_patches(image,
                                                            Severity: Minor
                                                            Found in research/object_detection/core/preprocessor.py - About 45 mins to fix

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

                                                              def resize_image(image,
                                                              Severity: Minor
                                                              Found in research/object_detection/core/preprocessor.py - About 45 mins to fix

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

                                                                def ssd_random_crop_pad_fixed_aspect_ratio(
                                                                    image,
                                                                    boxes,
                                                                    labels,
                                                                    label_weights,
                                                                Severity: Minor
                                                                Found in research/object_detection/core/preprocessor.py - About 45 mins to fix

                                                                Cognitive Complexity

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

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

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

                                                                Further reading

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

                                                                def _apply_with_random_selector(x,
                                                                Severity: Minor
                                                                Found in research/object_detection/core/preprocessor.py - About 35 mins to fix

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

                                                                  def random_adjust_saturation(image,
                                                                  Severity: Minor
                                                                  Found in research/object_detection/core/preprocessor.py - About 35 mins to fix

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

                                                                      def _concat_image(image, boxes, labels, label_weights, axis):
                                                                    Severity: Minor
                                                                    Found in research/object_detection/core/preprocessor.py - About 35 mins to fix

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

                                                                      def normalize_image(image, original_minval, original_maxval, target_minval,
                                                                      Severity: Minor
                                                                      Found in research/object_detection/core/preprocessor.py - About 35 mins to fix

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

                                                                        def random_adjust_contrast(image,
                                                                        Severity: Minor
                                                                        Found in research/object_detection/core/preprocessor.py - About 35 mins to fix

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

                                                                          def random_pixel_value_scale(image,
                                                                          Severity: Minor
                                                                          Found in research/object_detection/core/preprocessor.py - About 35 mins to fix

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

                                                                            def _apply_with_random_selector_tuples(x,
                                                                            Severity: Minor
                                                                            Found in research/object_detection/core/preprocessor.py - About 35 mins to fix

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

                                                                              def random_square_crop_by_scale(image, boxes, labels, label_weights,
                                                                                                              label_confidences=None, masks=None,
                                                                                                              keypoints=None, max_border=128, scale_min=0.6,
                                                                                                              scale_max=1.3, num_scales=8, seed=None,
                                                                                                              preprocess_vars_cache=None):
                                                                              Severity: Minor
                                                                              Found in research/object_detection/core/preprocessor.py - About 35 mins to fix

                                                                              Cognitive Complexity

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

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

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

                                                                              Further reading

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

                                                                              def random_pad_image(image,
                                                                                                   boxes,
                                                                                                   masks=None,
                                                                                                   keypoints=None,
                                                                                                   densepose_surface_coords=None,
                                                                              Severity: Minor
                                                                              Found in research/object_detection/core/preprocessor.py - About 35 mins to fix

                                                                              Cognitive Complexity

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

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

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

                                                                              Further reading

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

                                                                              def ssd_random_crop_pad(image,
                                                                                                      boxes,
                                                                                                      labels,
                                                                                                      label_weights,
                                                                                                      label_confidences=None,
                                                                              Severity: Minor
                                                                              Found in research/object_detection/core/preprocessor.py - About 25 mins to fix

                                                                              Cognitive Complexity

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

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

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

                                                                              Further reading

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

                                                                              def random_self_concat_image(
                                                                                  image, boxes, labels, label_weights, label_confidences=None,
                                                                                  multiclass_scores=None, concat_vertical_probability=0.1,
                                                                                  concat_horizontal_probability=0.1, seed=None,
                                                                                  preprocess_vars_cache=None):
                                                                              Severity: Minor
                                                                              Found in research/object_detection/core/preprocessor.py - About 25 mins to fix

                                                                              Cognitive Complexity

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

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

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

                                                                              Further reading

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

                                                                              def resize_to_min_dimension(image, masks=None, min_dimension=600,
                                                                                                          method=tf.image.ResizeMethod.BILINEAR):
                                                                                """Resizes image and masks given the min size maintaining the aspect ratio.
                                                                              
                                                                                If one of the image dimensions is smaller than min_dimension, it will scale
                                                                              Severity: Major
                                                                              Found in research/object_detection/core/preprocessor.py and 1 other location - About 3 days to fix
                                                                              research/object_detection/core/preprocessor.py on lines 3164..3219

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

                                                                              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 resize_to_max_dimension(image, masks=None, max_dimension=600,
                                                                                                          method=tf.image.ResizeMethod.BILINEAR):
                                                                                """Resizes image and masks given the max size maintaining the aspect ratio.
                                                                              
                                                                                If one of the image dimensions is greater than max_dimension, it will scale
                                                                              Severity: Major
                                                                              Found in research/object_detection/core/preprocessor.py and 1 other location - About 3 days to fix
                                                                              research/object_detection/core/preprocessor.py on lines 3106..3161

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

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

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

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

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

                                                                              Refactorings

                                                                              Further Reading

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

                                                                                  if image.get_shape().is_fully_defined():
                                                                                    if image.get_shape()[0] < image.get_shape()[1]:
                                                                                      new_image = _resize_landscape_image(image)
                                                                                    else:
                                                                                      new_image = _resize_portrait_image(image)
                                                                              Severity: Major
                                                                              Found in research/object_detection/core/preprocessor.py and 1 other location - About 1 day to fix
                                                                              official/projects/centernet/ops/preprocess_ops.py on lines 286..297

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

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

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

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

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

                                                                              Refactorings

                                                                              Further Reading

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

                                                                                  if pad_to_max_dimension:
                                                                                    channels = tf.unstack(new_image, axis=2)
                                                                                    if len(channels) != len(per_channel_pad_value):
                                                                                      raise ValueError('Number of channels must be equal to the length of '
                                                                                                       'per-channel pad value.')
                                                                              Severity: Major
                                                                              Found in research/object_detection/core/preprocessor.py and 1 other location - About 1 day to fix
                                                                              official/projects/centernet/ops/preprocess_ops.py on lines 299..313

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

                                                                              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 random_adjust_hue(image,
                                                                                                    max_delta=0.02,
                                                                                                    seed=None,
                                                                                                    preprocess_vars_cache=None):
                                                                                """Randomly adjusts hue.
                                                                              Severity: Major
                                                                              Found in research/object_detection/core/preprocessor.py and 1 other location - About 1 day to fix
                                                                              research/object_detection/core/preprocessor.py on lines 1105..1140

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

                                                                              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 random_adjust_brightness(image,
                                                                                                           max_delta=0.2,
                                                                                                           seed=None,
                                                                                                           preprocess_vars_cache=None):
                                                                                """Randomly adjusts brightness.
                                                                              Severity: Major
                                                                              Found in research/object_detection/core/preprocessor.py and 1 other location - About 1 day to fix
                                                                              research/object_detection/core/preprocessor.py on lines 1184..1216

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

                                                                              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 random_adjust_saturation(image,
                                                                                                           min_delta=0.8,
                                                                                                           max_delta=1.25,
                                                                                                           seed=None,
                                                                                                           preprocess_vars_cache=None):
                                                                              Severity: Major
                                                                              Found in research/object_detection/core/preprocessor.py and 1 other location - About 1 day to fix
                                                                              research/object_detection/core/preprocessor.py on lines 1143..1181

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

                                                                              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 random_adjust_contrast(image,
                                                                                                         min_delta=0.8,
                                                                                                         max_delta=1.25,
                                                                                                         seed=None,
                                                                                                         preprocess_vars_cache=None):
                                                                              Severity: Major
                                                                              Found in research/object_detection/core/preprocessor.py and 1 other location - About 1 day to fix
                                                                              research/object_detection/core/preprocessor.py on lines 1219..1256

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

                                                                              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

                                                                                with tf.name_scope('NormalizeImage', values=[image]):
                                                                                  original_minval = float(original_minval)
                                                                                  original_maxval = float(original_maxval)
                                                                                  target_minval = float(target_minval)
                                                                                  target_maxval = float(target_maxval)
                                                                              Severity: Major
                                                                              Found in research/object_detection/core/preprocessor.py and 1 other location - About 7 hrs to fix
                                                                              research/attention_ocr/python/model_export_lib.py on lines 39..49

                                                                              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 _flip_boxes_up_down(boxes):
                                                                                """Up-down flip the boxes.
                                                                              
                                                                                Args:
                                                                                  boxes: rank 2 float32 tensor containing the bounding boxes -> [N, 4].
                                                                              Severity: Major
                                                                              Found in research/object_detection/core/preprocessor.py and 1 other location - About 4 hrs to fix
                                                                              official/vision/utils/object_detection/preprocessor.py on lines 47..62

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

                                                                              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 _get_or_create_preprocess_rand_vars(generator_func,
                                                                                                                      function_id,
                                                                                                                      preprocess_vars_cache,
                                                                                                                      key=''):
                                                                                """Returns a tensor stored in preprocess_vars_cache or using generator_func.
                                                                              Severity: Major
                                                                              Found in research/object_detection/core/preprocessor.py and 1 other location - About 4 hrs to fix
                                                                              official/projects/centernet/ops/preprocess_ops.py on lines 25..54

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

                                                                              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 keypoints is not None and keypoint_flip_permutation is not None:
                                                                                    permutation = keypoint_flip_permutation
                                                                                    keypoints = tf.cond(
                                                                                        do_a_flip_random,
                                                                                        lambda: keypoint_ops.flip_vertical(keypoints, 0.5, permutation),
                                                                              Severity: Major
                                                                              Found in research/object_detection/core/preprocessor.py and 1 other location - About 3 hrs to fix
                                                                              research/object_detection/core/preprocessor.py on lines 695..701

                                                                              Duplicated Code

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

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

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

                                                                              Tuning

                                                                              This issue has a mass of 64.

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

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

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

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

                                                                              Refactorings

                                                                              Further Reading

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

                                                                                  if keypoints is not None and keypoint_flip_permutation is not None:
                                                                                    permutation = keypoint_flip_permutation
                                                                                    keypoints = tf.cond(
                                                                                        do_a_flip_random,
                                                                                        lambda: keypoint_ops.flip_horizontal(keypoints, 0.5, permutation),
                                                                              Severity: Major
                                                                              Found in research/object_detection/core/preprocessor.py and 1 other location - About 3 hrs to fix
                                                                              research/object_detection/core/preprocessor.py on lines 829..835

                                                                              Duplicated Code

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

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

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

                                                                              Tuning

                                                                              This issue has a mass of 64.

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

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

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

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

                                                                              Refactorings

                                                                              Further Reading

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

                                                                                target_height = tf.cond(
                                                                                    max_image_size[0] > min_image_size[0],
                                                                                    lambda: _random_integer(min_image_size[0], max_image_size[0], seed),
                                                                                    lambda: max_image_size[0])
                                                                              Severity: Major
                                                                              Found in research/object_detection/core/preprocessor.py and 1 other location - About 3 hrs to fix
                                                                              research/object_detection/core/preprocessor.py on lines 1930..1933

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

                                                                              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

                                                                                target_width = tf.cond(
                                                                                    max_image_size[1] > min_image_size[1],
                                                                                    lambda: _random_integer(min_image_size[1], max_image_size[1], seed),
                                                                                    lambda: max_image_size[1])
                                                                              Severity: Major
                                                                              Found in research/object_detection/core/preprocessor.py and 1 other location - About 3 hrs to fix
                                                                              research/object_detection/core/preprocessor.py on lines 1925..1928

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

                                                                              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 keypoints is not None:
                                                                                  keypoints = tf.gather(keypoints, indices)
                                                                                  keypoints = keypoint_ops.change_coordinate_frame(keypoints, new_window)
                                                                                  keypoints = keypoint_ops.prune_outside_window(
                                                                                      keypoints, [0.0, 0.0, 1.0, 1.0])
                                                                              Severity: Major
                                                                              Found in research/object_detection/core/preprocessor.py and 1 other location - About 2 hrs to fix
                                                                              research/object_detection/core/preprocessor.py on lines 4266..4271

                                                                              Duplicated Code

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

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

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

                                                                              Tuning

                                                                              This issue has a mass of 60.

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

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

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

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

                                                                              Refactorings

                                                                              Further Reading

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

                                                                                if keypoints is not None:
                                                                                  keypoints = tf.gather(keypoints, indices)
                                                                                  keypoints = keypoint_ops.change_coordinate_frame(keypoints, image_box)
                                                                                  keypoints = keypoint_ops.prune_outside_window(keypoints,
                                                                                                                                [0.0, 0.0, 1.0, 1.0])
                                                                              Severity: Major
                                                                              Found in research/object_detection/core/preprocessor.py and 1 other location - About 2 hrs to fix
                                                                              research/object_detection/core/preprocessor.py on lines 4393..4398

                                                                              Duplicated Code

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

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

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

                                                                              Tuning

                                                                              This issue has a mass of 60.

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

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

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

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

                                                                              Refactorings

                                                                              Further Reading

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

                                                                                crop_result = ssd_random_crop(
                                                                                    image,
                                                                                    boxes,
                                                                                    labels,
                                                                              Severity: Major
                                                                              Found in research/object_detection/core/preprocessor.py and 1 other location - About 2 hrs to fix
                                                                              research/object_detection/core/preprocessor.py on lines 3865..3868

                                                                              Duplicated Code

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

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

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

                                                                              Tuning

                                                                              This issue has a mass of 51.

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

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

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

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

                                                                              Refactorings

                                                                              Further Reading

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

                                                                                crop_result = ssd_random_crop(
                                                                                    image,
                                                                                    boxes,
                                                                                    labels,
                                                                              Severity: Major
                                                                              Found in research/object_detection/core/preprocessor.py and 1 other location - About 2 hrs to fix
                                                                              research/object_detection/core/preprocessor.py on lines 4009..4012

                                                                              Duplicated Code

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

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

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

                                                                              Tuning

                                                                              This issue has a mass of 51.

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

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

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

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

                                                                              Refactorings

                                                                              Further Reading

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

                                                                                offset_width = tf.cond(
                                                                                    target_width > image_width,
                                                                                    lambda: _random_integer(0, target_width - image_width, seed),
                                                                                    lambda: tf.constant(0, dtype=tf.int32))
                                                                              Severity: Major
                                                                              Found in research/object_detection/core/preprocessor.py and 1 other location - About 2 hrs to fix
                                                                              research/object_detection/core/preprocessor.py on lines 1935..1938

                                                                              Duplicated Code

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

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

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

                                                                              Tuning

                                                                              This issue has a mass of 51.

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

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

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

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

                                                                              Refactorings

                                                                              Further Reading

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

                                                                                offset_height = tf.cond(
                                                                                    target_height > image_height,
                                                                                    lambda: _random_integer(0, target_height - image_height, seed),
                                                                                    lambda: tf.constant(0, dtype=tf.int32))
                                                                              Severity: Major
                                                                              Found in research/object_detection/core/preprocessor.py and 1 other location - About 2 hrs to fix
                                                                              research/object_detection/core/preprocessor.py on lines 1940..1943

                                                                              Duplicated Code

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

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

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

                                                                              Tuning

                                                                              This issue has a mass of 51.

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

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

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

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

                                                                              Refactorings

                                                                              Further Reading

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

                                                                                if ((densepose_part_ids is not None and densepose_surface_coords is None) or
                                                                                    (densepose_part_ids is None and densepose_surface_coords is not None)):
                                                                                  raise ValueError(
                                                                              Severity: Major
                                                                              Found in research/object_detection/core/preprocessor.py and 1 other location - About 2 hrs to fix
                                                                              research/object_detection/utils/per_image_evaluation.py on lines 172..175

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

                                                                              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_height_distortion = tf.abs(tf.minimum(
                                                                                        (2.0 * ycenter) / height, 2.0 * (1 - ycenter) / height))
                                                                              Severity: Major
                                                                              Found in research/object_detection/core/preprocessor.py and 1 other location - About 1 hr to fix
                                                                              research/object_detection/core/preprocessor.py on lines 1376..1377

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

                                                                              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_width_distortion = tf.abs(tf.minimum(
                                                                                        (2.0 * xcenter) / width, 2.0 * (1 - xcenter) / width))
                                                                              Severity: Major
                                                                              Found in research/object_detection/core/preprocessor.py and 1 other location - About 1 hr to fix
                                                                              research/object_detection/core/preprocessor.py on lines 1374..1375

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

                                                                              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

                                                                                  return _strict_random_crop_image(
                                                                              Severity: Major
                                                                              Found in research/object_detection/core/preprocessor.py and 1 other location - About 1 hr to fix
                                                                              official/legacy/xlnet/squad_utils.py on lines 815..815

                                                                              Duplicated Code

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

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

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

                                                                              Tuning

                                                                              This issue has a mass of 46.

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

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

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

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

                                                                              Refactorings

                                                                              Further Reading

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

                                                                                  if boxes is not None:
                                                                                    boxes = tf.cond(do_a_rot90_random, lambda: _rot90_boxes(boxes),
                                                                                                    lambda: boxes)
                                                                                    result.append(boxes)
                                                                              Severity: Major
                                                                              Found in research/object_detection/core/preprocessor.py and 5 other locations - About 1 hr to fix
                                                                              research/object_detection/core/preprocessor.py on lines 683..686
                                                                              research/object_detection/core/preprocessor.py on lines 689..692
                                                                              research/object_detection/core/preprocessor.py on lines 817..820
                                                                              research/object_detection/core/preprocessor.py on lines 823..826
                                                                              research/object_detection/core/preprocessor.py on lines 919..922

                                                                              Duplicated Code

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

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

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

                                                                              Tuning

                                                                              This issue has a mass of 44.

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

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

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

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

                                                                              Refactorings

                                                                              Further Reading

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

                                                                                  if boxes is not None:
                                                                                    boxes = tf.cond(do_a_flip_random, lambda: _flip_boxes_left_right(boxes),
                                                                                                    lambda: boxes)
                                                                                    result.append(boxes)
                                                                              Severity: Major
                                                                              Found in research/object_detection/core/preprocessor.py and 5 other locations - About 1 hr to fix
                                                                              research/object_detection/core/preprocessor.py on lines 689..692
                                                                              research/object_detection/core/preprocessor.py on lines 817..820
                                                                              research/object_detection/core/preprocessor.py on lines 823..826
                                                                              research/object_detection/core/preprocessor.py on lines 913..916
                                                                              research/object_detection/core/preprocessor.py on lines 919..922

                                                                              Duplicated Code

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

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

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

                                                                              Tuning

                                                                              This issue has a mass of 44.

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

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

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

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

                                                                              Refactorings

                                                                              Further Reading

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

                                                                                  if boxes is not None:
                                                                                    boxes = tf.cond(do_a_flip_random, lambda: _flip_boxes_up_down(boxes),
                                                                                                    lambda: boxes)
                                                                                    result.append(boxes)
                                                                              Severity: Major
                                                                              Found in research/object_detection/core/preprocessor.py and 5 other locations - About 1 hr to fix
                                                                              research/object_detection/core/preprocessor.py on lines 683..686
                                                                              research/object_detection/core/preprocessor.py on lines 689..692
                                                                              research/object_detection/core/preprocessor.py on lines 823..826
                                                                              research/object_detection/core/preprocessor.py on lines 913..916
                                                                              research/object_detection/core/preprocessor.py on lines 919..922

                                                                              Duplicated Code

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

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

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

                                                                              Tuning

                                                                              This issue has a mass of 44.

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

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

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

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

                                                                              Refactorings

                                                                              Further Reading

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

                                                                                  if masks is not None:
                                                                                    masks = tf.cond(do_a_rot90_random, lambda: _rot90_masks(masks),
                                                                                                    lambda: masks)
                                                                                    result.append(masks)
                                                                              Severity: Major
                                                                              Found in research/object_detection/core/preprocessor.py and 5 other locations - About 1 hr to fix
                                                                              research/object_detection/core/preprocessor.py on lines 683..686
                                                                              research/object_detection/core/preprocessor.py on lines 689..692
                                                                              research/object_detection/core/preprocessor.py on lines 817..820
                                                                              research/object_detection/core/preprocessor.py on lines 823..826
                                                                              research/object_detection/core/preprocessor.py on lines 913..916

                                                                              Duplicated Code

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

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

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

                                                                              Tuning

                                                                              This issue has a mass of 44.

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

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

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

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

                                                                              Refactorings

                                                                              Further Reading

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

                                                                                  if masks is not None:
                                                                                    masks = tf.cond(do_a_flip_random, lambda: _flip_masks_up_down(masks),
                                                                                                    lambda: masks)
                                                                                    result.append(masks)
                                                                              Severity: Major
                                                                              Found in research/object_detection/core/preprocessor.py and 5 other locations - About 1 hr to fix
                                                                              research/object_detection/core/preprocessor.py on lines 683..686
                                                                              research/object_detection/core/preprocessor.py on lines 689..692
                                                                              research/object_detection/core/preprocessor.py on lines 817..820
                                                                              research/object_detection/core/preprocessor.py on lines 913..916
                                                                              research/object_detection/core/preprocessor.py on lines 919..922

                                                                              Duplicated Code

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

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

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

                                                                              Tuning

                                                                              This issue has a mass of 44.

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

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

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

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

                                                                              Refactorings

                                                                              Further Reading

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

                                                                                  if masks is not None:
                                                                                    masks = tf.cond(do_a_flip_random, lambda: _flip_masks_left_right(masks),
                                                                                                    lambda: masks)
                                                                                    result.append(masks)
                                                                              Severity: Major
                                                                              Found in research/object_detection/core/preprocessor.py and 5 other locations - About 1 hr to fix
                                                                              research/object_detection/core/preprocessor.py on lines 683..686
                                                                              research/object_detection/core/preprocessor.py on lines 817..820
                                                                              research/object_detection/core/preprocessor.py on lines 823..826
                                                                              research/object_detection/core/preprocessor.py on lines 913..916
                                                                              research/object_detection/core/preprocessor.py on lines 919..922

                                                                              Duplicated Code

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

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

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

                                                                              Tuning

                                                                              This issue has a mass of 44.

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

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

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

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

                                                                              Refactorings

                                                                              Further Reading

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

                                                                                max_image_size = tf.cast(
                                                                                    tf.cast(tf.stack([image_height, image_width]), dtype=tf.float32) *
                                                                                    max_padded_size_ratio,
                                                                                    dtype=tf.int32)
                                                                              Severity: Major
                                                                              Found in research/object_detection/core/preprocessor.py and 1 other location - About 1 hr to fix
                                                                              research/object_detection/core/preprocessor.py on lines 2185..2188

                                                                              Duplicated Code

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

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

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

                                                                              Tuning

                                                                              This issue has a mass of 44.

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

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

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

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

                                                                              Refactorings

                                                                              Further Reading

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

                                                                                min_image_size = tf.cast(
                                                                                    tf.cast(tf.stack([image_height, image_width]), dtype=tf.float32) *
                                                                                    min_padded_size_ratio,
                                                                                    dtype=tf.int32)
                                                                              Severity: Major
                                                                              Found in research/object_detection/core/preprocessor.py and 1 other location - About 1 hr to fix
                                                                              research/object_detection/core/preprocessor.py on lines 2189..2192

                                                                              Duplicated Code

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

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

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

                                                                              Tuning

                                                                              This issue has a mass of 44.

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

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

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

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

                                                                              Refactorings

                                                                              Further Reading

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

                                                                                  y = get_or_create_rand_vars_fn(
                                                                                      functools.partial(
                                                                                          tf.random_uniform, [],
                                                                                          minval=0,
                                                                                          maxval=image_shape[0],
                                                                              Severity: Major
                                                                              Found in research/object_detection/core/preprocessor.py and 1 other location - About 1 hr to fix
                                                                              research/object_detection/core/preprocessor.py on lines 2876..2881

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

                                                                              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

                                                                                  x = get_or_create_rand_vars_fn(
                                                                                      functools.partial(
                                                                                          tf.random_uniform, [],
                                                                                          minval=0,
                                                                                          maxval=image_shape[1],
                                                                              Severity: Major
                                                                              Found in research/object_detection/core/preprocessor.py and 1 other location - About 1 hr to fix
                                                                              research/object_detection/core/preprocessor.py on lines 2868..2873

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

                                                                              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

                                                                                  new_image = tf.image.pad_to_bounding_box(
                                                                                      image, 0, 0, tf.cast(target_height, dtype=tf.int32),
                                                                                      tf.cast(target_width, dtype=tf.int32))
                                                                              Severity: Major
                                                                              Found in research/object_detection/core/preprocessor.py and 1 other location - About 1 hr to fix
                                                                              research/object_detection/core/preprocessor.py on lines 2534..2536

                                                                              Duplicated Code

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

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

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

                                                                              Tuning

                                                                              This issue has a mass of 41.

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

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

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

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

                                                                              Refactorings

                                                                              Further Reading

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

                                                                                  new_image = image[im_box_begin[0]:im_box_end[0],
                                                                                                    im_box_begin[1]:im_box_end[1], :]
                                                                              Severity: Major
                                                                              Found in research/object_detection/core/preprocessor.py and 1 other location - About 1 hr to fix
                                                                              research/autoaugment/augmentation_transforms.py on lines 97..97

                                                                              Duplicated Code

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

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

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

                                                                              Tuning

                                                                              This issue has a mass of 41.

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

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

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

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

                                                                              Refactorings

                                                                              Further Reading

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

                                                                                    new_masks = tf.image.pad_to_bounding_box(
                                                                                        new_masks, 0, 0, tf.cast(target_height, dtype=tf.int32),
                                                                                        tf.cast(target_width, dtype=tf.int32))
                                                                              Severity: Major
                                                                              Found in research/object_detection/core/preprocessor.py and 1 other location - About 1 hr to fix
                                                                              research/object_detection/core/preprocessor.py on lines 2516..2518

                                                                              Duplicated Code

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

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

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

                                                                              Tuning

                                                                              This issue has a mass of 41.

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

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

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

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

                                                                              Refactorings

                                                                              Further Reading

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

                                                                                def y_function():
                                                                                  y = _random_integer(h_border,
                                                                                                      tf.cast(height, tf.int32) - h_border + 1,
                                                                                                      seed)
                                                                                  return y
                                                                              Severity: Major
                                                                              Found in research/object_detection/core/preprocessor.py and 3 other locations - About 1 hr to fix
                                                                              official/projects/centernet/ops/preprocess_ops.py on lines 150..154
                                                                              official/projects/centernet/ops/preprocess_ops.py on lines 156..160
                                                                              research/object_detection/core/preprocessor.py on lines 4191..4195

                                                                              Duplicated Code

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

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

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

                                                                              Tuning

                                                                              This issue has a mass of 39.

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

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

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

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

                                                                              Refactorings

                                                                              Further Reading

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

                                                                                def x_function():
                                                                                  x = _random_integer(w_border,
                                                                                                      tf.cast(width, tf.int32) - w_border + 1,
                                                                                                      seed)
                                                                                  return x
                                                                              Severity: Major
                                                                              Found in research/object_detection/core/preprocessor.py and 3 other locations - About 1 hr to fix
                                                                              official/projects/centernet/ops/preprocess_ops.py on lines 150..154
                                                                              official/projects/centernet/ops/preprocess_ops.py on lines 156..160
                                                                              research/object_detection/core/preprocessor.py on lines 4185..4189

                                                                              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

                                                                                image, boxes, labels, label_weights = tf.cond(
                                                                                    concat_vertical,
                                                                                    lambda: _concat_image(image, boxes, labels, label_weights, axis=0),
                                                                                    lambda: [image, boxes, labels, label_weights],
                                                                              Severity: Minor
                                                                              Found in research/object_detection/core/preprocessor.py and 1 other location - About 55 mins to fix
                                                                              research/object_detection/core/preprocessor.py on lines 3504..3507

                                                                              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

                                                                                outputs = tf.cond(
                                                                                    concat_horizontal,
                                                                                    lambda: _concat_image(image, boxes, labels, label_weights, axis=1),
                                                                                    lambda: [image, boxes, labels, label_weights],
                                                                              Severity: Minor
                                                                              Found in research/object_detection/core/preprocessor.py and 1 other location - About 55 mins to fix
                                                                              research/object_detection/core/preprocessor.py on lines 3498..3501

                                                                              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

                                                                                    distortion = 1.0 + tf.random.uniform(
                                                                                        [num_boxes, 2], minval=min_ratio, maxval=max_ratio, dtype=tf.float32,
                                                                              Severity: Minor
                                                                              Found in research/object_detection/core/preprocessor.py and 1 other location - About 55 mins to fix
                                                                              research/object_detection/core/preprocessor.py on lines 1395..1396

                                                                              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

                                                                                def _resize_landscape_image(image):
                                                                                  # resize a landscape image
                                                                                  return tf.image.resize_images(
                                                                                      image, tf.stack([min_dimension, max_dimension]), method=method,
                                                                              Severity: Minor
                                                                              Found in research/object_detection/core/preprocessor.py and 1 other location - About 55 mins to fix
                                                                              research/object_detection/core/preprocessor.py on lines 3043..3046

                                                                              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

                                                                                    distortion = 1.0 + tf.random.uniform(
                                                                                        [num_boxes, 4], minval=min_ratio, maxval=max_ratio, dtype=tf.float32,
                                                                              Severity: Minor
                                                                              Found in research/object_detection/core/preprocessor.py and 1 other location - About 55 mins to fix
                                                                              research/object_detection/core/preprocessor.py on lines 1365..1366

                                                                              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

                                                                                  patch_size = get_or_create_rand_vars_fn(
                                                                                      functools.partial(
                                                                                          tf.random_uniform, [],
                                                                                          minval=min_patch_size,
                                                                                          maxval=max_patch_size,
                                                                              Severity: Minor
                                                                              Found in research/object_detection/core/preprocessor.py and 1 other location - About 55 mins to fix
                                                                              research/object_detection/core/preprocessor.py on lines 2858..2863

                                                                              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

                                                                                def _resize_portrait_image(image):
                                                                                  # resize a portrait image
                                                                                  return tf.image.resize_images(
                                                                                      image, tf.stack([max_dimension, min_dimension]), method=method,
                                                                              Severity: Minor
                                                                              Found in research/object_detection/core/preprocessor.py and 1 other location - About 55 mins to fix
                                                                              research/object_detection/core/preprocessor.py on lines 3037..3040

                                                                              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 label_confidences is not None:
                                                                                  cropped_label_confidences = result[index]
                                                                                  cropped_padded_output += (cropped_label_confidences,)
                                                                                  index += 1
                                                                              Severity: Minor
                                                                              Found in research/object_detection/core/preprocessor.py and 1 other location - About 55 mins to fix
                                                                              research/object_detection/core/preprocessor.py on lines 2206..2209

                                                                              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

                                                                                      tf.cast(offset_width + target_width, dtype=tf.float32) /
                                                                                      tf.cast(orig_width, dtype=tf.float32)
                                                                              Severity: Minor
                                                                              Found in research/object_detection/core/preprocessor.py and 1 other location - About 55 mins to fix
                                                                              research/object_detection/core/preprocessor.py on lines 2353..2354

                                                                              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 label_weights is not None:
                                                                                  cropped_label_weights = result[index]
                                                                                  cropped_padded_output += (cropped_label_weights,)
                                                                                  index += 1
                                                                              Severity: Minor
                                                                              Found in research/object_detection/core/preprocessor.py and 1 other location - About 55 mins to fix
                                                                              research/object_detection/core/preprocessor.py on lines 2211..2214

                                                                              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

                                                                                      tf.cast(offset_height + target_height, dtype=tf.float32) /
                                                                                      tf.cast(orig_height, dtype=tf.float32),
                                                                              Severity: Minor
                                                                              Found in research/object_detection/core/preprocessor.py and 1 other location - About 55 mins to fix
                                                                              research/object_detection/core/preprocessor.py on lines 2355..2356

                                                                              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

                                                                                  gaussian_stddev = get_or_create_rand_vars_fn(
                                                                                      functools.partial(
                                                                                          tf.random_uniform, [],
                                                                                          minval=min_gaussian_stddev,
                                                                                          maxval=max_gaussian_stddev,
                                                                              Severity: Minor
                                                                              Found in research/object_detection/core/preprocessor.py and 1 other location - About 55 mins to fix
                                                                              research/object_detection/core/preprocessor.py on lines 2850..2855

                                                                              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

                                                                                  image_newxsize = tf.cast(
                                                                                      tf.multiply(tf.cast(image_width, dtype=tf.float32), size_coef),
                                                                                      dtype=tf.int32)
                                                                              Severity: Minor
                                                                              Found in research/object_detection/core/preprocessor.py and 1 other location - About 50 mins to fix
                                                                              research/object_detection/core/preprocessor.py on lines 1015..1017

                                                                              Duplicated Code

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

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

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

                                                                              Tuning

                                                                              This issue has a mass of 36.

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

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

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

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

                                                                              Refactorings

                                                                              Further Reading

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

                                                                                  image_newysize = tf.cast(
                                                                                      tf.multiply(tf.cast(image_height, dtype=tf.float32), size_coef),
                                                                                      dtype=tf.int32)
                                                                              Severity: Minor
                                                                              Found in research/object_detection/core/preprocessor.py and 1 other location - About 50 mins to fix
                                                                              research/object_detection/core/preprocessor.py on lines 1018..1020

                                                                              Duplicated Code

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

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

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

                                                                              Tuning

                                                                              This issue has a mass of 36.

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

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

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

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

                                                                              Refactorings

                                                                              Further Reading

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

                                                                                    ymin, ymax = ycenter - (ymin_jitter / 2.0), ycenter + (ymax_jitter / 2.0)
                                                                              Severity: Minor
                                                                              Found in research/object_detection/core/preprocessor.py and 1 other location - About 45 mins to fix
                                                                              research/object_detection/core/preprocessor.py on lines 1404..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 35.

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

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

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

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

                                                                              Refactorings

                                                                              Further Reading

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

                                                                                    xmin, xmax = xcenter - (xmin_jitter / 2.0), xcenter + (xmax_jitter / 2.0)
                                                                              Severity: Minor
                                                                              Found in research/object_detection/core/preprocessor.py and 1 other location - About 45 mins to fix
                                                                              research/object_detection/core/preprocessor.py on lines 1403..1403

                                                                              Duplicated Code

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

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

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

                                                                              Tuning

                                                                              This issue has a mass of 35.

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

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

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

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

                                                                              Refactorings

                                                                              Further Reading

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

                                                                                result = random_crop_to_aspect_ratio(
                                                                                    new_image,
                                                                                    new_boxes,
                                                                                    new_labels,
                                                                              Severity: Minor
                                                                              Found in research/object_detection/core/preprocessor.py and 1 other location - About 45 mins to fix
                                                                              research/object_detection/dataset_tools/context_rcnn/add_context_to_examples.py on lines 773..775

                                                                              Duplicated Code

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

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

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

                                                                              Tuning

                                                                              This issue has a mass of 35.

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

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

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

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

                                                                              Refactorings

                                                                              Further Reading

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

                                                                                image_box = [box_ymin / height, box_xmin / width,
                                                                                             box_ymax / height, box_xmax / width]
                                                                              Severity: Minor
                                                                              Found in research/object_detection/core/preprocessor.py and 1 other location - About 40 mins to fix
                                                                              official/projects/centernet/ops/preprocess_ops.py on lines 207..208

                                                                              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

                                                                                    offset_width = tf.cast(tf.math.floor((orig_width - target_width) / 2),
                                                                                                           tf.int32)
                                                                              Severity: Minor
                                                                              Found in research/object_detection/core/preprocessor.py and 1 other location - About 40 mins to fix
                                                                              research/object_detection/core/preprocessor.py on lines 2331..2332

                                                                              Duplicated Code

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

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

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

                                                                              Tuning

                                                                              This issue has a mass of 34.

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

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

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

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

                                                                              Refactorings

                                                                              Further Reading

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

                                                                                  if mask_weights is not None:
                                                                                    mask_weights_inside_window = tf.gather(mask_weights, inside_window_ids)
                                                                                    mask_weights_completely_inside_window = tf.gather(
                                                                                        mask_weights_inside_window, keep_ids)
                                                                                    result.append(mask_weights_completely_inside_window)
                                                                              Severity: Minor
                                                                              Found in research/object_detection/core/preprocessor.py and 1 other location - About 40 mins to fix
                                                                              research/object_detection/core/preprocessor.py on lines 1646..1650

                                                                              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

                                                                                    offset_height = tf.cast(tf.math.floor((orig_height - target_height) / 2),
                                                                                                            tf.int32)
                                                                              Severity: Minor
                                                                              Found in research/object_detection/core/preprocessor.py and 1 other location - About 40 mins to fix
                                                                              research/object_detection/core/preprocessor.py on lines 2333..2334

                                                                              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

                                                                                    for dp_tensor in densepose_tensors:
                                                                                      dp_tensor_inside_window = tf.gather(dp_tensor, inside_window_ids)
                                                                                      dp_tensor_completely_inside_window = tf.gather(dp_tensor_inside_window,
                                                                                                                                     keep_ids)
                                                                                      filtered_dp_tensors.append(dp_tensor_completely_inside_window)
                                                                              Severity: Minor
                                                                              Found in research/object_detection/core/preprocessor.py and 1 other location - About 40 mins to fix
                                                                              research/object_detection/core/preprocessor.py on lines 1616..1620

                                                                              Duplicated Code

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

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

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

                                                                              Tuning

                                                                              This issue has a mass of 34.

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

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

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

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

                                                                              Refactorings

                                                                              Further Reading

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

                                                                                  if axis == 0:
                                                                                    # Concat vertically, so need to reduce the y coordinates.
                                                                                    old_scaling = tf.constant([0.5, 1.0, 0.5, 1.0])
                                                                                    new_translation = tf.constant([0.5, 0.0, 0.5, 0.0])
                                                                              Severity: Minor
                                                                              Found in research/object_detection/core/preprocessor.py and 1 other location - About 35 mins to fix
                                                                              research/object_detection/core/preprocessor.py on lines 3487..3489

                                                                              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

                                                                                  elif axis == 1:
                                                                                    old_scaling = tf.constant([1.0, 0.5, 1.0, 0.5])
                                                                                    new_translation = tf.constant([0.0, 0.5, 0.0, 0.5])
                                                                              Severity: Minor
                                                                              Found in research/object_detection/core/preprocessor.py and 1 other location - About 35 mins to fix
                                                                              research/object_detection/core/preprocessor.py on lines 3483..3486

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

                                                                                    keypoint_depth_weights = tf.cond(
                                                                                        do_a_flip_random,
                                                                                        lambda: tf.gather(keypoint_depth_weights, kpt_flip_perm, axis=1),
                                                                                        lambda: keypoint_depth_weights)
                                                                              Severity: Minor
                                                                              Found in research/object_detection/core/preprocessor.py and 2 other locations - About 30 mins to fix
                                                                              research/object_detection/core/preprocessor.py on lines 707..710
                                                                              research/object_detection/core/preprocessor.py on lines 728..731

                                                                              Duplicated Code

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

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

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

                                                                              Tuning

                                                                              This issue has a mass of 32.

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

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

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

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

                                                                              Refactorings

                                                                              Further Reading

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

                                                                                    keypoint_visibilities = tf.cond(
                                                                                        do_a_flip_random,
                                                                                        lambda: tf.gather(keypoint_visibilities, kpt_flip_perm, axis=1),
                                                                                        lambda: keypoint_visibilities)
                                                                              Severity: Minor
                                                                              Found in research/object_detection/core/preprocessor.py and 2 other locations - About 30 mins to fix
                                                                              research/object_detection/core/preprocessor.py on lines 728..731
                                                                              research/object_detection/core/preprocessor.py on lines 732..735

                                                                              Duplicated Code

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

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

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

                                                                              Tuning

                                                                              This issue has a mass of 32.

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

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

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

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

                                                                              Refactorings

                                                                              Further Reading

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

                                                                                    keypoint_depths = tf.cond(
                                                                                        do_a_flip_random,
                                                                                        lambda: tf.gather(keypoint_depths, kpt_flip_perm, axis=1),
                                                                                        lambda: keypoint_depths)
                                                                              Severity: Minor
                                                                              Found in research/object_detection/core/preprocessor.py and 2 other locations - About 30 mins to fix
                                                                              research/object_detection/core/preprocessor.py on lines 707..710
                                                                              research/object_detection/core/preprocessor.py on lines 732..735

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

                                                                                  offset_width = tf.cast(tf.floor((target_width - image_width) / 2),
                                                                                                         tf.int32)
                                                                              Severity: Minor
                                                                              Found in research/object_detection/core/preprocessor.py and 1 other location - About 30 mins to fix
                                                                              research/object_detection/core/preprocessor.py on lines 1946..1947

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

                                                                                  offset_height = tf.cast(tf.floor((target_height - image_height) / 2),
                                                                                                          tf.int32)
                                                                              Severity: Minor
                                                                              Found in research/object_detection/core/preprocessor.py and 1 other location - About 30 mins to fix
                                                                              research/object_detection/core/preprocessor.py on lines 1948..1949

                                                                              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