tensorflow/models

View on GitHub

Showing 11,634 of 11,634 total issues

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

  def _create_application_with_layer_outputs(self,
Severity: Minor
Found in research/object_detection/models/keras_models/resnet_v1_tf2_test.py - About 45 mins to fix

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

      def __init__(self, resnet_type, channel_means=(0., 0., 0.),
                   channel_stds=(1., 1., 1.), bgr_ordering=False):
        """Initializes the feature extractor with a specific ResNet architecture.
    
        Args:

    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 multi_resolution_feature_maps has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def multi_resolution_feature_maps(feature_map_layout, depth_multiplier,
    Severity: Minor
    Found in research/object_detection/models/feature_map_generators.py - About 45 mins to fix

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

      def mnasfpn(feature_maps,

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

          def _expanded_conv(self, net, num_filters, expansion_rates, kernel_size,
        Severity: Minor
        Found in research/object_detection/models/ssd_spaghettinet_feature_extractor.py - About 45 mins to fix

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

          def _build_pnasnet_base(
          Severity: Minor
          Found in research/object_detection/models/faster_rcnn_pnas_feature_extractor.py - About 45 mins to fix

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

              def _create_feature_extractor(self,

              Avoid deeply nested control flow statements.
              Open

                          with tf.variable_scope('Branch_3'):
                            branch_3 = slim.avg_pool2d(net, [3, 3], scope='AvgPool_0a_3x3')
                            branch_3 = slim.conv2d(
                                branch_3, depth(128), [1, 1],
                                weights_initializer=trunc_normal(0.1),

                Avoid deeply nested control flow statements.
                Open

                            with tf.variable_scope('Branch_0'):
                              branch_0 = slim.conv2d(net, depth(352), [1, 1],
                                                     scope='Conv2d_0a_1x1')
                            with tf.variable_scope('Branch_1'):

                  Avoid deeply nested control flow statements.
                  Open

                              if self._use_explicit_padding:
                                last_feature_map = ops.fixed_padding(
                                    last_feature_map, kernel_size)
                              last_feature_map = conv_op(

                    Avoid deeply nested control flow statements.
                    Open

                                with tf.variable_scope('Branch_1'):
                                  branch_1 = slim.conv2d(
                                      net, depth(192), [1, 1],
                                      weights_initializer=trunc_normal(0.09),
                                      scope='Conv2d_0a_1x1')

                      Avoid deeply nested control flow statements.
                      Open

                                  with tf.variable_scope('Branch_2'):
                                    branch_2 = slim.max_pool2d(net, [3, 3], stride=2,
                                                               scope='MaxPool_1a_3x3')
                                  net = tf.concat([branch_0, branch_1, branch_2], concat_dim)

                        Avoid deeply nested control flow statements.
                        Open

                                    with tf.variable_scope('Branch_3'):
                                      branch_3 = slim.max_pool2d(net, [3, 3], scope='MaxPool_0a_3x3')
                                      branch_3 = slim.conv2d(
                                          branch_3, depth(128), [1, 1],
                                          weights_initializer=trunc_normal(0.1),

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

                            def build(self, input_shape):
                              if not isinstance(input_shape, list):
                                raise ValueError('A BiFPN combine layer should be called '
                                                 'on a list of inputs.')
                              if len(input_shape) < 2:
                          Severity: Minor
                          Found in research/object_detection/utils/bifpn_utils.py - About 45 mins to fix

                          Cognitive Complexity

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

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

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

                          Further reading

                          Avoid deeply nested control flow statements.
                          Open

                                      with tf.variable_scope('Branch_2'):
                                        branch_2 = slim.conv2d(
                                            net, depth(160), [1, 1],
                                            weights_initializer=trunc_normal(0.09),
                                            scope='Conv2d_0a_1x1')

                            Avoid deeply nested control flow statements.
                            Open

                                        with tf.variable_scope('Branch_2'):
                                          branch_2 = slim.conv2d(
                                              net, depth(192), [1, 1],
                                              weights_initializer=trunc_normal(0.09),
                                              scope='Conv2d_0a_1x1')

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

                                def _create_feature_extractor(self,

                                Avoid deeply nested control flow statements.
                                Open

                                            if self._use_depthwise:
                                              conv_op = functools.partial(
                                                  slim.separable_conv2d, depth_multiplier=1)
                                            else:
                                              conv_op = slim.conv2d

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

                                  def _batch_norm_arg_scope(list_ops,

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

                                    def create_downsample_feature_map_ops(scale, downsample_method,
                                    Severity: Minor
                                    Found in research/object_detection/utils/bifpn_utils.py - About 45 mins to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language