tensorflow/models

View on GitHub
research/object_detection/exporter_lib_tf2_test.py

Summary

Maintainability
F
1 wk
Test Coverage

File exporter_lib_tf2_test.py has 318 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# Copyright 2020 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: Minor
Found in research/object_detection/exporter_lib_tf2_test.py - About 3 hrs to fix

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

        if input_type == 'float_image_tensor':
          return np.zeros((1, 20, 20, 3), dtype=np.float32)
        elif input_type == 'encoded_image_string_tensor':
          image = Image.new('RGB', (20, 20))
          byte_io = io.BytesIO()
    Severity: Major
    Found in research/object_detection/exporter_lib_tf2_test.py and 1 other location - About 1 day to fix
    research/object_detection/exporter_lib_tf2_test.py on lines 307..327

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 211.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

        if input_type == 'float_image_tensor':
          return np.zeros((1, 20, 20, 3), dtype=np.float32)
        elif input_type == 'encoded_image_string_tensor':
          image = Image.new('RGB', (20, 20))
          byte_io = io.BytesIO()
    Severity: Major
    Found in research/object_detection/exporter_lib_tf2_test.py and 1 other location - About 1 day to fix
    research/object_detection/exporter_lib_tf2_test.py on lines 155..175

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 211.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

      def _save_checkpoint_from_mock_model(self,
                                           checkpoint_dir,
                                           conv_weight_scalar=6.0):
        mock_model = FakeModel(conv_weight_scalar)
        fake_image = tf.zeros(shape=[1, 10, 10, 3], dtype=tf.float32)
    Severity: Major
    Found in research/object_detection/exporter_lib_tf2_test.py and 1 other location - About 1 day to fix
    research/object_detection/exporter_lib_tf2_test.py on lines 103..114

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 122.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

      def _save_checkpoint_from_mock_model(
          self, checkpoint_dir, conv_weight_scalar=6.0):
        mock_model = FakeModel(conv_weight_scalar)
        fake_image = tf.zeros(shape=[1, 10, 10, 3], dtype=tf.float32)
        preprocessed_inputs, true_image_shapes = mock_model.preprocess(fake_image)
    Severity: Major
    Found in research/object_detection/exporter_lib_tf2_test.py and 1 other location - About 1 day to fix
    research/object_detection/exporter_lib_tf2_test.py on lines 329..341

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 122.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

      def __init__(self, conv_weight_scalar=1.0):
        super(FakeModel, self).__init__(num_classes=2)
        self._conv = tf.keras.layers.Conv2D(
            filters=1, kernel_size=1, strides=(1, 1), padding='valid',
            kernel_initializer=tf.keras.initializers.Constant(
    Severity: Major
    Found in research/object_detection/exporter_lib_tf2_test.py and 2 other locations - About 3 hrs to fix
    research/object_detection/dataset_tools/context_rcnn/generate_detection_data_tf2_test.py on lines 51..55
    research/object_detection/dataset_tools/context_rcnn/generate_embedding_data_tf2_test.py on lines 49..53

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 71.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

          self.assertAllClose(detections[detection_fields.detection_boxes],
                              [[[0.0, 0.0, 0.5, 0.5],
                                [0.5, 0.5, 0.8, 0.8]],
                               [[0.5, 0.5, 1.0, 1.0],
                                [0.0, 0.0, 0.0, 0.0]]])
    Severity: Major
    Found in research/object_detection/exporter_lib_tf2_test.py and 1 other location - About 1 hr to fix
    research/object_detection/exporter_lib_tf2_test.py on lines 256..260

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 47.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

          self.assertAllClose(detections[detection_fields.detection_boxes],
                              [[[0.0, 0.0, 0.5, 0.5],
                                [0.5, 0.5, 0.8, 0.8]],
                               [[0.5, 0.5, 1.0, 1.0],
                                [0.0, 0.0, 0.0, 0.0]]])
    Severity: Major
    Found in research/object_detection/exporter_lib_tf2_test.py and 1 other location - About 1 hr to fix
    research/object_detection/exporter_lib_tf2_test.py on lines 205..209

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 47.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 4 locations. Consider refactoring.
    Open

              'detection_boxes': tf.constant([[[0.0, 0.0, 0.5, 0.5],
                                               [0.5, 0.5, 0.8, 0.8]],
                                              [[0.5, 0.5, 1.0, 1.0],
                                               [0.0, 0.0, 0.0, 0.0]]], tf.float32),
    Severity: Major
    Found in research/object_detection/exporter_lib_tf2_test.py and 3 other locations - About 1 hr to fix
    research/object_detection/export_tflite_graph_lib_tf2_test.py on lines 72..74
    research/object_detection/exporter_tf1_test.py on lines 71..74
    research/object_detection/exporter_tf1_test.py on lines 83..87

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 39.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

                              [[150 + 0.7, 150 + 0.6], [150 + 0.9, 150 + 0.0]])
    Severity: Minor
    Found in research/object_detection/exporter_lib_tf2_test.py and 1 other location - About 35 mins to fix
    research/delf/delf/python/whiten_test.py on lines 56..56

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 33.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    There are no issues that match your filters.

    Category
    Status