(self, restricted_classes_per_split=None)
Initializes a DatasetSpecification.

    Args:
      restricted_classes_per_split: A dict that specifies for each split, a
        number to restrict its classes to. This number must be no greater than
        the total number of classes of that split. By default this is None and
        no restrictions are applied (all classes are used).

    Raises:
      ValueError: Invalid file_pattern provided
Initializes a DatasetSpecification.
Initializes a DatasetSpecification .
def initialize(self, restricted_classes_per_split=None):
    """Initializes a DatasetSpecification.

    Args:
      restricted_classes_per_split: A dict that specifies for each split, a
        number to restrict its classes to. This number must be no greater than
        the total number of classes of that split. By default this is None and
        no restrictions are applied (all classes are used).

    Raises:
      ValueError: Invalid file_pattern provided
    """
    # Check that the file_pattern adheres to one of the allowable forms
    if self.file_pattern not in ['{}.tfrecords', '{}_{}.tfrecords']:
      raise ValueError('file_pattern must be either "{}.tfrecords" or '
                       '"{}_{}.tfrecords" to support shards or splits.')
    if restricted_classes_per_split is not None:
      # Create a dict like classes_per_split of DatasetSpecification.
      classes_per_split = {}
      for split in self.superclasses_per_split.keys():
        num_split_classes = self._count_classes_in_superclasses(
            self.get_superclasses(split))
        classes_per_split[split] = num_split_classes

      _check_validity_of_restricted_classes_per_split(
          restricted_classes_per_split, classes_per_split)
    # The restriction in this case is applied in get_classes() below.
    self.restricted_classes_per_split = restricted_classes_per_split
def initialize ( self , restricted_classes_per_split = None ) : # Check that the file_pattern adheres to one of the allowable forms if self . file_pattern not in [ '{}.tfrecords' , '{}_{}.tfrecords' ] : raise ValueError ( 'file_pattern must be either "{}.tfrecords" or ' '"{}_{}.tfrecords" to support shards or splits.' ) if restricted_classes_per_split is not None : # Create a dict like classes_per_split of DatasetSpecification. classes_per_split = { } for split in self . superclasses_per_split . keys ( ) : num_split_classes = self . _count_classes_in_superclasses ( self . get_superclasses ( split ) ) classes_per_split [ split ] = num_split_classes _check_validity_of_restricted_classes_per_split ( restricted_classes_per_split , classes_per_split ) # The restriction in this case is applied in get_classes() below. self . restricted_classes_per_split = restricted_classes_per_split