def test_complex_loader(self): d = Dataset('data').use_like_video().include_reg('hr/xiuxian') hr = d.compile() d = Dataset('data').use_like_video().include_reg('lr/xiuxian') lr = d.compile() ld = Loader(hr, lr, threads=4) ld.image_augmentation() ld.cropper(RandomCrop(2)) itr = ld.make_one_shot_iterator([4, 3, 3, 16, 16], 10, shuffle=True) ret = list(itr) self.assertEqual(len(ret), 10) self.assert_psnr(ret)
def test_include_exclude(): d = Dataset('data') d.include_('xiuxian*') data1 = d.compile() d = Dataset('data') d.include_reg_('set5') data2 = d.compile() d = Dataset('data').include_reg('set5').exclude('png') data3 = d.compile() assert len(data1) is 6 assert len(data2) is 5 assert len(data3) is 0
def test_include_exclude(self): d = Dataset('data') d.include_('xiuxian*') data1 = d.compile() d = Dataset('data') d.include_reg_('set5') data2 = d.compile() d = Dataset('data').include_reg('set5').exclude('png') data3 = d.compile() self.assertEqual(len(data1), 6) self.assertEqual(len(data2), 5) self.assertEqual(len(data3), 0)
def test_no_shuffle(self): d = Dataset('data/').include('*.png') data = d.compile() ld = Loader(data, data, threads=4) ld.cropper(CenterCrop(1)) itr1 = ld.make_one_shot_iterator([1, 3, 16, 16], -1, False) ret1 = list(itr1) self.assertEqual(len(ret1), 16) self.assert_psnr(ret1) itr2 = ld.make_one_shot_iterator([1, 3, 16, 16], -1, False) ret2 = list(itr2) self.assertEqual(len(ret2), 16) self.assert_psnr(ret2) for x, y in zip(ret1, ret2): self.assertTrue(np.all((x['hr'] - y['hr']) < 1e-4))
def test_no_shuffle_limit(self): d = Dataset('data/') d = d.include('*.png') data = d.compile() ld = Loader(data, data, threads=4) ld.cropper(RandomCrop(1)) ld.image_augmentation() itr = ld.make_one_shot_iterator([4, 3, 16, 16], 10, False, data.capacity / 2) ret = list(itr) self.assertEqual(len(ret), 10) self.assert_psnr(ret) itr = ld.make_one_shot_iterator([4, 3, 16, 16], 10, False, data.capacity / 2) ret = list(itr) self.assertEqual(len(ret), 10) self.assert_psnr(ret)
def test_memory_limit(): d = Dataset('data/') d = d.include('*.png') data = d.compile() ld = Loader(data, data, threads=4) ld.cropper(RandomCrop(1)) ld.image_augmentation() itr = ld.make_one_shot_iterator([4, 3, 16, 16], 10, True, data.capacity / 2) ret = list(itr) assert len(ret) is 10 assert_psnr(ret) itr = ld.make_one_shot_iterator([4, 3, 16, 16], 10, True, data.capacity / 2) ret = list(itr) assert len(ret) is 10 assert_psnr(ret)
def test_image_data(): d = Dataset('data/set5_x2') data = d.compile() assert len(data) is 5 assert data.capacity == 983040
def test_multi_url(): d = Dataset('data/set5_x2', 'data/kitti_car') data = d.compile() assert len(data) is 8
def test_video_data(): d = Dataset('data/video/custom_pair').use_like_video() data = d.compile() assert len(data) is 2
def test_multi_url(self): d = Dataset('data/set5_x2', 'data/kitti_car') data = d.compile() self.assertEqual(len(data), 8)
def test_video_data(self): d = Dataset('data/video/custom_pair').use_like_video() data = d.compile() self.assertEqual(len(data), 2)
def test_image_data(self): d = Dataset('data/set5_x2') data = d.compile() self.assertEqual(len(data), 5) self.assertEqual(data.capacity, 983040)