(self)
return splits
Create splits for VGG Flower and store them in the default path.

    If no split file is provided, and the default location for VGG Flower splits
    does not contain a split file, splits are randomly created in this
    function using 70%, 15%, and 15% of the data for training, validation and
    testing, respectively, and then stored in that default location.

    Returns:
      The splits for this dataset, represented as a dictionary mapping each of
      'train', 'valid', and 'test' to a list of class integers.
Create splits for VGG Flower and store them in the default path.
Create splits for VGG Flower and store them in the default path .
def create_splits(self):
    """Create splits for VGG Flower and store them in the default path.

    If no split file is provided, and the default location for VGG Flower splits
    does not contain a split file, splits are randomly created in this
    function using 70%, 15%, and 15% of the data for training, validation and
    testing, respectively, and then stored in that default location.

    Returns:
      The splits for this dataset, represented as a dictionary mapping each of
      'train', 'valid', and 'test' to a list of class integers.
    """
    # Load class names from the text file
    file_path = VGGFLOWER_LABELS_PATH
    with tf.io.gfile.GFile(file_path) as fd:
      all_lines = fd.read()
    # First line is expected to be a comment.
    class_names = all_lines.splitlines()[1:]
    err_msg = 'number of classes in dataset does not match split specification'
    assert len(class_names) == self.NUM_TOTAL_CLASSES, err_msg

    # Provided class labels are numbers started at 1.
    train_inds, valid_inds, test_inds = gen_rand_split_inds(
        self.NUM_TRAIN_CLASSES, self.NUM_VALID_CLASSES, self.NUM_TEST_CLASSES)
    format_str = '%%0%dd.%%s' % self.ID_LEN
    splits = {
        'train': [format_str % (i + 1, class_names[i]) for i in train_inds],
        'valid': [format_str % (i + 1, class_names[i]) for i in valid_inds],
        'test': [format_str % (i + 1, class_names[i]) for i in test_inds]
    }
    return splits
def create_splits ( self ) : # Load class names from the text file file_path = VGGFLOWER_LABELS_PATH with tf . io . gfile . GFile ( file_path ) as fd : all_lines = fd . read ( ) # First line is expected to be a comment. class_names = all_lines . splitlines ( ) [ 1 : ] err_msg = 'number of classes in dataset does not match split specification' assert len ( class_names ) == self . NUM_TOTAL_CLASSES , err_msg # Provided class labels are numbers started at 1. train_inds , valid_inds , test_inds = gen_rand_split_inds ( self . NUM_TRAIN_CLASSES , self . NUM_VALID_CLASSES , self . NUM_TEST_CLASSES ) format_str = '%%0%dd.%%s' % self . ID_LEN splits = { 'train' : [ format_str % ( i + 1 , class_names [ i ] ) for i in train_inds ] , 'valid' : [ format_str % ( i + 1 , class_names [ i ] ) for i in valid_inds ] , 'test' : [ format_str % ( i + 1 , class_names [ i ] ) for i in test_inds ] } return splits