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

Function get_data

examples/ImageNetModels/shufflenet.py:157–186  ·  view source on GitHub ↗
(name, batch)

Source from the content-addressed store, hash-verified

155
156
157def get_data(name, batch):
158 isTrain = name == 'train'
159
160 if isTrain:
161 augmentors = [
162 # use lighter augs if model is too small
163 imgaug.GoogleNetRandomCropAndResize(crop_area_fraction=(0.49 if args.ratio < 1 else 0.08, 1.)),
164 imgaug.RandomOrderAug(
165 [imgaug.BrightnessScale((0.6, 1.4), clip=False),
166 imgaug.Contrast((0.6, 1.4), clip=False),
167 imgaug.Saturation(0.4, rgb=False),
168 # rgb-bgr conversion for the constants copied from fb.resnet.torch
169 imgaug.Lighting(0.1,
170 eigval=np.asarray(
171 [0.2175, 0.0188, 0.0045][::-1]) * 255.0,
172 eigvec=np.array(
173 [[-0.5675, 0.7192, 0.4009],
174 [-0.5808, -0.0045, -0.8140],
175 [-0.5836, -0.6948, 0.4203]],
176 dtype='float32')[::-1, ::-1]
177 )]),
178 imgaug.Flip(horiz=True),
179 ]
180 else:
181 augmentors = [
182 imgaug.ResizeShortestEdge(256, cv2.INTER_CUBIC),
183 imgaug.CenterCrop((224, 224)),
184 ]
185 return get_imagenet_dataflow(
186 args.data, name, batch, augmentors)
187
188
189def get_config(model, nr_tower):

Callers 2

get_configFunction · 0.70
shufflenet.pyFile · 0.70

Calls 1

get_imagenet_dataflowFunction · 0.90

Tested by

no test coverage detected