File visualization_utils.py
has 910 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 visualize_boxes_and_labels_on_image_array
has a Cognitive Complexity of 56 (exceeds 5 allowed). Consider refactoring. Open
def visualize_boxes_and_labels_on_image_array(
image,
boxes,
classes,
scores,
- 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 visualize_segmentation_outputs
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def visualize_segmentation_outputs(
logs,
task_config,
original_image_spatial_shape=None,
true_image_shape=None,
- 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 visualize_boxes_and_labels_on_image_array
has 16 arguments (exceeds 4 allowed). Consider refactoring. Open
def visualize_boxes_and_labels_on_image_array(
Function visualize_outputs
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def visualize_outputs(
logs,
task_config,
original_image_spatial_shape=None,
true_image_shape=None,
- 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 draw_bounding_boxes_on_image_tensors
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def draw_bounding_boxes_on_image_tensors(images,
boxes,
classes,
scores,
category_index,
- 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 draw_bounding_box_on_image
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def draw_bounding_box_on_image(image,
ymin,
xmin,
ymax,
xmax,
- 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 draw_bounding_boxes_on_image_tensors
has 12 arguments (exceeds 4 allowed). Consider refactoring. Open
def draw_bounding_boxes_on_image_tensors(images,
Function visualize_outputs
has 10 arguments (exceeds 4 allowed). Consider refactoring. Open
def visualize_outputs(
Function draw_bounding_box_on_image_array
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
def draw_bounding_box_on_image_array(image,
Function draw_bounding_box_on_image
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
def draw_bounding_box_on_image(image,
Function _visualize_boxes_and_masks_and_keypoints
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def _visualize_boxes_and_masks_and_keypoints(image, boxes, classes, scores,
Function update_detection_state
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def update_detection_state(step_outputs=None) -> Dict[str, Any]:
"""Updates detection state to optionally add input image and predictions."""
state = {}
if step_outputs:
state['image'] = tf.concat(step_outputs['visualization'][0], axis=0)
- 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 visualize_segmentation_outputs
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def visualize_segmentation_outputs(
Function _visualize_boxes_and_keypoints
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def _visualize_boxes_and_keypoints(image, boxes, classes, scores, keypoints,
Function _visualize_boxes_and_masks
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def _visualize_boxes_and_masks(image, boxes, classes, scores, masks,
Function _visualize_boxes
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def _visualize_boxes(image, boxes, classes, scores, category_index, **kwargs):
Avoid deeply nested control flow statements. Open
if not agnostic_mode:
if classes[i] in category_index.keys():
class_name = category_index[classes[i]]['name']
else:
class_name = 'N/A'
Avoid deeply nested control flow statements. Open
if not display_str:
display_str = '{}%'.format(int(100 * scores[i]))
else:
display_str = '{}: {}%'.format(display_str, int(100 * scores[i]))
box_to_display_str_map[box].append(display_str)
Function draw_bounding_boxes_on_image_array
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def draw_bounding_boxes_on_image_array(image,
Function draw_bounding_boxes_on_image
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def draw_bounding_boxes_on_image(image,
Function draw_keypoints_on_image
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def draw_keypoints_on_image(image,
Function draw_keypoints_on_image_array
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def draw_keypoints_on_image_array(image,
Function draw_bounding_boxes_on_image
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def draw_bounding_boxes_on_image(image,
boxes,
color='red',
thickness=4,
display_str_list_list=()):
- 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"