Пример #1
0
    def add_transforms(key, datasets, exclude=None):
        warnings.warn('You are using an outdated `add_transform` kept for backward compatibility. Do not use this in new networks.')
        if exclude is not None:
            log.info('Excluding "{}" from normalization'.format(
                '", "'.join(exclude)))
        for k, dataset in datasets.items():
            transforms = []
            if key['normalize']:
                transforms.append(Normalizer(
                    dataset, stats_source=key['stats_source'],
                    buggy=True, normalize_per_image=True, exclude=exclude))
            transforms.append(ToTensor())
            dataset.transforms = transforms

        return datasets
Пример #2
0
    def add_transforms(key, datasets, exclude=None):
        if exclude is not None:
            log.info('Excluding "{}" from normalization'.format(
                '", "'.join(exclude)))
        for k, dataset in datasets.items():
            transforms = []

            if key.get('normalize', True):
                transforms.append(Normalizer(
                    dataset,
                    stats_source=key.get('stats_source', 'all'),
                    normalize_per_image=key.get('normalize_per_image', False),
                    exclude=exclude))
            transforms.append(ToTensor())
            dataset.transforms = transforms

        return datasets