tensorflow/models

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

Summary

Maintainability
F
1 mo
Test Coverage

File box_list_ops.py has 994 lines of code (exceeds 250 allowed). Consider refactoring.
Open

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

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

    def concatenate(boxlists, fields=None, scope=None):
      """Concatenate list of BoxLists.
    
      This op concatenates a list of input BoxLists into a larger BoxList.  It also
      handles concatenation of BoxList fields as long as the field tensor shapes
    Severity: Minor
    Found in research/object_detection/core/box_list_ops.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 boolean_mask has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

    def boolean_mask(boxlist, indicator, fields=None, scope=None,
                     use_static_shapes=False, indicator_sum=None):
      """Select boxes from BoxList according to indicator and return new BoxList.
    
      `boolean_mask` returns the subset of boxes that are marked as "True" by the
    Severity: Minor
    Found in research/object_detection/core/box_list_ops.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 boolean_mask has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def boolean_mask(boxlist, indicator, fields=None, scope=None,
    Severity: Minor
    Found in research/object_detection/core/box_list_ops.py - About 45 mins to fix

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

      def to_absolute_coordinates(boxlist,
      Severity: Minor
      Found in research/object_detection/core/box_list_ops.py - About 45 mins to fix

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

        def gather(boxlist, indices, fields=None, scope=None, use_static_shapes=False):
        Severity: Minor
        Found in research/object_detection/core/box_list_ops.py - About 35 mins to fix

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

          def refine_boxes_multi_class(pool_boxes,
          Severity: Minor
          Found in research/object_detection/core/box_list_ops.py - About 35 mins to fix

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

            def to_normalized_coordinates(boxlist, height, width,
            Severity: Minor
            Found in research/object_detection/core/box_list_ops.py - About 35 mins to fix

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

              def gather(boxlist, indices, fields=None, scope=None, use_static_shapes=False):
                """Gather boxes from BoxList according to indices and return new BoxList.
              
                By default, `gather` returns boxes corresponding to the input index list, as
                well as all additional fields stored in the boxlist (indexing into the
              Severity: Minor
              Found in research/object_detection/core/box_list_ops.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 refine_boxes_multi_class has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              def refine_boxes_multi_class(pool_boxes,
                                           num_classes,
                                           nms_iou_thresh,
                                           nms_max_detections,
                                           voting_iou_thresh=0.5):
              Severity: Minor
              Found in research/object_detection/core/box_list_ops.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

                with tf.name_scope(scope, 'SampleBoxesByJittering'):
                  num_boxes = boxlist.num_boxes()
                  box_indices = tf.random_uniform(
                      [num_boxes_to_sample],
                      minval=0,
              Severity: Major
              Found in research/object_detection/core/box_list_ops.py and 1 other location - About 3 days to fix
              official/vision/utils/object_detection/box_list_ops.py on lines 1070..1091

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

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

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

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

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

              Refactorings

              Further Reading

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

                with tf.name_scope(scope, 'BooleanMask'):
                  if indicator.shape.ndims != 1:
                    raise ValueError('indicator should have rank 1')
                  if indicator.dtype != tf.bool:
                    raise ValueError('indicator should be a boolean tensor')
              Severity: Major
              Found in research/object_detection/core/box_list_ops.py and 1 other location - About 3 days to fix
              official/vision/utils/object_detection/box_list_ops.py on lines 466..496

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

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

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

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

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

              Refactorings

              Further Reading

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

                with tf.name_scope(scope, 'Concatenate'):
                  if not isinstance(boxlists, list):
                    raise ValueError('boxlists should be a list')
                  if not boxlists:
                    raise ValueError('boxlists should have nonzero length')
              Severity: Major
              Found in research/object_detection/core/box_list_ops.py and 1 other location - About 2 days to fix
              official/vision/utils/object_detection/box_list_ops.py on lines 565..594

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

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

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

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

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

              Refactorings

              Further Reading

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

                with tf.name_scope(scope, 'ClipToWindow'):
                  y_min, x_min, y_max, x_max = tf.split(
                      value=boxlist.get(), num_or_size_splits=4, axis=1)
                  win_y_min = window[0]
                  win_x_min = window[1]
              Severity: Major
              Found in research/object_detection/core/box_list_ops.py and 1 other location - About 2 days to fix
              official/projects/centernet/ops/box_list_ops.py on lines 224..244

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

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

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

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

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

              Refactorings

              Further Reading

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

                with tf.name_scope(scope, 'Gather'):
                  if len(indices.shape.as_list()) != 1:
                    raise ValueError('indices should have rank 1')
                  if indices.dtype != tf.int32 and indices.dtype != tf.int64:
                    raise ValueError('indices should be an int32 / int64 tensor')
              Severity: Major
              Found in research/object_detection/core/box_list_ops.py and 1 other location - About 1 day to fix
              official/vision/utils/object_detection/box_list_ops.py on lines 524..541

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

              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 refine_boxes_multi_class(pool_boxes,
                                           num_classes,
                                           nms_iou_thresh,
                                           nms_max_detections,
                                           voting_iou_thresh=0.5):
              Severity: Major
              Found in research/object_detection/core/box_list_ops.py and 1 other location - About 1 day to fix
              official/vision/utils/object_detection/box_list_ops.py on lines 863..906

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

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

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

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

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

              Refactorings

              Further Reading

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

                with tf.name_scope(scope, 'SortByField'):
                  if order != SortOrder.descend and order != SortOrder.ascend:
                    raise ValueError('Invalid sort order')
              
                  field_to_sort = boxlist.get_field(field)
              Severity: Major
              Found in research/object_detection/core/box_list_ops.py and 1 other location - About 1 day to fix
              official/vision/utils/object_detection/box_list_ops.py on lines 615..635

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

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

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

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

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

              Refactorings

              Further Reading

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

                with tf.name_scope(scope, 'CreateCoverageBox'):
                  num_boxes = boxlist.num_boxes()
              
                  def coverage_box(bboxes):
                    y_min, x_min, y_max, x_max = tf.split(
              Severity: Major
              Found in research/object_detection/core/box_list_ops.py and 1 other location - About 1 day to fix
              official/vision/utils/object_detection/box_list_ops.py on lines 1026..1044

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

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

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

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

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

              Refactorings

              Further Reading

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

                with tf.name_scope(scope, 'FilterGreaterThan'):
                  if not isinstance(boxlist, box_list.BoxList):
                    raise ValueError('boxlist must be a BoxList')
                  if not boxlist.has_field('scores'):
                    raise ValueError('input boxlist must have \'scores\' field')
              Severity: Major
              Found in research/object_detection/core/box_list_ops.py and 1 other location - About 1 day to fix
              official/vision/utils/object_detection/box_list_ops.py on lines 713..726

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

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

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

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

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

              Refactorings

              Further Reading

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

                with tf.name_scope(scope, 'Intersection'):
                  y_min1, x_min1, y_max1, x_max1 = tf.split(
                      value=boxlist1.get(), num_or_size_splits=4, axis=1)
                  y_min2, x_min2, y_max2, x_max2 = tf.split(
                      value=boxlist2.get(), num_or_size_splits=4, axis=1)
              Severity: Major
              Found in research/object_detection/core/box_list_ops.py and 1 other location - About 1 day to fix
              official/vision/utils/object_detection/box_list_ops.py on lines 223..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 174.

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

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

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

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

              Refactorings

              Further Reading

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

                with tf.name_scope(scope, 'MatchedIntersection'):
                  y_min1, x_min1, y_max1, x_max1 = tf.split(
                      value=boxlist1.get(), num_or_size_splits=4, axis=1)
                  y_min2, x_min2, y_max2, x_max2 = tf.split(
                      value=boxlist2.get(), num_or_size_splits=4, axis=1)
              Severity: Major
              Found in research/object_detection/core/box_list_ops.py and 1 other location - About 1 day to fix
              official/vision/utils/object_detection/box_list_ops.py on lines 248..259

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

              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 prune_outside_window(boxlist, window, scope=None):
                """Prunes bounding boxes that fall outside a given window.
              
                This function prunes bounding boxes that even partially fall outside the given
                window. See also clip_to_window which only prunes bounding boxes that fall
              Severity: Major
              Found in research/object_detection/core/box_list_ops.py and 1 other location - About 1 day to fix
              research/object_detection/core/box_list_ops.py on lines 206..235

              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

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

              def prune_completely_outside_window(boxlist, window, scope=None):
                """Prunes bounding boxes that fall completely outside of the given window.
              
                The function clip_to_window prunes bounding boxes that fall
                completely outside the window, but also clips any bounding boxes that
              Severity: Major
              Found in research/object_detection/core/box_list_ops.py and 1 other location - About 1 day to fix
              research/object_detection/core/box_list_ops.py on lines 174..203

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

                with tf.name_scope(scope, 'Scale'):
                  y_scale = tf.cast(y_scale, tf.float32)
                  x_scale = tf.cast(x_scale, tf.float32)
                  y_min, x_min, y_max, x_max = tf.split(
                      value=boxlist.get(), num_or_size_splits=4, axis=1)
              Severity: Major
              Found in research/object_detection/core/box_list_ops.py and 3 other locations - About 1 day to fix
              official/projects/centernet/ops/box_list_ops.py on lines 49..60
              official/vision/utils/object_detection/box_list_ops.py on lines 92..103
              official/vision/utils/object_detection/preprocessor.py on lines 457..468

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

                with tf.name_scope(scope, 'ChangeCoordinateFrame'):
                  win_height = window[2] - window[0]
                  win_width = window[3] - window[1]
                  boxlist_new = scale(box_list.BoxList(
                      boxlist.get() - [window[0], window[1], window[0], window[1]]),
              Severity: Major
              Found in research/object_detection/core/box_list_ops.py and 2 other locations - About 1 day to fix
              official/projects/centernet/ops/box_list_ops.py on lines 97..104
              official/vision/utils/object_detection/box_list_ops.py on lines 394..402

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

              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 refine_boxes(pool_boxes,
                               nms_iou_thresh,
                               nms_max_detections,
                               voting_iou_thresh=0.5):
                """Refines a pool of boxes using non max suppression and box voting.
              Severity: Major
              Found in research/object_detection/core/box_list_ops.py and 1 other location - About 1 day to fix
              official/vision/utils/object_detection/box_list_ops.py on lines 909..942

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

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

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

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

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

              Refactorings

              Further Reading

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

                with tf.name_scope(scope, 'VisualizeBoxesInImage'):
                  if not normalized:
                    height, width, _ = tf.unstack(tf.shape(image))
                    boxlist = scale(boxlist,
                                    1.0 / tf.cast(height, tf.float32),
              Severity: Major
              Found in research/object_detection/core/box_list_ops.py and 1 other location - About 7 hrs to fix
              official/vision/utils/object_detection/box_list_ops.py on lines 656..663

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

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

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

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

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

              Refactorings

              Further Reading

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

                with tf.name_scope(scope, 'ToNormalizedCoordinates'):
                  height = tf.cast(height, tf.float32)
                  width = tf.cast(width, tf.float32)
              
                  if check_range:
              Severity: Major
              Found in research/object_detection/core/box_list_ops.py and 1 other location - About 7 hrs to fix
              official/vision/utils/object_detection/box_list_ops.py on lines 805..817

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

              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

                with tf.name_scope(scope, 'ToAbsoluteCoordinates'):
                  height = tf.cast(height, tf.float32)
                  width = tf.cast(width, tf.float32)
              
                  # Ensure range of input boxes is correct.
              Severity: Major
              Found in research/object_detection/core/box_list_ops.py and 2 other locations - About 6 hrs to fix
              official/projects/centernet/ops/box_list_ops.py on lines 336..350
              official/vision/utils/object_detection/box_list_ops.py on lines 845..860

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

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

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

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

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

              Refactorings

              Further Reading

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

                with tf.name_scope(scope, 'SqDist'):
                  sqnorm1 = tf.reduce_sum(tf.square(boxlist1.get()), 1, keep_dims=True)
                  sqnorm2 = tf.reduce_sum(tf.square(boxlist2.get()), 1, keep_dims=True)
                  innerprod = tf.matmul(boxlist1.get(), boxlist2.get(),
                                        transpose_a=False, transpose_b=True)
              Severity: Major
              Found in research/object_detection/core/box_list_ops.py and 1 other location - About 6 hrs to fix
              official/vision/utils/object_detection/box_list_ops.py on lines 426..431

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

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

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

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

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

              Refactorings

              Further Reading

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

                with tf.name_scope(scope, 'NonMaxSuppression'):
                  if not 0 <= thresh <= 1.0:
                    raise ValueError('thresh must be between 0 and 1')
                  if not isinstance(boxlist, box_list.BoxList):
                    raise ValueError('boxlist must be a BoxList')
              Severity: Major
              Found in research/object_detection/core/box_list_ops.py and 1 other location - About 6 hrs to fix
              official/vision/utils/object_detection/box_list_ops.py on lines 749..761

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

              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

                with tf.name_scope(scope, 'IOU'):
                  intersections = intersection(boxlist1, boxlist2)
                  areas1 = area(boxlist1)
                  areas2 = area(boxlist2)
                  unions = (
              Severity: Major
              Found in research/object_detection/core/box_list_ops.py and 2 other locations - About 5 hrs to fix
              official/vision/utils/object_detection/box_list_ops.py on lines 273..281
              official/vision/utils/object_detection/region_similarity_calculator.py on lines 84..92

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

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

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

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

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

              Refactorings

              Further Reading

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

                with tf.name_scope(scope, 'FilterFieldValueEquals'):
                  if not isinstance(boxlist, box_list.BoxList):
                    raise ValueError('boxlist must be a BoxList')
                  if not boxlist.has_field(field):
                    raise ValueError('boxlist must contain the specified field')
              Severity: Major
              Found in research/object_detection/core/box_list_ops.py and 1 other location - About 5 hrs to fix
              official/vision/utils/object_detection/box_list_ops.py on lines 682..689

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

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

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

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

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

              Refactorings

              Further Reading

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

                with tf.name_scope(scope, 'PruneNonOverlappingBoxes'):
                  ioa_ = ioa(boxlist2, boxlist1)  # [M, N] tensor
                  ioa_ = tf.reduce_max(ioa_, reduction_indices=[0])  # [N] tensor
                  keep_bool = tf.greater_equal(ioa_, tf.constant(min_overlap))
                  keep_inds = tf.squeeze(tf.where(keep_bool), axis=[1])
              Severity: Major
              Found in research/object_detection/core/box_list_ops.py and 1 other location - About 4 hrs to fix
              official/vision/utils/object_detection/box_list_ops.py on lines 347..353

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

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

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

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

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

              Refactorings

              Further Reading

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

                with tf.name_scope(scope, 'MatchedIOU'):
                  intersections = matched_intersection(boxlist1, boxlist2)
                  areas1 = area(boxlist1)
                  areas2 = area(boxlist2)
                  unions = areas1 + areas2 - intersections
              Severity: Major
              Found in research/object_detection/core/box_list_ops.py and 1 other location - About 4 hrs to fix
              official/vision/utils/object_detection/box_list_ops.py on lines 295..302

              Duplicated Code

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

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

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

              Tuning

              This issue has a mass of 77.

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

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

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

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

              Refactorings

              Further Reading

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

                with tf.name_scope(scope, 'HeightWidth'):
                  y_min, x_min, y_max, x_max = tf.split(
                      value=boxlist.get(), num_or_size_splits=4, axis=1)
                  return tf.squeeze(y_max - y_min, [1]), tf.squeeze(x_max - x_min, [1])
              Severity: Major
              Found in research/object_detection/core/box_list_ops.py and 2 other locations - About 3 hrs to fix
              official/projects/centernet/ops/box_list_ops.py on lines 257..260
              official/vision/utils/object_detection/box_list_ops.py on lines 74..77

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

                with tf.name_scope(scope, 'PruneSmallBoxes'):
                  height, width = height_width(boxlist)
                  is_valid = tf.logical_and(tf.greater_equal(width, min_side),
                                            tf.greater_equal(height, min_side))
                  return gather(boxlist, tf.reshape(tf.where(is_valid), [-1]))
              Severity: Major
              Found in research/object_detection/core/box_list_ops.py and 2 other locations - About 3 hrs to fix
              official/projects/centernet/ops/box_list_ops.py on lines 273..277
              official/vision/utils/object_detection/box_list_ops.py on lines 367..371

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

              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

                with tf.name_scope(scope, 'Area'):
                  y_min, x_min, y_max, x_max = tf.split(
                      value=boxlist.get(), num_or_size_splits=4, axis=1)
                  return tf.squeeze((y_max - y_min) * (x_max - x_min), [1])
              Severity: Major
              Found in research/object_detection/core/box_list_ops.py and 3 other locations - About 2 hrs to fix
              official/projects/centernet/ops/box_list_ops.py on lines 72..75
              official/vision/utils/object_detection/box_list_ops.py on lines 57..60
              official/vision/utils/object_detection/region_similarity_calculator.py on lines 38..41

              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

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

                  xcenters = tf.abs(tf.expand_dims(xcenter2, axis=0) - tf.expand_dims(
                      tf.transpose(xcenter1), axis=1))
              Severity: Major
              Found in research/object_detection/core/box_list_ops.py and 3 other locations - About 1 hr to fix
              research/object_detection/core/box_list_ops.py on lines 324..325
              research/object_detection/core/box_list_ops.py on lines 328..329
              research/object_detection/core/box_list_ops.py on lines 330..331

              Duplicated Code

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

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

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

              Tuning

              This issue has a mass of 43.

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

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

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

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

              Refactorings

              Further Reading

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

                  heights = tf.abs(tf.expand_dims(h2, axis=0) - tf.expand_dims(
                      tf.transpose(h1), axis=1))
              Severity: Major
              Found in research/object_detection/core/box_list_ops.py and 3 other locations - About 1 hr to fix
              research/object_detection/core/box_list_ops.py on lines 324..325
              research/object_detection/core/box_list_ops.py on lines 326..327
              research/object_detection/core/box_list_ops.py on lines 330..331

              Duplicated Code

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

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

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

              Tuning

              This issue has a mass of 43.

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

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

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

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

              Refactorings

              Further Reading

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

                  widths = tf.abs(tf.expand_dims(w2, axis=0) - tf.expand_dims(
                      tf.transpose(w1), axis=1))
              Severity: Major
              Found in research/object_detection/core/box_list_ops.py and 3 other locations - About 1 hr to fix
              research/object_detection/core/box_list_ops.py on lines 324..325
              research/object_detection/core/box_list_ops.py on lines 326..327
              research/object_detection/core/box_list_ops.py on lines 328..329

              Duplicated Code

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

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

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

              Tuning

              This issue has a mass of 43.

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

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

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

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

              Refactorings

              Further Reading

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

                  ycenters = tf.abs(tf.expand_dims(ycenter2, axis=0) - tf.expand_dims(
                      tf.transpose(ycenter1), axis=1))
              Severity: Major
              Found in research/object_detection/core/box_list_ops.py and 3 other locations - About 1 hr to fix
              research/object_detection/core/box_list_ops.py on lines 326..327
              research/object_detection/core/box_list_ops.py on lines 328..329
              research/object_detection/core/box_list_ops.py on lines 330..331

              Duplicated Code

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

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

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

              Tuning

              This issue has a mass of 43.

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

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

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

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

              Refactorings

              Further Reading

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

              def _copy_extra_fields(boxlist_to_copy_to, boxlist_to_copy_from):
                """Copies the extra fields of boxlist_to_copy_from to boxlist_to_copy_to.
              
                Args:
                  boxlist_to_copy_to: BoxList to which extra fields are copied.
              Severity: Major
              Found in research/object_detection/core/box_list_ops.py and 4 other locations - About 1 hr to fix
              official/projects/centernet/ops/box_list_ops.py on lines 23..35
              official/vision/utils/object_detection/box_list_ops.py on lines 764..776
              official/vision/utils/object_detection/preprocessor.py on lines 428..440
              research/object_detection/utils/np_box_list_ops.py on lines 545..557

              Duplicated Code

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

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

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

              Tuning

              This issue has a mass of 39.

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

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

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

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

              Refactorings

              Further Reading

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

                with tf.name_scope(scope, 'IOA'):
                  intersections = intersection(boxlist1, boxlist2)
                  areas = tf.expand_dims(area(boxlist2), 0)
                  return tf.truediv(intersections, areas)
              Severity: Minor
              Found in research/object_detection/core/box_list_ops.py and 1 other location - About 55 mins to fix
              official/vision/utils/object_detection/box_list_ops.py on lines 320..323

              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

              There are no issues that match your filters.

              Category
              Status