Esempio n. 1
0
def test_memory_usage():
    dut = DATASETS['GOPRO']
    epochs = 4
    config = Config(batch=16, scale=4, depth=1, patch_size=196,
                    steps_per_epoch=100, convert_to='RGB', crop='random')
    loader = QuickLoader(dut, 'train', config, True, n_threads=8)
    for i in range(epochs):
        it = loader.make_one_shot_iterator('1GB', True)
        loader.prefetch('1GB')
        list(it)
def test_read_flow():
    from VSR.Framework.Callbacks import _viz_flow
    dut = DATASETS['MINICHAIRS']
    config = Config(batch=8, scale=1, depth=2, patch_size=96, steps_per_epoch=100, convert_to='RGB', crop='random')
    loader = QuickLoader(dut, 'train', config, True, n_threads=8)
    r = loader.make_one_shot_iterator('1GB', shuffle=True)
    loader.prefetch('1GB')
    list(r)
    r = loader.make_one_shot_iterator('8GB', shuffle=True)
    img, flow, name = list(r)[0]

    ref0 = img[0, 0, ...]
    ref1 = img[0, 1, ...]
    u = flow[0, 0, ..., 0]
    v = flow[0, 0, ..., 1]
    ImageProcess.array_to_img(ref0, 'RGB').show()
    ImageProcess.array_to_img(ref1, 'RGB').show()
    ImageProcess.array_to_img(_viz_flow(u, v), 'RGB').show()