MCPcopy Index your code
hub / github.com/tensorpack/tensorpack / get_data

Function get_data

examples/ResNet/cifar10-resnet.py:116–135  ·  view source on GitHub ↗
(train_or_test)

Source from the content-addressed store, hash-verified

114
115
116def get_data(train_or_test):
117 isTrain = train_or_test == 'train'
118 ds = dataset.Cifar10(train_or_test)
119 pp_mean = ds.get_per_pixel_mean(('train',))
120 if isTrain:
121 augmentors = [
122 imgaug.CenterPaste((40, 40)),
123 imgaug.RandomCrop((32, 32)),
124 imgaug.Flip(horiz=True),
125 imgaug.MapImage(lambda x: x - pp_mean),
126 ]
127 else:
128 augmentors = [
129 imgaug.MapImage(lambda x: x - pp_mean)
130 ]
131 ds = AugmentImageComponent(ds, augmentors)
132 ds = BatchData(ds, BATCH_SIZE, remainder=not isTrain)
133 if isTrain:
134 ds = MultiProcessRunner(ds, 3, 2)
135 return ds
136
137
138if __name__ == '__main__':

Callers 1

cifar10-resnet.pyFile · 0.70

Calls 4

BatchDataClass · 0.85
MultiProcessRunnerClass · 0.85
get_per_pixel_meanMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…