class_docstr: Computes the statistics for features of image format.
docstr: Return result of converting accumulator into the output value.
  
  Args:
    accumulator: The final accumulator value.
  
  Returns:
    A proto representing the result of this stats generator.
code: def extract_output(
      self, accumulator: _PartialImageStats
  ) -> statistics_pb2.FeatureNameStatistics:
      """Return result of converting accumulator into the output value.
  
      Args:
        accumulator: The final accumulator value.
  
      Returns:
        A proto representing the result of this stats generator.
      """
      result = statistics_pb2.FeatureNameStatistics()
      # Only generate an image statistics proto if the ratio of image feature
      # values is at or above a threshold.
      if (
          accumulator.invalidate
          or accumulator.total_num_values < self._values_threshold
          or (
              1
              - (
                  float(accumulator.counter_by_format[""])
                  / accumulator.total_num_values
              )
          )
          < self._is_image_ratio_threshold
      ):
          return result
  
      result.custom_stats.add(name=_DOMAIN_INFO, str=_IMAGE_DOMAIN)
      # Image format histogram.
      custom_stats = result.custom_stats.add(
          name=_IMAGE_FORMAT_HISTOGRAM
      )
  
      # Add the buckets with sorted image format.
      for image_format in sorted(accumulator.counter_by_format):
          custom_stats.rank_histogram.buckets.add(
              # LINT.IfChange
              label=image_format if image_format else "UNKNOWN",
              # image_domain_util.cc relies on unsupported image formats being
              # being assigned to the bucket labeled 'UNKNOWN'. If this labeling
              # changes, change the corresponding code accordingly.
              # LINT.ThenChange(../../anomalies/image_domain_util.cc)
              sample_count=accumulator.counter_by_format[image_format],
          )
      if self._enable_size_stats:
          result.custom_stats.add(
              name=_IMAGE_MAX_WIDTH_STATISTICS,
              num=accumulator.max_width,
          )
          result.custom_stats.add(
              name=_IMAGE_MAX_HEIGHT_STATISTICS,
              num=accumulator.max_height,
          )
      return result
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import abc
  import collections
  from typing import Iterable, List, Optional, Text
  import numpy
  import pandas
  import pyarrow
  import six
  import tensorflow
  from tensorflow_data_validation import types
  from tensorflow_data_validation.statistics.generators import stats_generator
  from tensorflow_data_validation.utils import stats_util
  from tfx_bsl.arrow import array_util
  from tensorflow_metadata.proto.v0 import statistics_pb2
label_desc: Use image node_id 5 for calling the ImageStatsGenerator obj's underlying member method code with example usage: obj.extract_output(accumulator) and returns: result, result