tensorflow/models

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

Summary

Maintainability
F
2 wks
Test Coverage

File visualization_utils.py has 1327 lines of code (exceeds 250 allowed). Consider refactoring.
Open

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

    Function visualize_boxes_and_labels_on_image_array has a Cognitive Complexity of 81 (exceeds 5 allowed). Consider refactoring.
    Open

    def visualize_boxes_and_labels_on_image_array(
        image,
        boxes,
        classes,
        scores,
    Severity: Minor
    Found in research/object_detection/utils/visualization_utils.py - About 1 day to fix

    Cognitive Complexity

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

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

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

    Further reading

    Function draw_side_by_side_evaluation_image has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
    Open

    def draw_side_by_side_evaluation_image(eval_dict,
                                           category_index,
                                           max_boxes_to_draw=20,
                                           min_score_thresh=0.2,
                                           use_normalized_coordinates=True,
    Severity: Minor
    Found in research/object_detection/utils/visualization_utils.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 visualize_boxes_and_labels_on_image_array has 22 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def visualize_boxes_and_labels_on_image_array(
    Severity: Major
    Found in research/object_detection/utils/visualization_utils.py - About 2 hrs to fix

      Function draw_keypoints_on_image has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

      def draw_keypoints_on_image(image,
                                  keypoints,
                                  keypoint_scores=None,
                                  min_score_thresh=0.5,
                                  color='red',
      Severity: Minor
      Found in research/object_detection/utils/visualization_utils.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 draw_densepose_visualizations has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

      def draw_densepose_visualizations(eval_dict,
                                        max_boxes_to_draw=20,
                                        min_score_thresh=0.2,
                                        num_parts=24,
                                        dp_coord_to_visualize=0):
      Severity: Minor
      Found in research/object_detection/utils/visualization_utils.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 draw_bounding_boxes_on_image_tensors has 15 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def draw_bounding_boxes_on_image_tensors(images,
      Severity: Major
      Found in research/object_detection/utils/visualization_utils.py - About 1 hr to fix

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

        def draw_bounding_boxes_on_image_tensors(images,
                                                 boxes,
                                                 classes,
                                                 scores,
                                                 category_index,
        Severity: Minor
        Found in research/object_detection/utils/visualization_utils.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 draw_keypoints_on_image_array has 10 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        def draw_keypoints_on_image_array(image,
        Severity: Major
        Found in research/object_detection/utils/visualization_utils.py - About 1 hr to fix

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

          def draw_keypoints_on_image(image,
          Severity: Major
          Found in research/object_detection/utils/visualization_utils.py - About 1 hr to fix

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

            def draw_bounding_box_on_image(image,
            Severity: Major
            Found in research/object_detection/utils/visualization_utils.py - About 1 hr to fix

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

              def draw_bounding_box_on_image_array(image,
              Severity: Major
              Found in research/object_detection/utils/visualization_utils.py - About 1 hr to fix

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

                  def __init__(self,
                Severity: Major
                Found in research/object_detection/utils/visualization_utils.py - About 50 mins to fix

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

                    def __init__(self,
                  Severity: Major
                  Found in research/object_detection/utils/visualization_utils.py - About 50 mins to fix

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

                    def draw_side_by_side_evaluation_image(eval_dict,
                    Severity: Minor
                    Found in research/object_detection/utils/visualization_utils.py - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                if not agnostic_mode:
                                  if classes[i] in six.viewkeys(category_index):
                                    class_name = category_index[classes[i]]['name']
                                  else:
                                    class_name = 'N/A'
                      Severity: Major
                      Found in research/object_detection/utils/visualization_utils.py - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                  if not display_str:
                                    display_str = '{}%'.format(round(100*scores[i]))
                                  else:
                                    display_str = '{}: {}%'.format(display_str, round(100*scores[i]))
                                if not skip_track_ids and track_ids is not None:
                        Severity: Major
                        Found in research/object_detection/utils/visualization_utils.py - About 45 mins to fix

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

                          def create_visualization_fn(category_index,
                                                      include_masks=False,
                                                      include_keypoints=False,
                                                      include_keypoint_scores=False,
                                                      include_track_ids=False,
                          Severity: Minor
                          Found in research/object_detection/utils/visualization_utils.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 create_visualization_fn has 6 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                          def create_visualization_fn(category_index,
                          Severity: Minor
                          Found in research/object_detection/utils/visualization_utils.py - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            Open

                                      if not display_str:
                                        display_str = 'ID {}'.format(track_ids[i])
                                      else:
                                        display_str = '{}: ID {}'.format(display_str, track_ids[i])
                                    box_to_display_str_map[box].append(display_str)
                            Severity: Major
                            Found in research/object_detection/utils/visualization_utils.py - About 45 mins to fix

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

                              def draw_densepose_visualizations(eval_dict,
                              Severity: Minor
                              Found in research/object_detection/utils/visualization_utils.py - About 35 mins to fix

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

                                def draw_float_channel_on_image_array(image, channel, mask, alpha=0.9,
                                Severity: Minor
                                Found in research/object_detection/utils/visualization_utils.py - About 35 mins to fix

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

                                  def draw_bounding_boxes_on_image(image,
                                  Severity: Minor
                                  Found in research/object_detection/utils/visualization_utils.py - About 35 mins to fix

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

                                    def draw_bounding_boxes_on_image_array(image,
                                    Severity: Minor
                                    Found in research/object_detection/utils/visualization_utils.py - About 35 mins to fix

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

                                      def draw_bounding_box_on_image(image,
                                                                     ymin,
                                                                     xmin,
                                                                     ymax,
                                                                     xmax,
                                      Severity: Minor
                                      Found in research/object_detection/utils/visualization_utils.py - About 35 mins to fix

                                      Cognitive Complexity

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

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

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

                                      Further reading

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

                                        def get_estimator_eval_metric_ops(self, eval_dict):
                                          """Returns metric ops for use in tf.estimator.EstimatorSpec.
                                      
                                          Args:
                                            eval_dict: A dictionary that holds an image, groundtruth, and detections
                                      Severity: Minor
                                      Found in research/object_detection/utils/visualization_utils.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 draw_bounding_boxes_on_image has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                      def draw_bounding_boxes_on_image(image,
                                                                       boxes,
                                                                       color='red',
                                                                       thickness=4,
                                                                       display_str_list_list=()):
                                      Severity: Minor
                                      Found in research/object_detection/utils/visualization_utils.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

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

                                      def draw_bounding_boxes_on_image(image,
                                                                       boxes,
                                                                       color='red',
                                                                       thickness=4,
                                                                       display_str_list_list=()):
                                      Severity: Major
                                      Found in research/object_detection/utils/visualization_utils.py and 1 other location - About 1 day to fix
                                      research/cognitive_planning/visualization_utils.py on lines 233..265

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

                                      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

                                      STANDARD_COLORS = [
                                          'AliceBlue', 'Chartreuse', 'Aqua', 'Aquamarine', 'Azure', 'Beige', 'Bisque',
                                          'BlanchedAlmond', 'BlueViolet', 'BurlyWood', 'CadetBlue', 'AntiqueWhite',
                                          'Chocolate', 'Coral', 'CornflowerBlue', 'Cornsilk', 'Crimson', 'Cyan',
                                          'DarkCyan', 'DarkGoldenRod', 'DarkGrey', 'DarkKhaki', 'DarkOrange',
                                      Severity: Major
                                      Found in research/object_detection/utils/visualization_utils.py and 1 other location - About 1 day to fix
                                      research/cognitive_planning/visualization_utils.py on lines 40..63

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

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

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

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

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

                                      Refactorings

                                      Further Reading

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

                                      def draw_bounding_box_on_image_array(image,
                                                                           ymin,
                                                                           xmin,
                                                                           ymax,
                                                                           xmax,
                                      Severity: Major
                                      Found in research/object_detection/utils/visualization_utils.py and 1 other location - About 4 hrs to fix
                                      research/cognitive_planning/visualization_utils.py on lines 96..128

                                      Duplicated Code

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

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

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

                                      Tuning

                                      This issue has a mass of 76.

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

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

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

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

                                      Refactorings

                                      Further Reading

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

                                              if not skip_scores:
                                                if not display_str:
                                                  display_str = '{}%'.format(round(100*scores[i]))
                                                else:
                                                  display_str = '{}: {}%'.format(display_str, round(100*scores[i]))
                                      Severity: Major
                                      Found in research/object_detection/utils/visualization_utils.py and 1 other location - About 3 hrs to fix
                                      research/cognitive_planning/visualization_utils.py on lines 627..631

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

                                      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 images.shape[3] > 3:
                                          images = images[:, :, :, 0:3]
                                        elif images.shape[3] == 1:
                                          images = tf.image.grayscale_to_rgb(images)
                                      Severity: Major
                                      Found in research/object_detection/utils/visualization_utils.py and 1 other location - About 3 hrs to fix
                                      research/object_detection/utils/visualization_utils.py on lines 483..486

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

                                      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 images.shape[3] > 3:
                                          images = images[:, :, :, 0:3]
                                        elif images.shape[3] == 1:
                                          images = tf.image.grayscale_to_rgb(images)
                                      Severity: Major
                                      Found in research/object_detection/utils/visualization_utils.py and 1 other location - About 3 hrs to fix
                                      research/object_detection/utils/visualization_utils.py on lines 569..572

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

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

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

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

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

                                      Refactorings

                                      Further Reading

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

                                      def encode_image_array_as_png_str(image):
                                        """Encodes a numpy array into a PNG string.
                                      
                                        Args:
                                          image: a numpy array with shape [height, width, 3].
                                      Severity: Major
                                      Found in research/object_detection/utils/visualization_utils.py and 1 other location - About 3 hrs to fix
                                      research/cognitive_planning/visualization_utils.py on lines 79..93

                                      Duplicated Code

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

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

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

                                      Tuning

                                      This issue has a mass of 67.

                                      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_original_image(image, image_shape):
                                        image = tf.expand_dims(image, 0)
                                        image = tf.image.resize_images(
                                            image,
                                            image_shape,
                                      Severity: Major
                                      Found in research/object_detection/utils/visualization_utils.py and 1 other location - About 3 hrs to fix
                                      research/deeplab/export_model.py on lines 159..167

                                      Duplicated Code

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

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

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

                                      Tuning

                                      This issue has a mass of 65.

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

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

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

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

                                      Refactorings

                                      Further Reading

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

                                        if use_normalized_coordinates:
                                          (left, right, top, bottom) = (xmin * im_width, xmax * im_width,
                                                                        ymin * im_height, ymax * im_height)
                                        else:
                                          (left, right, top, bottom) = (xmin, xmax, ymin, ymax)
                                      Severity: Major
                                      Found in research/object_detection/utils/visualization_utils.py and 1 other location - About 2 hrs to fix
                                      research/cognitive_planning/visualization_utils.py on lines 166..170

                                      Duplicated Code

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

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

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

                                      Tuning

                                      This issue has a mass of 59.

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

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

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

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

                                      Refactorings

                                      Further Reading

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

                                      def save_image_array_as_png(image, output_path):
                                        """Saves an image (represented as a numpy array) to PNG.
                                      
                                        Args:
                                          image: a numpy array with shape [height, width, 3].
                                      Severity: Major
                                      Found in research/object_detection/utils/visualization_utils.py and 1 other location - About 2 hrs to fix
                                      research/cognitive_planning/visualization_utils.py on lines 67..76

                                      Duplicated Code

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

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

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

                                      Tuning

                                      This issue has a mass of 58.

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

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

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

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

                                      Refactorings

                                      Further Reading

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

                                      def draw_bounding_boxes_on_image_array(image,
                                                                             boxes,
                                                                             color='red',
                                                                             thickness=4,
                                                                             display_str_list_list=()):
                                      Severity: Major
                                      Found in research/object_detection/utils/visualization_utils.py and 1 other location - About 2 hrs to fix
                                      research/cognitive_planning/visualization_utils.py on lines 205..230

                                      Duplicated Code

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

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

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

                                      Tuning

                                      This issue has a mass of 55.

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

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

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

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

                                      Refactorings

                                      Further Reading

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

                                        if use_normalized_coordinates:
                                          keypoints_x = tuple([im_width * x for x in keypoints_x])
                                          keypoints_y = tuple([im_height * y for y in keypoints_y])
                                      Severity: Major
                                      Found in research/object_detection/utils/visualization_utils.py and 1 other location - About 2 hrs to fix
                                      research/cognitive_planning/visualization_utils.py on lines 499..501

                                      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

                                          if input_data_fields.groundtruth_instance_masks in eval_dict:
                                            groundtruth_instance_masks = tf.cast(
                                                tf.expand_dims(
                                                    eval_dict[input_data_fields.groundtruth_instance_masks][indx],
                                                    axis=0), tf.uint8)
                                      Severity: Major
                                      Found in research/object_detection/utils/visualization_utils.py and 1 other location - About 2 hrs to fix
                                      research/object_detection/utils/visualization_utils.py on lines 674..678

                                      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

                                          if detection_fields.detection_masks in eval_dict:
                                            instance_masks = tf.cast(
                                                tf.expand_dims(
                                                    eval_dict[detection_fields.detection_masks][indx], axis=0),
                                                tf.uint8)
                                      Severity: Major
                                      Found in research/object_detection/utils/visualization_utils.py and 1 other location - About 2 hrs to fix
                                      research/object_detection/utils/visualization_utils.py on lines 694..698

                                      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

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

                                          if valid:
                                            draw.ellipse([(keypoint_x - radius, keypoint_y - radius),
                                                          (keypoint_x + radius, keypoint_y + radius)],
                                      Severity: Major
                                      Found in research/object_detection/utils/visualization_utils.py and 1 other location - About 1 hr to fix
                                      research/cognitive_planning/visualization_utils.py on lines 502..504

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

                                      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 gt_kpt_vis_fld in eval_dict:
                                              groundtruth_keypoint_scores = tf.expand_dims(
                                                  tf.cast(eval_dict[gt_kpt_vis_fld][indx], dtype=tf.float32), axis=0)
                                            else:
                                              groundtruth_keypoint_scores = tf.expand_dims(tf.cast(
                                      Severity: Major
                                      Found in research/object_detection/utils/visualization_utils.py and 1 other location - About 1 hr to fix
                                      research/object_detection/utils/visualization_utils.py on lines 684..691

                                      Duplicated Code

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

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

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

                                      Tuning

                                      This issue has a mass of 47.

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

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

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

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

                                      Refactorings

                                      Further Reading

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

                                            if detection_fields.detection_keypoint_scores in eval_dict:
                                              keypoint_scores = tf.expand_dims(
                                                  eval_dict[detection_fields.detection_keypoint_scores][indx], axis=0)
                                            else:
                                              keypoint_scores = tf.expand_dims(tf.cast(
                                      Severity: Major
                                      Found in research/object_detection/utils/visualization_utils.py and 1 other location - About 1 hr to fix
                                      research/object_detection/utils/visualization_utils.py on lines 705..712

                                      Duplicated Code

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

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

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

                                      Tuning

                                      This issue has a mass of 47.

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

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

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

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

                                      Refactorings

                                      Further Reading

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

                                        if image.shape[:2] != mask.shape:
                                          raise ValueError('The image has spatial dimensions %s but the mask has '
                                                           'dimensions %s' % (image.shape[:2], mask.shape))
                                      Severity: Major
                                      Found in research/object_detection/utils/visualization_utils.py and 4 other locations - About 1 hr to fix
                                      research/cognitive_planning/visualization_utils.py on lines 527..529
                                      research/object_detection/utils/visualization_utils.py on lines 1046..1048
                                      research/object_detection/utils/visualization_utils.py on lines 1085..1087
                                      research/object_detection/utils/visualization_utils.py on lines 1088..1090

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

                                        if image.shape[:2] != channel.shape:
                                          raise ValueError('The image has spatial dimensions %s but the channel has '
                                                           'dimensions %s' % (image.shape[:2], channel.shape))
                                      Severity: Major
                                      Found in research/object_detection/utils/visualization_utils.py and 4 other locations - About 1 hr to fix
                                      research/cognitive_planning/visualization_utils.py on lines 527..529
                                      research/object_detection/utils/visualization_utils.py on lines 1014..1016
                                      research/object_detection/utils/visualization_utils.py on lines 1046..1048
                                      research/object_detection/utils/visualization_utils.py on lines 1088..1090

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

                                        if image.shape[:2] != mask.shape:
                                          raise ValueError('The image has spatial dimensions %s but the mask has '
                                                           'dimensions %s' % (image.shape[:2], mask.shape))
                                      Severity: Major
                                      Found in research/object_detection/utils/visualization_utils.py and 4 other locations - About 1 hr to fix
                                      research/cognitive_planning/visualization_utils.py on lines 527..529
                                      research/object_detection/utils/visualization_utils.py on lines 1014..1016
                                      research/object_detection/utils/visualization_utils.py on lines 1085..1087
                                      research/object_detection/utils/visualization_utils.py on lines 1088..1090

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

                                        if image.shape[:2] != mask.shape:
                                          raise ValueError('The image has spatial dimensions %s but the mask has '
                                                           'dimensions %s' % (image.shape[:2], mask.shape))
                                      Severity: Major
                                      Found in research/object_detection/utils/visualization_utils.py and 4 other locations - About 1 hr to fix
                                      research/cognitive_planning/visualization_utils.py on lines 527..529
                                      research/object_detection/utils/visualization_utils.py on lines 1014..1016
                                      research/object_detection/utils/visualization_utils.py on lines 1046..1048
                                      research/object_detection/utils/visualization_utils.py on lines 1085..1087

                                      Duplicated Code

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

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

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

                                      Tuning

                                      This issue has a mass of 46.

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

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

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

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

                                      Refactorings

                                      Further Reading

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

                                          draw.rectangle(
                                              [(left, text_bottom - text_height - 2 * margin), (left + text_width,
                                                                                                text_bottom)],
                                      Severity: Major
                                      Found in research/object_detection/utils/visualization_utils.py and 1 other location - About 1 hr to fix
                                      research/cognitive_planning/visualization_utils.py on lines 193..195

                                      Duplicated Code

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

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

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

                                      Tuning

                                      This issue has a mass of 46.

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

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

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

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

                                      Refactorings

                                      Further Reading

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

                                        if original_image_spatial_shape is None:
                                          original_shapes = tf.constant(-1, shape=[images.shape.as_list()[0], 2])
                                        else:
                                          original_shapes = original_image_spatial_shape
                                      Severity: Major
                                      Found in research/object_detection/utils/visualization_utils.py and 1 other location - About 1 hr to fix
                                      research/object_detection/utils/visualization_utils.py on lines 581..584

                                      Duplicated Code

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

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

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

                                      Tuning

                                      This issue has a mass of 46.

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

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

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

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

                                      Refactorings

                                      Further Reading

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

                                        if true_image_shape is None:
                                          true_shapes = tf.constant(-1, shape=[images.shape.as_list()[0], 3])
                                        else:
                                          true_shapes = true_image_shape
                                      Severity: Major
                                      Found in research/object_detection/utils/visualization_utils.py and 1 other location - About 1 hr to fix
                                      research/object_detection/utils/visualization_utils.py on lines 585..588

                                      Duplicated Code

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

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

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

                                      Tuning

                                      This issue has a mass of 46.

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

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

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

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

                                      Refactorings

                                      Further Reading

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

                                        solid_color = np.expand_dims(
                                            np.ones_like(mask), axis=2) * np.reshape(list(rgb), [1, 1, 3])
                                      Severity: Major
                                      Found in research/object_detection/utils/visualization_utils.py and 1 other location - About 1 hr to fix
                                      research/cognitive_planning/visualization_utils.py on lines 533..534

                                      Duplicated Code

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

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

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

                                      Tuning

                                      This issue has a mass of 42.

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

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

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

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

                                      Refactorings

                                      Further Reading

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

                                        pil_mask = Image.fromarray(np.uint8(255.0 * alpha * (mask > 0))).convert('L')
                                      Severity: Major
                                      Found in research/object_detection/utils/visualization_utils.py and 2 other locations - About 1 hr to fix
                                      research/object_detection/utils/visualization_utils.py on lines 1023..1023
                                      research/object_detection/utils/visualization_utils.py on lines 1057..1057

                                      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

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

                                        pil_mask = Image.fromarray(np.uint8(255.0*alpha*(mask > 0))).convert('L')
                                      Severity: Major
                                      Found in research/object_detection/utils/visualization_utils.py and 2 other locations - About 1 hr to fix
                                      research/object_detection/utils/visualization_utils.py on lines 1057..1057
                                      research/object_detection/utils/visualization_utils.py on lines 1097..1097

                                      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

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

                                        pil_mask = Image.fromarray(np.uint8(255.0 * alpha * (mask > 0))).convert('L')
                                      Severity: Major
                                      Found in research/object_detection/utils/visualization_utils.py and 2 other locations - About 1 hr to fix
                                      research/object_detection/utils/visualization_utils.py on lines 1023..1023
                                      research/object_detection/utils/visualization_utils.py on lines 1097..1097

                                      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

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

                                          image = np.fromstring(fig.canvas.tostring_rgb(), dtype='uint8').reshape(
                                              1, int(height), int(width), 3)
                                      Severity: Major
                                      Found in research/object_detection/utils/visualization_utils.py and 3 other locations - About 1 hr to fix
                                      research/cognitive_planning/visualization_utils.py on lines 700..701
                                      research/cognitive_planning/visualization_utils.py on lines 728..730
                                      research/object_detection/utils/visualization_utils.py on lines 1332..1334

                                      Duplicated Code

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

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

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

                                      Tuning

                                      This issue has a mass of 38.

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

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

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

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

                                      Refactorings

                                      Further Reading

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

                                          image = np.fromstring(
                                              fig.canvas.tostring_rgb(), dtype='uint8').reshape(
                                                  1, int(height), int(width), 3)
                                      Severity: Major
                                      Found in research/object_detection/utils/visualization_utils.py and 3 other locations - About 1 hr to fix
                                      research/cognitive_planning/visualization_utils.py on lines 700..701
                                      research/cognitive_planning/visualization_utils.py on lines 728..730
                                      research/object_detection/utils/visualization_utils.py on lines 1304..1305

                                      Duplicated Code

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

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

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

                                      Tuning

                                      This issue has a mass of 38.

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

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

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

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

                                      Refactorings

                                      Further Reading

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

                                          draw.text(
                                              (left + margin, text_bottom - text_height - margin),
                                              display_str,
                                      Severity: Major
                                      Found in research/object_detection/utils/visualization_utils.py and 1 other location - About 1 hr to fix
                                      research/cognitive_planning/visualization_utils.py on lines 197..199

                                      Duplicated Code

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

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

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

                                      Tuning

                                      This issue has a mass of 38.

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

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

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

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

                                      Refactorings

                                      Further Reading

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

                                        if thickness > 0:
                                          draw.line([(left, top), (left, bottom), (right, bottom), (right, top),
                                                     (left, top)],
                                      Severity: Minor
                                      Found in research/object_detection/utils/visualization_utils.py and 1 other location - About 55 mins to fix
                                      research/cognitive_planning/visualization_utils.py on lines 171..172

                                      Duplicated Code

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

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

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

                                      Tuning

                                      This issue has a mass of 37.

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

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

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

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

                                      Refactorings

                                      Further Reading

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

                                              elif track_ids is not None:
                                                prime_multipler = _get_multiplier_for_color_randomness()
                                                box_to_color_map[box] = STANDARD_COLORS[
                                                    (prime_multipler * track_ids[i]) % len(STANDARD_COLORS)]
                                              else:
                                      Severity: Minor
                                      Found in research/object_detection/utils/visualization_utils.py and 1 other location - About 35 mins to fix
                                      research/cognitive_planning/visualization_utils.py on lines 633..637

                                      Duplicated Code

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

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

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

                                      Tuning

                                      This issue has a mass of 33.

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

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

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

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

                                      Refactorings

                                      Further Reading

                                      There are no issues that match your filters.

                                      Category
                                      Status