Beispiel #1
0
def cifar10(tnum=2):
    dataset = mt_dataset.cifar10()

    channel_stats = dict(mean=[0.4914, 0.4822, 0.4465],
                         std=[0.2470, 0.2435, 0.2616])
    dataset['train_transformation'] = data.TransformNTimes(transforms.Compose([
        data.RandomTranslateWithReflect(4),
        transforms.RandomHorizontalFlip(),
        transforms.ToTensor(),
        transforms.Normalize(**channel_stats)
    ]),
                                                           n=tnum)

    dataset['datadir'] = 'third_party/' + dataset['datadir']
    return dataset
Beispiel #2
0
def cifar100():
    channel_stats = dict(mean=[0.4914, 0.4822, 0.4465],
                         std=[0.2470, 0.2435, 0.2616
                              ])  # should we use different stats - do this
    train_transformation = data.TransformTwice(
        transforms.Compose([
            data.RandomTranslateWithReflect(4),
            transforms.RandomHorizontalFlip(),
            transforms.ToTensor(),
            transforms.Normalize(**channel_stats)
        ]))
    eval_transformation = transforms.Compose(
        [transforms.ToTensor(),
         transforms.Normalize(**channel_stats)])

    return {
        'train_transformation': train_transformation,
        'eval_transformation': eval_transformation,
        'datadir': 'data-local/images/cifar/cifar100/by-image',
        'num_classes': 100
    }