MCPcopy
hub / github.com/microsoft/Cream / create_loader

Function create_loader

TinyViT/data/augmentation/loader.py:147–257  ·  view source on GitHub ↗
(
        dataset,
        input_size,
        batch_size,
        is_training=False,
        use_prefetcher=True,
        no_aug=False,
        re_prob=0.,
        re_mode='const',
        re_count=1,
        re_split=False,
        scale=None,
        ratio=None,
        hflip=0.5,
        vflip=0.,
        color_jitter=0.4,
        auto_augment=None,
        num_aug_repeats=0,
        num_aug_splits=0,
        interpolation='bilinear',
        mean=IMAGENET_DEFAULT_MEAN,
        std=IMAGENET_DEFAULT_STD,
        num_workers=1,
        distributed=False,
        crop_pct=None,
        collate_fn=None,
        pin_memory=False,
        fp16=False,
        tf_preprocessing=False,
        use_multi_epochs_loader=False,
        persistent_workers=True,
        worker_seeding='all',
)

Source from the content-addressed store, hash-verified

145
146
147def create_loader(
148 dataset,
149 input_size,
150 batch_size,
151 is_training=False,
152 use_prefetcher=True,
153 no_aug=False,
154 re_prob=0.,
155 re_mode='const',
156 re_count=1,
157 re_split=False,
158 scale=None,
159 ratio=None,
160 hflip=0.5,
161 vflip=0.,
162 color_jitter=0.4,
163 auto_augment=None,
164 num_aug_repeats=0,
165 num_aug_splits=0,
166 interpolation='bilinear',
167 mean=IMAGENET_DEFAULT_MEAN,
168 std=IMAGENET_DEFAULT_STD,
169 num_workers=1,
170 distributed=False,
171 crop_pct=None,
172 collate_fn=None,
173 pin_memory=False,
174 fp16=False,
175 tf_preprocessing=False,
176 use_multi_epochs_loader=False,
177 persistent_workers=True,
178 worker_seeding='all',
179):
180 re_num_splits = 0
181 if re_split:
182 # apply RE to second half of batch if no aug split otherwise line up with aug split
183 re_num_splits = num_aug_splits or 2
184 dataset.transform = create_transform(
185 input_size,
186 is_training=is_training,
187 use_prefetcher=use_prefetcher,
188 no_aug=no_aug,
189 scale=scale,
190 ratio=ratio,
191 hflip=hflip,
192 vflip=vflip,
193 color_jitter=color_jitter,
194 auto_augment=auto_augment,
195 interpolation=interpolation,
196 mean=mean,
197 std=std,
198 crop_pct=crop_pct,
199 tf_preprocessing=tf_preprocessing,
200 re_prob=re_prob,
201 re_mode=re_mode,
202 re_count=re_count,
203 re_num_splits=re_num_splits,
204 separate=num_aug_splits > 0,

Callers 3

mainFunction · 0.90
mainFunction · 0.90
mainFunction · 0.90

Calls 4

create_transformFunction · 0.85
RepeatAugSamplerClass · 0.85
PrefetchLoaderClass · 0.85

Tested by 1

mainFunction · 0.72