File detection_generator.py
has 1420 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
Function __call__
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def __call__(
self,
raw_boxes: Mapping[str, tf.Tensor],
raw_scores: Mapping[str, tf.Tensor],
anchor_boxes: Mapping[str, tf.Tensor],
- Read upRead up
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 16 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function _generate_detections_per_image
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def _generate_detections_per_image(
boxes: tf.Tensor,
scores: tf.Tensor,
attributes: Optional[Mapping[str, tf.Tensor]] = None,
pre_nms_top_k: int = 5000,
- Read upRead up
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 _generate_detections_v1
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def _generate_detections_v1(
boxes: tf.Tensor,
scores: tf.Tensor,
attributes: Optional[Mapping[str, tf.Tensor]] = None,
pre_nms_top_k: int = 5000,
- Read upRead up
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 __call__
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def __call__(
self,
raw_boxes: tf.Tensor,
raw_scores: tf.Tensor,
anchor_boxes: tf.Tensor,
- Read upRead up
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 _decode_multilevel_outputs
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def _decode_multilevel_outputs(
self,
raw_boxes: Mapping[str, tf.Tensor],
raw_scores: Mapping[str, tf.Tensor],
anchor_boxes: Mapping[str, tf.Tensor],
- Read upRead up
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 11 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function _generate_detections_v1
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def _generate_detections_v1(
Function _generate_detections_per_image
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def _generate_detections_per_image(
Function _decode_multilevel_outputs_and_pre_nms_top_k
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def _decode_multilevel_outputs_and_pre_nms_top_k(
self,
raw_boxes: Mapping[str, tf.Tensor],
raw_scores: Mapping[str, tf.Tensor],
anchor_boxes: Mapping[str, tf.Tensor],
- Read upRead up
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 __call__
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def __call__(
Function _generate_detections_v2
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def _generate_detections_v2(
Function _generate_detections_v2_class_aware
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def _generate_detections_v2_class_aware(
Function _generate_detections_v2_class_agnostic
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def _generate_detections_v2_class_agnostic(
Function _decode_multilevel_outputs
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def _decode_multilevel_outputs(
Function _generate_detections_v3
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def _generate_detections_v3(
Function __call__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __call__(
Function _decode_multilevel_outputs_and_pre_nms_top_k
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def _decode_multilevel_outputs_and_pre_nms_top_k(
Function _generate_detections_batched
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def _generate_detections_batched(
Function _generate_detections_tflite
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def _generate_detections_tflite(