tensorflow/models

View on GitHub
official/vision/modeling/maskrcnn_model.py

Summary

Maintainability
D
2 days
Test Coverage

File maskrcnn_model.py has 433 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# Copyright 2024 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: Minor
Found in official/vision/modeling/maskrcnn_model.py - About 6 hrs to fix

    Function _call_box_outputs has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

      def _call_box_outputs(
          self,
          images: tf.Tensor,
          image_shape: tf.Tensor,
          anchor_boxes: Optional[Mapping[str, tf.Tensor]] = None,
    Severity: Minor
    Found in official/vision/modeling/maskrcnn_model.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 __init__ has 20 arguments (exceeds 4 allowed). Consider refactoring.
    Open

      def __init__(self,
    Severity: Major
    Found in official/vision/modeling/maskrcnn_model.py - About 2 hrs to fix

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

        def _run_frcnn_head(self,
                            features,
                            rois,
                            gt_boxes,
                            gt_classes,
      Severity: Minor
      Found in official/vision/modeling/maskrcnn_model.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 _run_frcnn_head has 9 arguments (exceeds 4 allowed). Consider refactoring.
      Open

        def _run_frcnn_head(self,
      Severity: Major
      Found in official/vision/modeling/maskrcnn_model.py - About 1 hr to fix

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

          def call(  # pytype: disable=signature-mismatch  # overriding-parameter-count-checks
        Severity: Major
        Found in official/vision/modeling/maskrcnn_model.py - About 1 hr to fix

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

            def _call_mask_outputs(
          Severity: Major
          Found in official/vision/modeling/maskrcnn_model.py - About 1 hr to fix

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

              def __init__(self,
                           backbone: tf_keras.Model,
                           decoder: tf_keras.Model,
                           rpn_head: tf_keras.layers.Layer,
                           detection_head: Union[tf_keras.layers.Layer,
            Severity: Minor
            Found in official/vision/modeling/maskrcnn_model.py - About 55 mins to fix

            Cognitive Complexity

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

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

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

            Further reading

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

              def _call_box_outputs(
            Severity: Major
            Found in official/vision/modeling/maskrcnn_model.py - About 50 mins to fix

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

                def _call_mask_outputs(
                    self,
                    model_box_outputs: Mapping[str, tf.Tensor],
                    features: tf.Tensor,
                    current_rois: tf.Tensor,
              Severity: Minor
              Found in official/vision/modeling/maskrcnn_model.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

              There are no issues that match your filters.

              Category
              Status