tensorflow/models

View on GitHub
research/deeplab/evaluation/streaming_metrics_test.py

Summary

Maintainability
F
4 days
Test Coverage

File streaming_metrics_test.py has 489 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# Lint as: python2, python3
# Copyright 2019 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.
Severity: Minor
Found in research/deeplab/evaluation/streaming_metrics_test.py - About 7 hrs to fix

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

        with self.session() as sess:
          sess.run(tf.local_variables_initializer())
          for pred_class, pred_instance, gt_class, gt_instance in six.moves.zip(
              pred_classes, pred_instances, gt_classes, gt_instances):
            sess.run(
    Severity: Major
    Found in research/deeplab/evaluation/streaming_metrics_test.py and 1 other location - About 6 hrs to fix
    research/deeplab/evaluation/streaming_metrics_test.py on lines 355..379

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

    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

        with self.session() as sess:
          sess.run(tf.local_variables_initializer())
          for pred_class, pred_instance, gt_class, gt_instance in six.moves.zip(
              pred_classes, pred_instances, gt_classes, gt_instances):
            sess.run(
    Severity: Major
    Found in research/deeplab/evaluation/streaming_metrics_test.py and 1 other location - About 6 hrs to fix
    research/deeplab/evaluation/streaming_metrics_test.py on lines 486..510

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

    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

        for test_image in test_images:
          (image_gt_instances,
           image_gt_classes) = test_utils.panoptic_segmentation_with_class_map(
               test_image.gt_path, test_image.gt_class_map)
          gt_classes.append(image_gt_classes)
    Severity: Major
    Found in research/deeplab/evaluation/streaming_metrics_test.py and 1 other location - About 4 hrs to fix
    research/deeplab/evaluation/streaming_metrics_test.py on lines 456..467

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

    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

        for test_image in test_images:
          (image_gt_instances,
           image_gt_classes) = test_utils.panoptic_segmentation_with_class_map(
               test_image.gt_path, test_image.gt_class_map)
          gt_classes.append(image_gt_classes)
    Severity: Major
    Found in research/deeplab/evaluation/streaming_metrics_test.py and 1 other location - About 4 hrs to fix
    research/deeplab/evaluation/streaming_metrics_test.py on lines 325..336

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

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

    _CLASS_COLOR_MAP = {
        (0, 0, 0): 0,
        (0, 0, 255): 1,  # Person (blue).
        (255, 0, 0): 2,  # Bear (red).
        (0, 255, 0): 3,  # Tree (lime).
    Severity: Major
    Found in research/deeplab/evaluation/streaming_metrics_test.py and 2 other locations - About 1 hr to fix
    research/deeplab/evaluation/panoptic_quality_test.py on lines 32..39
    research/deeplab/evaluation/parsing_covering_test.py on lines 32..39

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

    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

        coverings, update_ops = streaming_metrics.streaming_parsing_covering(
            gt_class_tensor,
            gt_instance_tensor,
            pred_class_tensor,
            pred_instance_tensor,
    Severity: Minor
    Found in research/deeplab/evaluation/streaming_metrics_test.py and 1 other location - About 35 mins to fix
    research/deeplab/evaluation/streaming_metrics_test.py on lines 473..477

    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

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

        coverings, update_ops = streaming_metrics.streaming_parsing_covering(
            gt_class_tensor,
            gt_instance_tensor,
            pred_class_tensor,
            pred_instance_tensor,
    Severity: Minor
    Found in research/deeplab/evaluation/streaming_metrics_test.py and 1 other location - About 35 mins to fix
    research/deeplab/evaluation/streaming_metrics_test.py on lines 342..346

    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