def test_close_early(self): sampler = WeightedSampler(reader=get_2d_reader(), data_param=MOD_2D_DATA, batch_size=2, windows_per_image=10, queue_length=10) sampler.close_all()
def test_close_early(self): sampler = WeightedSampler(reader=get_2d_reader(), data_param=MOD_2D_DATA, batch_size=2, windows_per_image=10, queue_length=10) sampler.close_all()
def test_dynamic_init(self): sampler = WeightedSampler(reader=get_dynamic_window_reader(), data_param=DYNAMIC_MOD_DATA, batch_size=2, windows_per_image=10, queue_length=10) with self.test_session() as sess: coordinator = tf.train.Coordinator() sampler.run_threads(sess, coordinator, num_threads=2) with self.assertRaisesRegexp(tf.errors.OutOfRangeError, ""): out = sess.run(sampler.pop_batch_op())
def test_dynamic_init(self): sampler = WeightedSampler(reader=get_dynamic_window_reader(), data_param=DYNAMIC_MOD_DATA, batch_size=2, windows_per_image=10, queue_length=10) with self.test_session() as sess: coordinator = tf.train.Coordinator() sampler.run_threads(sess, coordinator, num_threads=2) with self.assertRaisesRegexp(tf.errors.OutOfRangeError, ""): out = sess.run(sampler.pop_batch_op())
def test_dynamic_init(self): sampler = WeightedSampler(reader=get_dynamic_window_reader(), data_param=DYNAMIC_MOD_DATA, batch_size=2, windows_per_image=10, queue_length=10) with self.test_session() as sess: coordinator = tf.train.Coordinator() sampler.run_threads(sess, coordinator, num_threads=2) out = sess.run(sampler.pop_batch_op()) self.assertAllClose(out['image'].shape[1:], (8, 2, 256, 2))
def test_ill_init(self): with self.assertRaisesRegexp(KeyError, ""): sampler = WeightedSampler(reader=get_3d_reader(), data_param=MOD_2D_DATA, batch_size=2, windows_per_image=10, queue_length=10)
def initialise_weighted_sampler(self): self.sampler = [[WeightedSampler( reader=reader, data_param=self.data_param, batch_size=self.net_param.batch_size, windows_per_image=self.action_param.sample_per_volume, queue_length=self.net_param.queue_length) for reader in self.readers]]
def test_2d_init(self): sampler = WeightedSampler(reader=get_2d_reader(), data_param=MOD_2D_DATA, batch_size=2, windows_per_image=10, queue_length=10) with self.test_session() as sess: coordinator = tf.train.Coordinator() sampler.run_threads(sess, coordinator, num_threads=2) out = sess.run(sampler.pop_batch_op()) self.assertAllClose(out['image'].shape, (2, 10, 9, 1)) sampler.close_all()
def test_2d_init(self): sampler = WeightedSampler(reader=get_2d_reader(), data_param=MOD_2D_DATA, batch_size=2, windows_per_image=10, queue_length=10) with self.test_session() as sess: coordinator = tf.train.Coordinator() sampler.run_threads(sess, coordinator, num_threads=2) out = sess.run(sampler.pop_batch_op()) self.assertAllClose(out['image'].shape, (2, 10, 9, 1)) sampler.close_all()