(self)
return splits
Create splits for Quickdraw and store them in the default path.
Create splits for Quickdraw and store them in the default path.
Create splits for Quickdraw and store them in the default path .
def create_splits(self):
    """Create splits for Quickdraw and store them in the default path."""
    # Quickdraw is stored in a number of .npy files, one for every class
    # with each .npy file storing an array containing the images of that class.
    class_npy_files = sorted(tf.io.gfile.listdir(self.data_root))
    class_names = [fname[:fname.find('.')] for fname in class_npy_files]
    # Sort the class names, for reproducibility.
    class_names.sort()
    num_classes = len(class_npy_files)
    # Split into train, validation and test splits that have 70% / 15% / 15%
    # of the data, respectively.
    num_trainval_classes = int(0.85 * num_classes)
    num_train_classes = int(0.7 * num_classes)
    num_valid_classes = num_trainval_classes - num_train_classes
    num_test_classes = num_classes - num_trainval_classes

    train_inds, valid_inds, test_inds = gen_rand_split_inds(
        num_train_classes, num_valid_classes, num_test_classes)
    splits = {
        'train': [class_names[i] for i in train_inds],
        'valid': [class_names[i] for i in valid_inds],
        'test': [class_names[i] for i in test_inds]
    }
    return splits
def create_splits ( self ) : # Quickdraw is stored in a number of .npy files, one for every class # with each .npy file storing an array containing the images of that class. class_npy_files = sorted ( tf . io . gfile . listdir ( self . data_root ) ) class_names = [ fname [ : fname . find ( '.' ) ] for fname in class_npy_files ] # Sort the class names, for reproducibility. class_names . sort ( ) num_classes = len ( class_npy_files ) # Split into train, validation and test splits that have 70% / 15% / 15% # of the data, respectively. num_trainval_classes = int ( 0.85 * num_classes ) num_train_classes = int ( 0.7 * num_classes ) num_valid_classes = num_trainval_classes - num_train_classes num_test_classes = num_classes - num_trainval_classes train_inds , valid_inds , test_inds = gen_rand_split_inds ( num_train_classes , num_valid_classes , num_test_classes ) splits = { 'train' : [ class_names [ i ] for i in train_inds ] , 'valid' : [ class_names [ i ] for i in valid_inds ] , 'test' : [ class_names [ i ] for i in test_inds ] } return splits