tensorflow/models

View on GitHub
research/slim/nets/inception_v3_test.py

Summary

Maintainability
F
2 wks
Test Coverage

File inception_v3_test.py has 283 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# Copyright 2016 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/slim/nets/inception_v3_test.py - About 2 hrs to fix

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

      def testBuildEndPointsWithDepthMultiplierGreaterThanOne(self):
        batch_size = 5
        height, width = 299, 299
        num_classes = 1000
    
    
    Severity: Major
    Found in research/slim/nets/inception_v3_test.py and 4 other locations - About 1 day to fix
    research/slim/nets/inception_v2_test.py on lines 129..147
    research/slim/nets/inception_v2_test.py on lines 149..167
    research/slim/nets/inception_v3_test.py on lines 158..176
    research/slim/nets/mobilenet_v1_test.py on lines 373..391

    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 190.

    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 5 locations. Consider refactoring.
    Open

      def testBuildEndPointsWithDepthMultiplierLessThanOne(self):
        batch_size = 5
        height, width = 299, 299
        num_classes = 1000
    
    
    Severity: Major
    Found in research/slim/nets/inception_v3_test.py and 4 other locations - About 1 day to fix
    research/slim/nets/inception_v2_test.py on lines 129..147
    research/slim/nets/inception_v2_test.py on lines 149..167
    research/slim/nets/inception_v3_test.py on lines 178..196
    research/slim/nets/mobilenet_v1_test.py on lines 373..391

    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 190.

    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

      def testUnknowBatchSize(self):
        batch_size = 1
        height, width = 299, 299
        num_classes = 1000
    
    
    Severity: Major
    Found in research/slim/nets/inception_v3_test.py and 3 other locations - About 1 day to fix
    research/slim/nets/inception_v1_test.py on lines 211..226
    research/slim/nets/inception_v2_test.py on lines 323..338
    research/slim/nets/mobilenet_v1_test.py on lines 459..474

    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 177.

    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 5 locations. Consider refactoring.
    Open

      def testBatchNormScale(self):
        height, width = 299, 299
        num_classes = 1000
        inputs = tf.placeholder(tf.float32, (1, height, width, 3))
        with slim.arg_scope(
    Severity: Major
    Found in research/slim/nets/inception_v3_test.py and 4 other locations - About 1 day to fix
    research/slim/nets/inception_resnet_v2_test.py on lines 321..334
    research/slim/nets/inception_v1_test.py on lines 281..294
    research/slim/nets/inception_v2_test.py on lines 393..406
    research/slim/nets/inception_v4_test.py on lines 270..283

    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 160.

    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

      def testBuildClassificationNetwork(self):
        batch_size = 5
        height, width = 299, 299
        num_classes = 1000
    
    
    Severity: Major
    Found in research/slim/nets/inception_v3_test.py and 3 other locations - About 1 day to fix
    research/slim/nets/inception_v1_test.py on lines 30..43
    research/slim/nets/inception_v2_test.py on lines 30..43
    research/slim/nets/mobilenet_v1_test.py on lines 30..43

    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 142.

    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 5 locations. Consider refactoring.
    Open

      def testHalfSizeImages(self):
        batch_size = 5
        height, width = 150, 150
        num_classes = 1000
    
    
    Severity: Major
    Found in research/slim/nets/inception_v3_test.py and 4 other locations - About 1 day to fix
    research/slim/nets/inception_v2_test.py on lines 242..254
    research/slim/nets/inception_v4_test.py on lines 169..180
    research/slim/nets/inception_v4_test.py on lines 182..193
    research/slim/nets/mobilenet_v1_test.py on lines 406..418

    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 134.

    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 5 locations. Consider refactoring.
    Open

      def testBuildPreLogitsNetwork(self):
        batch_size = 5
        height, width = 299, 299
        num_classes = None
    
    
    Severity: Major
    Found in research/slim/nets/inception_v3_test.py and 4 other locations - About 1 day to fix
    research/slim/nets/inception_v1_test.py on lines 45..55
    research/slim/nets/inception_v2_test.py on lines 45..55
    research/slim/nets/inception_v4_test.py on lines 47..56
    research/slim/nets/mobilenet_v1_test.py on lines 45..55

    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 132.

    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

      def testEvaluation(self):
        batch_size = 2
        height, width = 299, 299
        num_classes = 1000
    
    
    Severity: Major
    Found in research/slim/nets/inception_v3_test.py and 3 other locations - About 1 day to fix
    research/slim/nets/inception_v1_test.py on lines 228..241
    research/slim/nets/inception_v2_test.py on lines 340..353
    research/slim/nets/mobilenet_v1_test.py on lines 476..489

    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 128.

    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

        for index, endpoint in enumerate(endpoints):
          with tf.Graph().as_default():
            inputs = tf.random.uniform((batch_size, height, width, 3))
            out_tensor, end_points = inception.inception_v3_base(
                inputs, final_endpoint=endpoint)
    Severity: Major
    Found in research/slim/nets/inception_v3_test.py and 3 other locations - About 7 hrs to fix
    research/slim/nets/inception_v1_test.py on lines 81..88
    research/slim/nets/inception_v4_test.py on lines 143..150
    research/slim/nets/mobilenet_v1_test.py on lines 99..106

    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 112.

    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

      def testLogitsNotSqueezed(self):
        num_classes = 25
        images = tf.random.uniform([1, 299, 299, 3])
        logits, _ = inception.inception_v3(images,
                                           num_classes=num_classes,
    Severity: Major
    Found in research/slim/nets/inception_v3_test.py and 3 other locations - About 6 hrs to fix
    research/slim/nets/inception_v1_test.py on lines 260..270
    research/slim/nets/inception_v2_test.py on lines 372..382
    research/slim/nets/mobilenet_v1_test.py on lines 509..519

    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 103.

    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 testRaiseValueErrorWithInvalidDepthMultiplier(self):
        batch_size = 5
        height, width = 299, 299
        num_classes = 1000
    
    
    Severity: Major
    Found in research/slim/nets/inception_v3_test.py and 2 other locations - About 5 hrs to fix
    research/slim/nets/inception_v2_test.py on lines 169..178
    research/slim/nets/mobilenet_v1_test.py on lines 393..404

    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 97.

    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 testModelHasExpectedNumberOfParameters(self):
        batch_size = 5
        height, width = 299, 299
        inputs = tf.random.uniform((batch_size, height, width, 3))
        with slim.arg_scope(inception.inception_v3_arg_scope()):
    Severity: Major
    Found in research/slim/nets/inception_v3_test.py and 2 other locations - About 5 hrs to fix
    research/slim/nets/inception_v1_test.py on lines 123..131
    research/slim/nets/inception_v2_test.py on lines 119..127

    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 93.

    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 5 locations. Consider refactoring.
    Open

      def testNoBatchNormScaleByDefault(self):
        height, width = 299, 299
        num_classes = 1000
        inputs = tf.placeholder(tf.float32, (1, height, width, 3))
        with slim.arg_scope(inception.inception_v3_arg_scope()):
    Severity: Major
    Found in research/slim/nets/inception_v3_test.py and 4 other locations - About 4 hrs to fix
    research/slim/nets/inception_resnet_v2_test.py on lines 312..319
    research/slim/nets/inception_v1_test.py on lines 272..279
    research/slim/nets/inception_v2_test.py on lines 384..391
    research/slim/nets/inception_v4_test.py on lines 261..268

    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 85.

    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 9 locations. Consider refactoring.
    Open

        for endpoint_name in endpoints_shapes:
          expected_shape = endpoints_shapes[endpoint_name]
          self.assertTrue(endpoint_name in end_points)
          self.assertListEqual(end_points[endpoint_name].get_shape().as_list(),
                               expected_shape)
    Severity: Major
    Found in research/slim/nets/inception_v3_test.py and 8 other locations - About 2 hrs to fix
    research/slim/nets/inception_resnet_v2_test.py on lines 142..146
    research/slim/nets/inception_resnet_v2_test.py on lines 168..172
    research/slim/nets/inception_resnet_v2_test.py on lines 194..198
    research/slim/nets/inception_v1_test.py on lines 117..121
    research/slim/nets/inception_v1_test.py on lines 166..170
    research/slim/nets/inception_v2_test.py on lines 113..117
    research/slim/nets/inception_v2_test.py on lines 278..282
    research/slim/nets/inception_v4_test.py on lines 110..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 56.

    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