Python datasets.cifar10() Examples

The following are 2 code examples of datasets.cifar10(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module datasets , or try the search function .
Example #1
Source File: main_train_networks.py    From curriculum_learning with GNU General Public License v3.0 6 votes vote down vote up
def load_dataset(dataset_name):
    
    if dataset_name.startswith('cifar100_subset'):
        superclass_idx = int(dataset_name[len("cifar100_subset_"):])
        dataset = datasets.cifar100_subset.Cifar100_Subset(supeclass_idx=superclass_idx,
                                                  normalize=False)
    
    elif dataset_name == "cifar10":
        dataset = datasets.cifar10.Cifar10(normalize=False)

    elif dataset_name == "cifar100":
        dataset = datasets.cifar100.Cifar100(normalize=False)
        
    else:
        print("do not support datset: %s" % dataset_name)
        raise ValueError

    return dataset 
Example #2
Source File: vgg_train.py    From keras-deepcv with MIT License 4 votes vote down vote up
def parse_args():
	"""
	Parse command line arguments.

	Parameters:
		None
	Returns:
		parser arguments
	"""
	parser = argparse.ArgumentParser(description='LeNet model')
	optional = parser._action_groups.pop()
	required = parser.add_argument_group('required arguments')
	required.add_argument('--net',
		dest='net',
		help='Choice of network architecture',
		choices=['vgg16', 'vgg19'])
	optional.add_argument('--dataset',
		dest='dataset',
		help='Choice of dataset to train model',
		choices=[None, 'mnist', 'cifar10'],
		default=None)
	optional.add_argument('--print_model',
		dest='print_model',
		help='Print LeNet model',
		action='store_true')
	optional.add_argument('--train_model',
		dest='train_model',
		help='Train LeNet on MNIST',
		action='store_true')
	optional.add_argument('-s', '--save_weights',
		dest='save_weights',
		help='Save the trained weights',
		default=None)
	optional.add_argument('-w', '--weights',
		dest='weights',
		help='Path to weights (hdf5) file',
		default=None)
	optional.add_argument('-e', '--epochs',
		dest='epochs',
		help='Number of epochs for training',
		type=int,
		default=20)
	optional.add_argument('--data_augmentation',
		dest='data_augmentation',
		help='Use data augmentations for input',
		action='store_true')
	optional.add_argument('--viz_training',
		dest='viz_training',
		help='Visualize the training curve',
		action='store_true')
	parser._action_groups.append(optional)
	return parser.parse_args()