(train_or_test)
| 114 | |
| 115 | |
| 116 | def 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 | |
| 138 | if __name__ == '__main__': |
no test coverage detected
searching dependent graphs…