tensorflow/models

View on GitHub

Showing 11,634 of 11,634 total issues

Avoid deeply nested control flow statements.
Open

          if model_options.add_image_level_feature:
            if model_options.crop_size is not None:
              image_pooling_crop_size = model_options.image_pooling_crop_size
              # If image_pooling_crop_size is not specified, use crop_size.
              if image_pooling_crop_size is None:
Severity: Major
Found in research/deeplab/model.py - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

              if decoder_stage:
                scope_suffix = '_{}'.format(decoder_stage)
              for i, name in enumerate(feature_list):
    Severity: Major
    Found in research/deeplab/model.py - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                  for i in range(num_frames):
                    frame_id = '%.10d' % i
                    all_frames.append(dr + ' ' + cam + ' ' + frame_id)
      
      
      Severity: Major
      Found in research/vid2depth/dataset/dataset_loader.py - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                  if model_options.atrous_rates:
                    # Employ 3x3 convolutions with different atrous rates.
                    for i, rate in enumerate(model_options.atrous_rates, 1):
                      scope = ASPP_SCOPE + str(i)
                      if model_options.aspp_with_separable_conv:
        Severity: Major
        Found in research/deeplab/model.py - About 45 mins to fix

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

          def _convert_dataset(dataset_split, dataset_dir, dataset_label_dir):
            """Converts the ADE20k dataset into into tfrecord format.
          
            Args:
              dataset_split: Dataset split (e.g., train, val).
          Severity: Minor
          Found in research/deeplab/datasets/build_ade20k_data.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

                      if i == j or abs(i - j) != 1:
                        continue
                      # In legacy mode, only consider the middle frame as target.
                      if self.legacy_mode and j != self.middle_frame_index:
          Severity: Major
          Found in research/vid2depth/model.py - About 45 mins to fix

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

            def conv2d(inputs,
                       num_outputs,
                       kernel_size,
                       stride=1,
                       padding='SAME',
            Severity: Minor
            Found in research/deeplab/core/conv2d_ws.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

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

              def __init__(self, data_dir, batch_size, img_height, img_width, seq_length,
            Severity: Minor
            Found in research/vid2depth/reader.py - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                        if backbone[cell_num - 1] == 3 and nas_remove_os32_stride:
                          # No need to rescale features.
                          pass
                        else:
                          # Scale features by a factor of 2.
              Severity: Major
              Found in research/deeplab/core/nas_network.py - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                            if self.icp_weight > 0:
                              cloud_a = self.cloud[j][s]
                              cloud_b = self.cloud[i][s]
                              self.icp_transform[s][key], self.icp_residual[s][key] = icp(
                                  cloud_a, egomotion, cloud_b)
                Severity: Major
                Found in research/vid2depth/model.py - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                              for output in outputs_to_num_classes:
                                scales_to_logits = outputs_to_scales_to_logits[output]
                                self.assertListEqual(sorted(scales_to_logits.keys()),
                                                     sorted(expected_endpoints[i]))
                  
                  
                  Severity: Major
                  Found in research/deeplab/model_test.py - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                if output_stride is None:
                                  factor = 1
                                else:
                                  factor = nominal_stride // output_stride
                                output = resnet_utils.subsample(output, factor)
                    Severity: Major
                    Found in research/deeplab/core/xception_test.py - About 45 mins to fix

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

                        def __init__(self,
                      Severity: Minor
                      Found in research/vid2depth/dataset/dataset_loader.py - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                    if self.legacy_mode:
                                      if egomotion_index >= self.middle_frame_index:
                                        egomotion_mult *= -1
                                    egomotion = egomotion_mult * self.egomotion[:, egomotion_index, :]
                        Severity: Major
                        Found in research/vid2depth/model.py - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                    for i, name in enumerate(feature_list):
                                      decoder_features_list = [decoder_features]
                                      # MobileNet and NAS variants use different naming convention.
                                      if ('mobilenet' in model_variant or
                                          model_variant.startswith('mnas') or
                          Severity: Major
                          Found in research/deeplab/model.py - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            Open

                                      if output_stride % 4 != 0:
                                        raise ValueError('The output_stride needs to be a multiple of 4.')
                                      output_stride //= 4
                            Severity: Major
                            Found in research/deeplab/core/resnet_v1_beta.py - About 45 mins to fix

                              Avoid deeply nested control flow statements.
                              Open

                                        if output_stride != 1:
                                          stride = 2
                                          output_stride //= 2
                                        else:
                                          stride = 1
                              Severity: Major
                              Found in research/deeplab/core/nas_network.py - About 45 mins to fix

                                Avoid deeply nested control flow statements.
                                Open

                                            if self.legacy_mode and j != self.middle_frame_index:
                                              continue
                                            source = self.images[s][:, :, :, 3 * i:3 * (i + 1)]
                                Severity: Major
                                Found in research/vid2depth/model.py - About 45 mins to fix

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

                                  def _build_metric(metric,
                                  Severity: Minor
                                  Found in research/deeplab/evaluation/eval_coco_format.py - About 45 mins to fix

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

                                      def _pnasnet(self,
                                    Severity: Minor
                                    Found in research/deeplab/core/nas_network_test.py - About 45 mins to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language