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

Function get_data

examples/SuperResolution/enet-pat.py:241–258  ·  view source on GitHub ↗
(file_name)

Source from the content-addressed store, hash-verified

239
240
241def get_data(file_name):
242 if file_name.endswith('.lmdb'):
243 ds = LMDBSerializer.load(file_name, shuffle=True)
244 ds = ImageDecode(ds, index=0)
245 elif file_name.endswith('.zip'):
246 ds = ImageDataFromZIPFile(file_name, shuffle=True)
247 ds = ImageDecode(ds, index=0)
248 ds = RejectTooSmallImages(ds, index=0)
249 ds = CenterSquareResize(ds, index=0)
250 else:
251 raise ValueError("Unknown file format " + file_name)
252 augmentors = [imgaug.RandomCrop(128),
253 imgaug.Flip(horiz=True)]
254 ds = AugmentImageComponent(ds, augmentors, index=0, copy=True)
255 ds = MapData(ds, lambda x: [cv2.resize(x[0], (32, 32), interpolation=cv2.INTER_CUBIC), x[0]])
256 ds = MultiProcessRunnerZMQ(ds, 3)
257 ds = BatchData(ds, BATCH_SIZE)
258 return ds
259
260
261if __name__ == '__main__':

Callers 1

enet-pat.pyFile · 0.70

Calls 9

ImageDecodeClass · 0.90
CenterSquareResizeClass · 0.90
MapDataClass · 0.85
BatchDataClass · 0.85
loadMethod · 0.45

Tested by

no test coverage detected