tensorflow/models

View on GitHub

Showing 11,634 of 11,634 total issues

Function build_maskrcnn has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

def build_maskrcnn(input_specs: tf_keras.layers.InputSpec,
                   model_config: maskrcnn_cfg.MaskRCNN,
                   l2_regularizer: Optional[
                       tf_keras.regularizers.Regularizer] = None,
                   backbone: Optional[tf_keras.Model] = None,
Severity: Minor
Found in official/vision/modeling/factory.py - About 1 hr to fix

    Function __init__ has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def __init__(self,
                   model_id: str,
                   input_specs: tf_keras.layers.InputSpec = layers.InputSpec(
                       shape=[None, None, None, 3]),
                   se_ratio: float = 0.0,
    Severity: Minor
    Found in official/vision/modeling/backbones/efficientnet.py - About 1 hr to fix

      Function __init__ has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def __init__(
            self,
            model_id: int,
            output_stride: int,
            input_specs: tf_keras.layers.InputSpec = layers.InputSpec(
      Severity: Minor
      Found in official/vision/modeling/backbones/resnet_deeplab.py - About 1 hr to fix

        Function __init__ has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def __init__(self,
                       vocab_size,
                       hidden_size=768,
                       num_layers=12,
                       num_attention_heads=12,
        Severity: Minor
        Found in official/projects/bigbird/encoder.py - About 1 hr to fix

          Function test_export_model has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def test_export_model(self):
              # Exports a savedmodel for TF-Hub
              hidden_size = 16
              bert_config = configs.BertConfig(
                  vocab_size=100,
          Severity: Minor
          Found in official/projects/labse/export_tfhub_test.py - About 1 hr to fix

            Function _build_transform has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            def _build_transform(image,
                                 perspective=0.00,
                                 degrees=0.0,
                                 scale_min=1.0,
                                 scale_max=1.0,
            Severity: Minor
            Found in official/projects/yolo/ops/preprocessing_ops.py - About 1 hr to fix

              Function assign_centernet_targets has 28 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              def assign_centernet_targets(labels: Dict[str, tf.Tensor],
                                           output_size: List[int],
                                           input_size: List[int],
                                           num_classes: int = 90,
                                           max_num_instances: int = 128,
              Severity: Minor
              Found in official/projects/centernet/ops/target_assigner.py - About 1 hr to fix

                Function reduce_aggregated_logs has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  def reduce_aggregated_logs(self, aggregated_logs, global_step=None):
                    sentence_prediction_is_entity = np.concatenate(
                        aggregated_logs['sentence_prediction_is_entity'], axis=0)
                    sentence_prediction_is_entity = np.reshape(
                        sentence_prediction_is_entity,
                Severity: Minor
                Found in official/projects/fffner/fffner_prediction.py - About 1 hr to fix

                  Function test_movinet_export_a0_stream_with_tflite has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    def test_movinet_export_a0_stream_with_tflite(self):
                      saved_model_path = self.get_temp_dir()
                  
                      FLAGS.export_path = saved_model_path
                      FLAGS.model_id = 'a0'
                  Severity: Minor
                  Found in official/projects/movinet/tools/export_saved_model_test.py - About 1 hr to fix

                    Function Top1Accuracy has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def Top1Accuracy(predictions, recognition_solution):
                      """Computes top-1 accuracy for recognition prediction.
                    
                      Note that test images without ground-truth are ignored.
                    
                    

                    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 ReadMetricsFile has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def ReadMetricsFile(metrics_path):
                      """Reads aggregated retrieval metrics from text file.
                    
                      Args:
                        metrics_path: Full file path, containing aggregated retrieval metrics.
                    Severity: Minor
                    Found in research/delf/delf/python/datasets/revisited_op/dataset.py - About 1 hr to fix

                    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 ResizeImage has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def ResizeImage(image, config, resize_factor=1.0):
                      """Resizes image according to config.
                    
                      Args:
                        image: Uint8 array with shape (height, width, 3).
                    Severity: Minor
                    Found in research/delf/delf/python/utils.py - About 1 hr to fix

                    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 main has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def main(argv):
                      if len(argv) > 1:
                        raise RuntimeError('Too many command-line arguments.')
                    
                      # Read list of images.
                    Severity: Minor
                    Found in research/delf/delf/python/examples/extract_boxes.py - About 1 hr to fix

                    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 main has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def main(argv):
                      if len(argv) > 1:
                        raise RuntimeError('Too many command-line arguments.')
                    
                      # Read list of images.
                    Severity: Minor
                    Found in research/delf/delf/python/delg/measure_latency.py - About 1 hr to fix

                    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 main has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def main(argv):
                      if len(argv) > 1:
                        raise RuntimeError('Too many command-line arguments.')
                    
                      # Parse dataset to obtain query/index images, and ground-truth.
                    Severity: Minor
                    Found in research/delf/delf/python/detect_to_retrieve/perform_retrieval.py - About 1 hr to fix

                    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 get_tags has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def get_tags(span_labels, length, encoding):
                      """Converts a list of entities to token-label labels based on the provided
                      encoding (e.g., BIOES).
                      """
                    
                    
                    Severity: Minor
                    Found in research/cvt_text/task_specific/word_level/tagging_utils.py - About 1 hr to fix

                    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 __init__ has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def __init__(self, architecture='ResNet101', pooling='gem',
                                   whitening=False, pretrained=True, data_root=''):
                        """GlobalFeatureNet network initialization.
                    
                        Args:
                    Severity: Minor
                    Found in research/delf/delf/python/training/model/global_model.py - About 1 hr to fix

                    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 main has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def main(unused_argv):
                      tf.logging.set_verbosity(tf.logging.INFO)
                    
                      dataset = data_generator.Dataset(
                          dataset_name=FLAGS.dataset,
                    Severity: Minor
                    Found in research/deeplab/eval.py - About 1 hr to fix

                    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 get_model_gradient_multipliers has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def get_model_gradient_multipliers(last_layers, last_layer_gradient_multiplier):
                      """Gets the gradient multipliers.
                    
                      The gradient multipliers will adjust the learning rates for model
                      variables. For the task of semantic segmentation, the models are
                    Severity: Minor
                    Found in research/deeplab/utils/train_utils.py - About 1 hr to fix

                    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 train has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def train(train_model, pretrained_ckpt, checkpoint_dir, train_steps,
                              summary_freq):
                      """Train model."""
                      if pretrained_ckpt is not None:
                        vars_to_restore = util.get_vars_to_restore(pretrained_ckpt)
                    Severity: Minor
                    Found in research/vid2depth/train.py - About 1 hr to fix

                    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

                    Severity
                    Category
                    Status
                    Source
                    Language