tensorflow/models

View on GitHub

Showing 11,634 of 11,634 total issues

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

  def test_create_center_net_model(self, customize_head_params):
    """Test building a CenterNet model from proto txt."""
    proto_txt = """
      center_net {
        num_classes: 10
Severity: Minor
Found in research/object_detection/builders/model_builder_tf2_test.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 cat['name'] == class_label:
            category = cat
            break
        if not category:
Severity: Major
Found in research/object_detection/eval_util.py - About 45 mins to fix

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

    def result_dict_for_single_example(image,
    Severity: Minor
    Found in research/object_detection/eval_util.py - About 45 mins to fix

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

      def _create_learning_rate(learning_rate_config, global_step=None):
        """Create optimizer learning rate based on config.
      
        Args:
          learning_rate_config: A LearningRate proto message.
      Severity: Minor
      Found in research/object_detection/builders/optimizer_builder.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 main has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

      def main(_):
        pipeline_config = pipeline_pb2.TrainEvalPipelineConfig()
        with tf.gfile.GFile(FLAGS.pipeline_config_path, 'r') as f:
          text_format.Merge(f.read(), pipeline_config)
        text_format.Merge(FLAGS.config_override, pipeline_config)
      Severity: Minor
      Found in research/object_detection/export_inference_graph.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 add_single_ground_truth_image_info has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        def add_single_ground_truth_image_info(self,
                                               image_id,
                                               groundtruth_dict):
          """Adds groundtruth for a single image to be used for evaluation.
      
      
      Severity: Minor
      Found in research/object_detection/metrics/lvis_evaluation.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

                  for head_name in sorted_keys:
                    if head_name == CLASS_PREDICTIONS_WITH_BACKGROUND:
                      head_obj = self._class_prediction_head
                    else:
                      head_obj = self._other_heads[head_name]
      Severity: Major
      Found in research/object_detection/predictors/convolutional_box_predictor.py - About 45 mins to fix

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

          def _generate_sequence_examples(self, annotation_file, excluded_file,
        Severity: Minor
        Found in research/object_detection/dataset_tools/create_ava_actions_tf_record.py - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                    if int(visibility) > 0:
                      num_valid_keypoints = num_valid_keypoints + 1
                  export_dict['keypoints'] = coco_keypoints
          Severity: Major
          Found in research/object_detection/metrics/coco_tools.py - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                        for row in frame_annotations[(media_id, windowed_timestamp)]:
                          if len(row) > 2 and int(row['action_label']) in label_map:
                            boxes.append([float(row['ymin']), float(row['xmin']),
                                          float(row['ymax']), float(row['xmax'])])
                            labels.append(int(row['action_label']))
            Severity: Major
            Found in research/object_detection/dataset_tools/create_ava_actions_tf_record.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/object_detection/predictors/heads/class_head.py - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                            for head_name in sorted_keys:
                              if head_name == BOX_ENCODINGS:
                                head_obj = self._box_prediction_head
                              elif head_name == CLASS_PREDICTIONS_WITH_BACKGROUND:
                                head_obj = self._class_prediction_head
                Severity: Major
                Found in research/object_detection/predictors/convolutional_box_predictor.py - About 45 mins to fix

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

                  def ExportDetectionsToCOCO(image_ids,
                  Severity: Minor
                  Found in research/object_detection/metrics/coco_tools.py - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                if all_metrics_per_category:
                                  for metric_name, index in COCO_METRIC_NAMES_AND_INDEX:
                                    metric_key = '{} BySuperCategory/{}'.format(metric_name, key)
                                    super_category_ap[metric_key] += (
                                        self.category_stats[index][category_index])
                    Severity: Major
                    Found in research/object_detection/metrics/coco_tools.py - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                  if (media_id, windowed_timestamp + frames_mv) in frame_excluded:
                                    frames_excluded_count += 1
                                middle_frame_time += frames_mv
                      Severity: Major
                      Found in research/object_detection/dataset_tools/create_ava_actions_tf_record.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/object_detection/predictors/heads/keypoint_head.py - About 45 mins to fix

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

                            def LoadAnnotations(self, annotations):
                              """Load annotations dictionary into COCO datastructure.
                          
                              See http://mscoco.org/dataset/#format for a description of the annotations
                              format.  As above, this function replicates the default behavior of the API
                          Severity: Minor
                          Found in research/object_detection/metrics/coco_tools.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 (media_id, windowed_timestamp) in frame_excluded:
                                        end_time += 1
                                        windowed_timestamp += 1
                                        logging.info('Ignoring and skipping excluded frame.')
                                        continue
                          Severity: Major
                          Found in research/object_detection/dataset_tools/create_ava_actions_tf_record.py - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            Open

                                        if len(row) > 2 and int(row['action_label']) in label_map:
                                          xmins.append(float(row['xmin']))
                                          xmaxs.append(float(row['xmax']))
                                          ymins.append(float(row['ymin']))
                                          ymaxs.append(float(row['ymax']))
                            Severity: Major
                            Found in research/object_detection/dataset_tools/create_ava_actions_tf_record.py - About 45 mins to fix

                              Avoid deeply nested control flow statements.
                              Open

                                          if self._share_prediction_tower:
                                            box_tower_scope = 'PredictionTower'
                                          else:
                                            box_tower_scope = 'BoxPredictionTower'
                                          box_tower_feature = self._compute_base_tower(
                              Severity: Major
                              Found in research/object_detection/predictors/convolutional_box_predictor.py - About 45 mins to fix
                                Severity
                                Category
                                Status
                                Source
                                Language