tensorflow/models

View on GitHub
official/projects/yolo/ops/preprocessing_ops.py

Summary

Maintainability
F
3 days
Test Coverage

File preprocessing_ops.py has 706 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: Major
Found in official/projects/yolo/ops/preprocessing_ops.py - About 1 day to fix

    Function resize_and_jitter_image has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

    def resize_and_jitter_image(image,
                                desired_size,
                                jitter=0.0,
                                letter_box=None,
                                random_pad=True,
    Severity: Minor
    Found in official/projects/yolo/ops/preprocessing_ops.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 mosaic_cut has 12 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def mosaic_cut(image, original_width, original_height, width, height, center,
    Severity: Major
    Found in official/projects/yolo/ops/preprocessing_ops.py - About 1 hr to fix

      Function resize_and_jitter_image has 11 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def resize_and_jitter_image(image,
      Severity: Major
      Found in official/projects/yolo/ops/preprocessing_ops.py - About 1 hr to fix

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

        def affine_warp_image(image,
        Severity: Major
        Found in official/projects/yolo/ops/preprocessing_ops.py - About 1 hr to fix

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

          def _build_transform(image,
          Severity: Major
          Found in official/projects/yolo/ops/preprocessing_ops.py - About 1 hr to fix

            Function _build_transform has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            def _build_transform(image,
                                 perspective=0.00,
                                 degrees=0.0,
                                 scale_min=1.0,
                                 scale_max=1.0,
            Severity: Minor
            Found in official/projects/yolo/ops/preprocessing_ops.py - About 1 hr to fix

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

              def transform_and_clip_boxes(boxes,
              Severity: Major
              Found in official/projects/yolo/ops/preprocessing_ops.py - About 50 mins to fix

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

                def image_rand_hsv(image, rh, rs, rv, seed=None, darknet=False):
                Severity: Minor
                Found in official/projects/yolo/ops/preprocessing_ops.py - About 45 mins to fix

                  Function boxes_candidates has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                  def boxes_candidates(clipped_boxes,
                  Severity: Minor
                  Found in official/projects/yolo/ops/preprocessing_ops.py - About 35 mins to fix

                    Function random_uniform_strong has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                    def random_uniform_strong(minval,
                    Severity: Minor
                    Found in official/projects/yolo/ops/preprocessing_ops.py - About 35 mins to fix

                      Function resize_and_crop_boxes has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                      def resize_and_crop_boxes(boxes, image_scale, output_size, offset, box_history):
                      Severity: Minor
                      Found in official/projects/yolo/ops/preprocessing_ops.py - About 35 mins to fix

                        Function _augment_hsv_darknet has 5 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                        def _augment_hsv_darknet(image, rh, rs, rv, seed=None):
                        Severity: Minor
                        Found in official/projects/yolo/ops/preprocessing_ops.py - About 35 mins to fix

                          Function _augment_hsv_torch has 5 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                          def _augment_hsv_torch(image, rh, rs, rv, seed=None):
                          Severity: Minor
                          Found in official/projects/yolo/ops/preprocessing_ops.py - About 35 mins to fix

                            There are no issues that match your filters.

                            Category
                            Status