Пример #1
0
test_image_transform = T.Compose([
    Resize(config.resize_size),
    center_crop,
    SplitInSites(),
    T.Lambda(lambda xs: torch.stack([to_tensor(x) for x in xs], 0)),
])
train_transform = T.Compose([
    ApplyTo(['image'],
            T.Compose([
                RandomSite(),
                Resize(config.resize_size),
                random_crop,
                RandomFlip(),
                RandomTranspose(),
                to_tensor,
                ChannelReweight(config.aug.channel_reweight),
            ])),
    normalize,
    Extract(['image', 'exp', 'label', 'id']),
])
eval_transform = T.Compose([
    ApplyTo(['image'], infer_image_transform),
    normalize,
    Extract(['image', 'exp', 'label', 'id']),
])
unsup_transform = T.Compose([
    ApplyTo(['image'],
            T.Compose([
                Resize(config.resize_size),
                random_crop,
                RandomFlip(),
Пример #2
0
random_crop = Resetable(RandomCrop)
center_crop = Resetable(CenterCrop)

train_transform = T.Compose([
    ApplyTo(
        ['image'],
        T.Compose([
            RandomSite(),
            Resize(config.resize_size),
            random_crop,
            RandomFlip(),
            RandomTranspose(),
            RandomRotation(180),  # FIXME:
            ToTensor(),
            ChannelReweight(config.aug.channel_weight),
        ])),
    # NormalizeByRefStats(),
    Extract(['image', 'feat', 'label', 'id']),
])
eval_transform = T.Compose([
    ApplyTo(
        ['image'],
        T.Compose([
            RandomSite(),  # FIXME:
            Resize(config.resize_size),
            center_crop,
            ToTensor(),
        ])),
    # NormalizeByRefStats(),
    Extract(['image', 'feat', 'label', 'id']),