本文整理汇总了Python中datasets.cifar10方法的典型用法代码示例。如果您正苦于以下问题:Python datasets.cifar10方法的具体用法?Python datasets.cifar10怎么用?Python datasets.cifar10使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类datasets
的用法示例。
在下文中一共展示了datasets.cifar10方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: load_dataset
# 需要导入模块: import datasets [as 别名]
# 或者: from datasets import cifar10 [as 别名]
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
示例2: parse_args
# 需要导入模块: import datasets [as 别名]
# 或者: from datasets import cifar10 [as 别名]
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()