(data_spec, class_id=None, pool=None)
return num_images
Returns the total number of images of a class in a data_spec and pool.

  Args:
    data_spec: A DatasetSpecification, or BiLevelDatasetSpecification.
    class_id: The class whose number of images will be returned. If this is
      None, it is assumed that the dataset has the same number of images for
      each class.
    pool: A string ('train' or 'test', optional) indicating which example-level
      split to select, if the current dataset has them.

  Raises:
    ValueError: when
      - no class_id specified and yet there is class imbalance, or
      - no pool specified when there are example-level splits, or
      - pool is specified but there are no example-level splits, or
      - incorrect value for pool.
    RuntimeError: the DatasetSpecification is out of date (missing info).
Returns the total number of images of a class in a data_spec and pool.
Returns the total number of images of a class in a data_spec and pool .
def get_total_images_per_class(data_spec, class_id=None, pool=None):
  """Returns the total number of images of a class in a data_spec and pool.

  Args:
    data_spec: A DatasetSpecification, or BiLevelDatasetSpecification.
    class_id: The class whose number of images will be returned. If this is
      None, it is assumed that the dataset has the same number of images for
      each class.
    pool: A string ('train' or 'test', optional) indicating which example-level
      split to select, if the current dataset has them.

  Raises:
    ValueError: when
      - no class_id specified and yet there is class imbalance, or
      - no pool specified when there are example-level splits, or
      - pool is specified but there are no example-level splits, or
      - incorrect value for pool.
    RuntimeError: the DatasetSpecification is out of date (missing info).
  """
  if class_id is None:
    if len(set(data_spec.images_per_class.values())) != 1:
      raise ValueError('Not specifying class_id is okay only when all classes'
                       ' have the same number of images')
    class_id = 0

  if class_id not in data_spec.images_per_class:
    raise RuntimeError('The DatasetSpecification should be regenerated, as '
                       'it does not have a non-default value for class_id {} '
                       'in images_per_class.'.format(class_id))
  num_images = data_spec.images_per_class[class_id]

  if pool is None:
    if isinstance(num_images, collections.Mapping):
      raise ValueError('DatasetSpecification {} has example-level splits, so '
                       'the "pool" argument has to be set (to "train" or '
                       '"test".'.format(data_spec.name))
  elif not data.POOL_SUPPORTED:
    raise NotImplementedError('Example-level splits or pools not supported.')

  return num_images
def get_total_images_per_class ( data_spec , class_id = None , pool = None ) : if class_id is None : if len ( set ( data_spec . images_per_class . values ( ) ) ) != 1 : raise ValueError ( 'Not specifying class_id is okay only when all classes' ' have the same number of images' ) class_id = 0 if class_id not in data_spec . images_per_class : raise RuntimeError ( 'The DatasetSpecification should be regenerated, as ' 'it does not have a non-default value for class_id {} ' 'in images_per_class.' . format ( class_id ) ) num_images = data_spec . images_per_class [ class_id ] if pool is None : if isinstance ( num_images , collections . Mapping ) : raise ValueError ( 'DatasetSpecification {} has example-level splits, so ' 'the "pool" argument has to be set (to "train" or ' '"test".' . format ( data_spec . name ) ) elif not data . POOL_SUPPORTED : raise NotImplementedError ( 'Example-level splits or pools not supported.' ) return num_images