tensorflow/models

View on GitHub
research/slim/preprocessing/vgg_preprocessing.py

Summary

Maintainability
F
1 wk
Test Coverage

File vgg_preprocessing.py has 287 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/preprocessing/vgg_preprocessing.py - About 2 hrs to fix

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

    def preprocess_image(image,
    Severity: Major
    Found in research/slim/preprocessing/vgg_preprocessing.py - About 50 mins to fix

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

      def preprocess_for_train(image,
      Severity: Minor
      Found in research/slim/preprocessing/vgg_preprocessing.py - About 45 mins to fix

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

        def _crop(image, offset_height, offset_width, crop_height, crop_width):
        Severity: Minor
        Found in research/slim/preprocessing/vgg_preprocessing.py - About 35 mins to fix

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

          def preprocess_for_eval(image,
          Severity: Minor
          Found in research/slim/preprocessing/vgg_preprocessing.py - About 35 mins to fix

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

            def _random_crop(image_list, crop_height, crop_width):
              """Crops the given list of images.
            
              The function applies the same crop to each image in the list. This can be
              effectively applied when there are multiple image inputs of the same
            Severity: Major
            Found in research/slim/preprocessing/vgg_preprocessing.py and 1 other location - About 4 days to fix
            research/cognitive_planning/preprocessing/vgg_preprocessing.py on lines 90..170

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

            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 _crop(image, offset_height, offset_width, crop_height, crop_width):
              """Crops the given image using the provided offsets and sizes.
            
              Note that the method doesn't assume we know the input image size but it does
              assume we know the input image rank.
            Severity: Major
            Found in research/slim/preprocessing/vgg_preprocessing.py and 1 other location - About 1 day to fix
            research/cognitive_planning/preprocessing/vgg_preprocessing.py on lines 47..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 187.

            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 _smallest_size_at_least(height, width, smallest_side):
              """Computes new shape with the smallest side equal to `smallest_side`.
            
              Computes new shape with the smallest side equal to `smallest_side` while
              preserving the original aspect ratio.
            Severity: Major
            Found in research/slim/preprocessing/vgg_preprocessing.py and 1 other location - About 1 day to fix
            research/cognitive_planning/preprocessing/vgg_preprocessing.py on lines 231..258

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

            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 _mean_image_subtraction(image, means):
              """Subtracts the given means from each image channel.
            
              For example:
                means = [123.68, 116.779, 103.939]
            Severity: Major
            Found in research/slim/preprocessing/vgg_preprocessing.py and 1 other location - About 1 day to fix
            research/cognitive_planning/preprocessing/vgg_preprocessing.py on lines 198..228

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

            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 _aspect_preserving_resize(image, smallest_side):
              """Resize images preserving the original aspect ratio.
            
              Args:
                image: A 3-D image `Tensor`.
            Severity: Major
            Found in research/slim/preprocessing/vgg_preprocessing.py and 1 other location - About 1 day to fix
            research/cognitive_planning/preprocessing/vgg_preprocessing.py on lines 261..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 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

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

            def _central_crop(image_list, crop_height, crop_width):
              """Performs central crops of the given image list.
            
              Args:
                image_list: a list of image tensors of the same dimension but possibly
            Severity: Major
            Found in research/slim/preprocessing/vgg_preprocessing.py and 1 other location - About 7 hrs to fix
            research/cognitive_planning/preprocessing/vgg_preprocessing.py on lines 173..195

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

            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