tensorflow/models

View on GitHub
research/cognitive_planning/visualization_utils.py

Summary

Maintainability
F
1 wk
Test Coverage

File visualization_utils.py has 630 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/cognitive_planning/visualization_utils.py - About 1 day to fix

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

    def visualize_boxes_and_labels_on_image_array(
        image,
        boxes,
        classes,
        scores,
    Severity: Minor
    Found in research/cognitive_planning/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 visualize_boxes_and_labels_on_image_array has 16 arguments (exceeds 4 allowed). Consider refactoring.
    Open

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

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

      def draw_bounding_boxes_on_image_tensors(images,
      Severity: Major
      Found in research/cognitive_planning/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/cognitive_planning/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/cognitive_planning/visualization_utils.py - About 1 hr to fix

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

            def _visualize_boxes_and_masks_and_keypoints(
            Severity: Major
            Found in research/cognitive_planning/visualization_utils.py - About 1 hr to fix

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

              def _visualize_boxes_and_keypoints(image, boxes, classes, scores, keypoints,
              Severity: Major
              Found in research/cognitive_planning/visualization_utils.py - About 50 mins to fix

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

                def _visualize_boxes_and_masks(image, boxes, classes, scores, masks,
                Severity: Major
                Found in research/cognitive_planning/visualization_utils.py - About 50 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

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

                    Avoid deeply nested control flow statements.
                    Open

                              if not display_str:
                                display_str = '{}%'.format(int(100*scores[i]))
                              else:
                                display_str = '{}: {}%'.format(display_str, int(100*scores[i]))
                            box_to_display_str_map[box].append(display_str)
                    Severity: Major
                    Found in research/cognitive_planning/visualization_utils.py - About 45 mins to fix

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

                      def _visualize_boxes(image, boxes, classes, scores, category_index, **kwargs):
                      Severity: Minor
                      Found in research/cognitive_planning/visualization_utils.py - About 45 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/cognitive_planning/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/cognitive_planning/visualization_utils.py - About 35 mins to fix

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

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

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

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

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

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

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

                                  def draw_bounding_box_on_image(image,
                                                                 ymin,
                                                                 xmin,
                                                                 ymax,
                                                                 xmax,
                                  Severity: Minor
                                  Found in research/cognitive_planning/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/cognitive_planning/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/cognitive_planning/visualization_utils.py and 1 other location - About 1 day to fix
                                  research/object_detection/utils/visualization_utils.py on lines 272..304

                                  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/cognitive_planning/visualization_utils.py and 1 other location - About 1 day to fix
                                  research/object_detection/utils/visualization_utils.py on lines 47..70

                                  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/cognitive_planning/visualization_utils.py and 1 other location - About 4 hrs to fix
                                  research/object_detection/utils/visualization_utils.py on lines 131..163

                                  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(int(100*scores[i]))
                                            else:
                                              display_str = '{}: {}%'.format(display_str, int(100*scores[i]))
                                  Severity: Major
                                  Found in research/cognitive_planning/visualization_utils.py and 1 other location - About 3 hrs to fix
                                  research/object_detection/utils/visualization_utils.py on lines 1213..1217

                                  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

                                  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/cognitive_planning/visualization_utils.py and 1 other location - About 3 hrs to fix
                                  research/object_detection/utils/visualization_utils.py on lines 114..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 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

                                  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/cognitive_planning/visualization_utils.py and 1 other location - About 2 hrs to fix
                                  research/object_detection/utils/visualization_utils.py on lines 201..205

                                  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/cognitive_planning/visualization_utils.py and 1 other location - About 2 hrs to fix
                                  research/object_detection/utils/visualization_utils.py on lines 102..111

                                  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/cognitive_planning/visualization_utils.py and 1 other location - About 2 hrs to fix
                                  research/object_detection/utils/visualization_utils.py on lines 244..269

                                  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/cognitive_planning/visualization_utils.py and 1 other location - About 2 hrs to fix
                                  research/object_detection/utils/visualization_utils.py on lines 965..967

                                  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

                                    for keypoint_x, keypoint_y in zip(keypoints_x, keypoints_y):
                                      draw.ellipse([(keypoint_x - radius, keypoint_y - radius),
                                                    (keypoint_x + radius, keypoint_y + radius)],
                                  Severity: Major
                                  Found in research/cognitive_planning/visualization_utils.py and 1 other location - About 1 hr to fix
                                  research/object_detection/utils/visualization_utils.py on lines 978..980

                                  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 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/cognitive_planning/visualization_utils.py and 4 other locations - About 1 hr to fix
                                  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
                                  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

                                  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/cognitive_planning/visualization_utils.py and 1 other location - About 1 hr to fix
                                  research/object_detection/utils/visualization_utils.py on lines 232..234

                                  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 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], axis=0),
                                          tf.uint8)
                                  Severity: Major
                                  Found in research/cognitive_planning/visualization_utils.py and 1 other location - About 1 hr to fix
                                  research/cognitive_planning/visualization_utils.py on lines 416..419

                                  Duplicated Code

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

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

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

                                  Tuning

                                  This issue has a mass of 44.

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

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

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

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

                                  Refactorings

                                  Further Reading

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

                                    if detection_fields.detection_masks in eval_dict:
                                      instance_masks = tf.cast(
                                          tf.expand_dims(eval_dict[detection_fields.detection_masks], axis=0),
                                          tf.uint8)
                                  Severity: Major
                                  Found in research/cognitive_planning/visualization_utils.py and 1 other location - About 1 hr to fix
                                  research/cognitive_planning/visualization_utils.py on lines 425..429

                                  Duplicated Code

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

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

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

                                  Tuning

                                  This issue has a mass of 44.

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

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

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

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

                                  Refactorings

                                  Further Reading

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

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

                                  Duplicated Code

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

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

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

                                  Tuning

                                  This issue has a mass of 42.

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

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

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

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

                                  Refactorings

                                  Further Reading

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

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

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

                                  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.line([(left, top), (left, bottom), (right, bottom),
                                               (right, top), (left, top)], width=thickness, fill=color)
                                  Severity: Minor
                                  Found in research/cognitive_planning/visualization_utils.py and 1 other location - About 55 mins to fix
                                  research/object_detection/utils/visualization_utils.py on lines 206..208

                                  Duplicated Code

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

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

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

                                  Tuning

                                  This issue has a mass of 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

                                          if agnostic_mode:
                                            box_to_color_map[box] = 'DarkOrange'
                                          else:
                                            box_to_color_map[box] = STANDARD_COLORS[
                                                classes[i] % len(STANDARD_COLORS)]
                                  Severity: Minor
                                  Found in research/cognitive_planning/visualization_utils.py and 1 other location - About 35 mins to fix
                                  research/object_detection/utils/visualization_utils.py on lines 1226..1232

                                  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