tensorflow/models

View on GitHub

Showing 11,634 of 11,634 total issues

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

def ssd_random_crop_pad_fixed_aspect_ratio(
    image,
    boxes,
    labels,
    label_weights,
Severity: Minor
Found in research/object_detection/core/preprocessor.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 assign_center_targets_from_keypoints has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

  def assign_center_targets_from_keypoints(self,
Severity: Minor
Found in research/object_detection/core/target_assigner.py - About 45 mins to fix

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

      def assign_keypoints_offset_targets(self,
    Severity: Minor
    Found in research/object_detection/core/target_assigner.py - About 45 mins to fix

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

      def batch_assign(target_assigner,
      Severity: Minor
      Found in research/object_detection/core/target_assigner.py - About 45 mins to fix

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

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

          Avoid deeply nested control flow statements.
          Open

                    if image_id not in keypoint_annotations_index:
                      keypoint_annotations_index[image_id] = {}
                    keypoint_annotations_index[image_id][annotation['id']] = annotation
          Severity: Major
          Found in research/object_detection/dataset_tools/create_coco_tf_record.py - About 45 mins to fix

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

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

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

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

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

                  def assign_part_and_coordinate_targets(self,
                Severity: Minor
                Found in research/object_detection/core/target_assigner.py - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                            if image_id not in densepose_annotations_index:
                              densepose_annotations_index[image_id] = {}
                            densepose_annotations_index[image_id][annotation['id']] = annotation
                  Severity: Major
                  Found in research/object_detection/dataset_tools/create_coco_tf_record.py - About 45 mins to fix

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

                      def __call__(self,
                    Severity: Minor
                    Found in research/object_detection/core/losses.py - About 45 mins to fix

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

                        def batch_assign(self,
                      Severity: Minor
                      Found in research/object_detection/core/target_assigner.py - About 45 mins to fix

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

                            def graph_fn(anchor_means, groundtruth_boxlist1, groundtruth_boxlist2,
                        Severity: Minor
                        Found in research/object_detection/core/target_assigner_test.py - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                    if ((int(global_step.value()) - checkpointed_step) >=
                                        checkpoint_every_n):
                                      manager.save()
                                      checkpointed_step = int(global_step.value())
                          
                          
                          Severity: Major
                          Found in research/object_detection/model_lib_v2.py - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            Open

                                        if base_network_scope + '_' not in var_name:  # LSTM and FeatureMap
                                          variables_to_restore[var_name] = variable
                                      if scope_to_replace in var_name:
                            Severity: Major
                            Found in research/lstm_object_detection/meta_architectures/lstm_ssd_meta_arch.py - About 45 mins to fix

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

                              def get_configs_from_multiple_files(model_config_path="",
                              Severity: Minor
                              Found in research/lstm_object_detection/utils/config_util.py - About 45 mins to fix

                                Avoid deeply nested control flow statements.
                                Open

                                          for key, val in logged_dict.items():
                                            tf.compat.v2.summary.scalar(key, val, step=global_step)
                                
                                
                                Severity: Major
                                Found in research/object_detection/model_lib_v2.py - About 45 mins to fix

                                  Avoid deeply nested control flow statements.
                                  Open

                                              for tensor in tensor_dict.values():
                                                self.assertAllEqual(tensor, np.arange(i * i).reshape((i, i)))
                                                i += 1
                                          with self.assertRaises(tf.errors.OutOfRangeError):
                                  Severity: Major
                                  Found in research/object_detection/core/batcher_tf1_test.py - About 45 mins to fix

                                    Avoid deeply nested control flow statements.
                                    Open

                                              if soft_nms_sigma != 0:
                                                raise ValueError('Soft NMS not supported in current TF version!')
                                              selected_indices = tf.image.non_max_suppression(
                                    Severity: Major
                                    Found in research/object_detection/core/post_processing.py - About 45 mins to fix

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

                                        def get_from_replay_buffer(self, batch_size):
                                          """Sample a batch of episodes from the replay buffer."""
                                          if self.replay_buffer is None or len(self.replay_buffer) < 1 * batch_size:
                                            return None, None
                                      
                                      
                                      Severity: Minor
                                      Found in research/pcl_rl/controller.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

                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language