tensorflow/models

View on GitHub

Showing 11,634 of 11,634 total issues

Avoid deeply nested control flow statements.
Open

            if level == self._config_dict['min_level']:
              att_conv_name = '{}-conv_{}'.format(att_name, i)
              att_convs_i.append(conv_op(name=att_conv_name, **conv_kwargs))
            att_norm_name = '{}-conv-norm_{}_{}'.format(att_name, level, i)
Severity: Major
Found in official/projects/qat/vision/modeling/heads/dense_prediction_heads.py - About 45 mins to fix

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

      def __init__(self,
                   in_filters,
                   out_filters,
                   se_ratio,
                   divisible_by=1,
    Severity: Minor
    Found in official/projects/qat/vision/n_bit/nn_layers.py - About 45 mins to fix

    Cognitive Complexity

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

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

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

    Further reading

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

          rpn_box_encodings = tf.zeros(
              [batch_size,
               anchors.get_shape().as_list()[0],
               BOX_CODE_SIZE], dtype=tf.float32)
    research/object_detection/meta_architectures/faster_rcnn_meta_arch_test_lib.py on lines 1108..1110
    research/object_detection/meta_architectures/faster_rcnn_meta_arch_test_lib.py on lines 1412..1415
    research/object_detection/meta_architectures/faster_rcnn_meta_arch_test_lib.py on lines 1533..1536
    research/object_detection/meta_architectures/faster_rcnn_meta_arch_test_lib.py on lines 1631..1634
    research/object_detection/meta_architectures/faster_rcnn_meta_arch_test_lib.py on lines 1873..1876
    research/object_detection/meta_architectures/faster_rcnn_meta_arch_test_lib.py on lines 1965..1968

    Duplicated Code

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

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

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

    Tuning

    This issue has a mass of 35.

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

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

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

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

    Refactorings

    Further Reading

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

          rpn_box_encodings = tf.zeros(
              [batch_size,
               anchors.get_shape().as_list()[0],
               BOX_CODE_SIZE], dtype=tf.float32)
    research/object_detection/meta_architectures/faster_rcnn_meta_arch_test_lib.py on lines 1108..1110
    research/object_detection/meta_architectures/faster_rcnn_meta_arch_test_lib.py on lines 1352..1355
    research/object_detection/meta_architectures/faster_rcnn_meta_arch_test_lib.py on lines 1412..1415
    research/object_detection/meta_architectures/faster_rcnn_meta_arch_test_lib.py on lines 1533..1536
    research/object_detection/meta_architectures/faster_rcnn_meta_arch_test_lib.py on lines 1873..1876
    research/object_detection/meta_architectures/faster_rcnn_meta_arch_test_lib.py on lines 1965..1968

    Duplicated Code

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

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

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

    Tuning

    This issue has a mass of 35.

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

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

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

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

    Refactorings

    Further Reading

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

          rpn_box_encodings = tf.zeros(
              [batch_size,
               anchors.get_shape().as_list()[0],
               BOX_CODE_SIZE], dtype=tf.float32)
    research/object_detection/meta_architectures/faster_rcnn_meta_arch_test_lib.py on lines 1108..1110
    research/object_detection/meta_architectures/faster_rcnn_meta_arch_test_lib.py on lines 1352..1355
    research/object_detection/meta_architectures/faster_rcnn_meta_arch_test_lib.py on lines 1412..1415
    research/object_detection/meta_architectures/faster_rcnn_meta_arch_test_lib.py on lines 1533..1536
    research/object_detection/meta_architectures/faster_rcnn_meta_arch_test_lib.py on lines 1631..1634
    research/object_detection/meta_architectures/faster_rcnn_meta_arch_test_lib.py on lines 1965..1968

    Duplicated Code

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

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

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

    Tuning

    This issue has a mass of 35.

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

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

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

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

    Refactorings

    Further Reading

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

      def call(self,
    Severity: Minor
    Found in official/projects/longformer/longformer_attention.py - About 45 mins to fix

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

        def __init__(self,
                     in_filters,
                     out_filters,
                     se_ratio,
                     divisible_by=1,
      Severity: Minor
      Found in official/projects/qat/vision/modeling/layers/nn_layers.py - About 45 mins to fix

      Cognitive Complexity

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

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

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

      Further reading

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

            rpn_box_encodings = tf.zeros(
                [batch_size, anchors.get_shape().as_list()[0],
                 BOX_CODE_SIZE], dtype=tf.float32)
      research/object_detection/meta_architectures/faster_rcnn_meta_arch_test_lib.py on lines 1352..1355
      research/object_detection/meta_architectures/faster_rcnn_meta_arch_test_lib.py on lines 1412..1415
      research/object_detection/meta_architectures/faster_rcnn_meta_arch_test_lib.py on lines 1533..1536
      research/object_detection/meta_architectures/faster_rcnn_meta_arch_test_lib.py on lines 1631..1634
      research/object_detection/meta_architectures/faster_rcnn_meta_arch_test_lib.py on lines 1873..1876
      research/object_detection/meta_architectures/faster_rcnn_meta_arch_test_lib.py on lines 1965..1968

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 35.

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

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

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

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

      Refactorings

      Further Reading

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

            rpn_box_encodings = tf.zeros(
                [batch_size,
                 anchors.get_shape().as_list()[0],
                 BOX_CODE_SIZE], dtype=tf.float32)
      research/object_detection/meta_architectures/faster_rcnn_meta_arch_test_lib.py on lines 1108..1110
      research/object_detection/meta_architectures/faster_rcnn_meta_arch_test_lib.py on lines 1352..1355
      research/object_detection/meta_architectures/faster_rcnn_meta_arch_test_lib.py on lines 1412..1415
      research/object_detection/meta_architectures/faster_rcnn_meta_arch_test_lib.py on lines 1631..1634
      research/object_detection/meta_architectures/faster_rcnn_meta_arch_test_lib.py on lines 1873..1876
      research/object_detection/meta_architectures/faster_rcnn_meta_arch_test_lib.py on lines 1965..1968

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 35.

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

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

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

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

      Refactorings

      Further Reading

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

            rpn_box_encodings = tf.zeros(
                [batch_size,
                 anchors.get_shape().as_list()[0],
                 BOX_CODE_SIZE], dtype=tf.float32)
      research/object_detection/meta_architectures/faster_rcnn_meta_arch_test_lib.py on lines 1108..1110
      research/object_detection/meta_architectures/faster_rcnn_meta_arch_test_lib.py on lines 1352..1355
      research/object_detection/meta_architectures/faster_rcnn_meta_arch_test_lib.py on lines 1412..1415
      research/object_detection/meta_architectures/faster_rcnn_meta_arch_test_lib.py on lines 1533..1536
      research/object_detection/meta_architectures/faster_rcnn_meta_arch_test_lib.py on lines 1631..1634
      research/object_detection/meta_architectures/faster_rcnn_meta_arch_test_lib.py on lines 1873..1876

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 35.

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

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

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

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

      Refactorings

      Further Reading

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

        def __init__(self,
                     initial_value: Any,
                     filename: str,
                     write_value: bool = True):
          """Initializes the instance.
      Severity: Minor
      Found in orbit/actions/new_best_metric.py - About 45 mins to fix

      Cognitive Complexity

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

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

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

      Further reading

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

          if attention_initializer:
            self._attention_initializer = tf_keras.initializers.get(
                attention_initializer)
          else:
            self._attention_initializer = tf_utils.clone_initializer(
      Severity: Major
      Found in official/nlp/modeling/layers/tn_transformer_expand_condense.py and 4 other locations - About 45 mins to fix
      official/nlp/modeling/layers/reuse_transformer.py on lines 132..137
      official/nlp/modeling/layers/transformer.py on lines 234..239
      official/projects/detr/modeling/transformer.py on lines 235..240
      official/projects/detr/modeling/transformer.py on lines 656..661

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 35.

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

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

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

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

      Refactorings

      Further Reading

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

          self.assertAllClose(
              [0., 0.],
              seq_feature_dict['region/bbox/ymin'].feature[0].float_list.value[:])
      research/object_detection/dataset_tools/context_rcnn/add_context_to_examples_tf2_test.py on lines 176..178
      research/object_detection/dataset_tools/context_rcnn/add_context_to_examples_tf2_test.py on lines 179..181
      research/object_detection/dataset_tools/context_rcnn/add_context_to_examples_tf2_test.py on lines 182..184
      research/object_detection/dataset_tools/context_rcnn/add_context_to_examples_tf2_test.py on lines 185..187
      research/object_detection/dataset_tools/seq_example_util_test.py on lines 173..175
      research/object_detection/dataset_tools/seq_example_util_test.py on lines 176..178
      research/object_detection/dataset_tools/seq_example_util_test.py on lines 179..181
      research/object_detection/dataset_tools/seq_example_util_test.py on lines 287..289
      research/object_detection/dataset_tools/seq_example_util_test.py on lines 290..292
      research/object_detection/dataset_tools/seq_example_util_test.py on lines 293..295
      research/object_detection/dataset_tools/seq_example_util_test.py on lines 296..298
      research/object_detection/dataset_tools/seq_example_util_test.py on lines 396..398
      research/object_detection/dataset_tools/seq_example_util_test.py on lines 399..401
      research/object_detection/dataset_tools/seq_example_util_test.py on lines 402..404
      research/object_detection/dataset_tools/seq_example_util_test.py on lines 405..407

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 35.

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

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

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

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

      Refactorings

      Further Reading

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

          self.assertAllClose(
              [0., 0.],
              seq_feature_dict['region/bbox/ymin'].feature[0].float_list.value[:])
      research/object_detection/dataset_tools/context_rcnn/add_context_to_examples_tf2_test.py on lines 176..178
      research/object_detection/dataset_tools/context_rcnn/add_context_to_examples_tf2_test.py on lines 179..181
      research/object_detection/dataset_tools/context_rcnn/add_context_to_examples_tf2_test.py on lines 182..184
      research/object_detection/dataset_tools/context_rcnn/add_context_to_examples_tf2_test.py on lines 185..187
      research/object_detection/dataset_tools/seq_example_util_test.py on lines 170..172
      research/object_detection/dataset_tools/seq_example_util_test.py on lines 173..175
      research/object_detection/dataset_tools/seq_example_util_test.py on lines 176..178
      research/object_detection/dataset_tools/seq_example_util_test.py on lines 179..181
      research/object_detection/dataset_tools/seq_example_util_test.py on lines 287..289
      research/object_detection/dataset_tools/seq_example_util_test.py on lines 290..292
      research/object_detection/dataset_tools/seq_example_util_test.py on lines 293..295
      research/object_detection/dataset_tools/seq_example_util_test.py on lines 296..298
      research/object_detection/dataset_tools/seq_example_util_test.py on lines 399..401
      research/object_detection/dataset_tools/seq_example_util_test.py on lines 402..404
      research/object_detection/dataset_tools/seq_example_util_test.py on lines 405..407

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 35.

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

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

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

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

      Refactorings

      Further Reading

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

          self.assertAllClose(
              [0.75, 1.],
              seq_feature_dict['region/bbox/ymax'].feature[0].float_list.value[:])
      research/object_detection/dataset_tools/context_rcnn/add_context_to_examples_tf2_test.py on lines 176..178
      research/object_detection/dataset_tools/context_rcnn/add_context_to_examples_tf2_test.py on lines 179..181
      research/object_detection/dataset_tools/context_rcnn/add_context_to_examples_tf2_test.py on lines 182..184
      research/object_detection/dataset_tools/context_rcnn/add_context_to_examples_tf2_test.py on lines 185..187
      research/object_detection/dataset_tools/seq_example_util_test.py on lines 170..172
      research/object_detection/dataset_tools/seq_example_util_test.py on lines 173..175
      research/object_detection/dataset_tools/seq_example_util_test.py on lines 176..178
      research/object_detection/dataset_tools/seq_example_util_test.py on lines 179..181
      research/object_detection/dataset_tools/seq_example_util_test.py on lines 287..289
      research/object_detection/dataset_tools/seq_example_util_test.py on lines 290..292
      research/object_detection/dataset_tools/seq_example_util_test.py on lines 293..295
      research/object_detection/dataset_tools/seq_example_util_test.py on lines 296..298
      research/object_detection/dataset_tools/seq_example_util_test.py on lines 396..398
      research/object_detection/dataset_tools/seq_example_util_test.py on lines 399..401
      research/object_detection/dataset_tools/seq_example_util_test.py on lines 405..407

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 35.

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

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

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

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

      Refactorings

      Further Reading

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

          self.assertAllClose(
              [0.6, 0.7],
              seq_feature_dict['region/bbox/ymax'].feature[0].float_list.value[:])
      research/object_detection/dataset_tools/context_rcnn/add_context_to_examples_tf2_test.py on lines 176..178
      research/object_detection/dataset_tools/context_rcnn/add_context_to_examples_tf2_test.py on lines 179..181
      research/object_detection/dataset_tools/context_rcnn/add_context_to_examples_tf2_test.py on lines 185..187
      research/object_detection/dataset_tools/seq_example_util_test.py on lines 170..172
      research/object_detection/dataset_tools/seq_example_util_test.py on lines 173..175
      research/object_detection/dataset_tools/seq_example_util_test.py on lines 176..178
      research/object_detection/dataset_tools/seq_example_util_test.py on lines 179..181
      research/object_detection/dataset_tools/seq_example_util_test.py on lines 287..289
      research/object_detection/dataset_tools/seq_example_util_test.py on lines 290..292
      research/object_detection/dataset_tools/seq_example_util_test.py on lines 293..295
      research/object_detection/dataset_tools/seq_example_util_test.py on lines 296..298
      research/object_detection/dataset_tools/seq_example_util_test.py on lines 396..398
      research/object_detection/dataset_tools/seq_example_util_test.py on lines 399..401
      research/object_detection/dataset_tools/seq_example_util_test.py on lines 402..404
      research/object_detection/dataset_tools/seq_example_util_test.py on lines 405..407

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 35.

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

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

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

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

      Refactorings

      Further Reading

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

            (cls_targets,
             box_targets,
             num_positives) = anchor_labeler.label_anchors(
                 boxes,
                 tf.cast(tf.expand_dims(classes, axis=1), tf.float32))
      Severity: Major
      Found in official/legacy/detection/dataloader/shapemask_parser.py and 4 other locations - About 45 mins to fix
      official/legacy/detection/dataloader/retinanet_parser.py on lines 257..258
      official/legacy/detection/dataloader/retinanet_parser.py on lines 316..317
      official/legacy/detection/dataloader/retinanet_parser.py on lines 420..421
      official/legacy/detection/dataloader/shapemask_parser.py on lines 313..317

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 35.

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

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

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

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

      Refactorings

      Further Reading

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

          self.assertAllClose(
              [0., 0.],
              seq_feature_dict['region/bbox/xmin'].feature[0].float_list.value[:])
      research/object_detection/dataset_tools/context_rcnn/add_context_to_examples_tf2_test.py on lines 176..178
      research/object_detection/dataset_tools/context_rcnn/add_context_to_examples_tf2_test.py on lines 179..181
      research/object_detection/dataset_tools/context_rcnn/add_context_to_examples_tf2_test.py on lines 182..184
      research/object_detection/dataset_tools/context_rcnn/add_context_to_examples_tf2_test.py on lines 185..187
      research/object_detection/dataset_tools/seq_example_util_test.py on lines 170..172
      research/object_detection/dataset_tools/seq_example_util_test.py on lines 176..178
      research/object_detection/dataset_tools/seq_example_util_test.py on lines 179..181
      research/object_detection/dataset_tools/seq_example_util_test.py on lines 287..289
      research/object_detection/dataset_tools/seq_example_util_test.py on lines 290..292
      research/object_detection/dataset_tools/seq_example_util_test.py on lines 293..295
      research/object_detection/dataset_tools/seq_example_util_test.py on lines 296..298
      research/object_detection/dataset_tools/seq_example_util_test.py on lines 396..398
      research/object_detection/dataset_tools/seq_example_util_test.py on lines 399..401
      research/object_detection/dataset_tools/seq_example_util_test.py on lines 402..404
      research/object_detection/dataset_tools/seq_example_util_test.py on lines 405..407

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 35.

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

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

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

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

      Refactorings

      Further Reading

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

          (cls_targets, box_targets, num_positives) = anchor_labeler.label_anchors(
              boxes, tf.cast(tf.expand_dims(classes, axis=1), tf.float32))
      Severity: Major
      Found in official/legacy/detection/dataloader/retinanet_parser.py and 4 other locations - About 45 mins to fix
      official/legacy/detection/dataloader/retinanet_parser.py on lines 316..317
      official/legacy/detection/dataloader/retinanet_parser.py on lines 420..421
      official/legacy/detection/dataloader/shapemask_parser.py on lines 313..317
      official/legacy/detection/dataloader/shapemask_parser.py on lines 503..507

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 35.

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

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

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

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

      Refactorings

      Further Reading

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

          if attention_initializer:
            self._attention_initializer = tf_keras.initializers.get(
                attention_initializer)
          else:
            self._attention_initializer = tf_utils.clone_initializer(
      Severity: Major
      Found in official/nlp/modeling/layers/reuse_transformer.py and 4 other locations - About 45 mins to fix
      official/nlp/modeling/layers/tn_transformer_expand_condense.py on lines 100..105
      official/nlp/modeling/layers/transformer.py on lines 234..239
      official/projects/detr/modeling/transformer.py on lines 235..240
      official/projects/detr/modeling/transformer.py on lines 656..661

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 35.

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

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

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

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

      Refactorings

      Further Reading

      Severity
      Category
      Status
      Source
      Language