def testMultiTrain(self): data_dir = MNIST_DATA_DIR + MNIST_MULTI_TRAIN_FILE with self.test_session(graph=tf.Graph()) as sess: features = mnist_input_record.inputs(data_dir=data_dir, batch_size=1, split='train', num_targets=2, batch_capacity=2) coord = tf.train.Coordinator() threads = tf.train.start_queue_runners(coord=coord) images, labels, recons_image, spare_image = sess.run([ features['images'], features['labels'], features['recons_image'], features['spare_image'] ]) self.assertEqual((1, 10), labels.shape) self.assertEqual(2, np.sum(labels)) self.assertItemsEqual([0, 1], np.unique(labels)) self.assertEqual(36, features['height']) self.assertEqual((1, 36 * 36), images.shape) self.assertEqual(recons_image.shape, images.shape) self.assertEqual(spare_image.shape, images.shape) coord.request_stop() for thread in threads: thread.join()
def testSingleTrainDistorted(self): with self.test_session(graph=tf.Graph()) as sess: features = mnist_input_record.inputs(data_dir=MNIST_DATA_DIR, batch_size=1, split='train', num_targets=1, distort=True, batch_capacity=2) coord = tf.train.Coordinator() threads = tf.train.start_queue_runners(coord=coord) images, labels, recons_image = sess.run([ features['images'], features['labels'], features['recons_image'] ]) self.assertEqual((1, 10), labels.shape) self.assertEqual(1, np.sum(labels)) self.assertItemsEqual([0, 1], np.unique(labels)) self.assertEqual(24, features['height']) self.assertEqual((1, 24, 24, 1), images.shape) self.assertEqual(recons_image.shape, images.shape) self.assertAllEqual(recons_image, images) coord.request_stop() for thread in threads: thread.join()
def testMultiTrain(self): data_dir = MNIST_DATA_DIR + MNIST_MULTI_TRAIN_FILE with self.test_session(graph=tf.Graph()) as sess: features = mnist_input_record.inputs( data_dir=data_dir, batch_size=1, split='train', num_targets=2, batch_capacity=2) coord = tf.train.Coordinator() threads = tf.train.start_queue_runners(coord=coord) images, labels, recons_image, spare_image = sess.run([ features['images'], features['labels'], features['recons_image'], features['spare_image'] ]) self.assertEqual((1, 10), labels.shape) self.assertEqual(2, np.sum(labels)) self.assertItemsEqual([0, 1], np.unique(labels)) self.assertEqual(36, features['height']) self.assertEqual((1, 36 * 36), images.shape) self.assertEqual(recons_image.shape, images.shape) self.assertEqual(spare_image.shape, images.shape) coord.request_stop() for thread in threads: thread.join()
def testMultiTest(self): data_dir = MNIST_DATA_DIR + MNIST_MULTI_TEST_FILE with self.test_session(graph=tf.Graph()) as sess: test_features = mnist_input_record.inputs(data_dir=data_dir, batch_size=1, split='test', num_targets=2, batch_capacity=2) coord = tf.train.Coordinator() threads = tf.train.start_queue_runners(coord=coord) test_label = sess.run([test_features['recons_label']]) self.assertEqual([7], test_label) coord.request_stop() for thread in threads: thread.join()
def testMultiTest(self): data_dir = MNIST_DATA_DIR + MNIST_MULTI_TEST_FILE with self.test_session(graph=tf.Graph()) as sess: test_features = mnist_input_record.inputs( data_dir=data_dir, batch_size=1, split='test', num_targets=2, batch_capacity=2) coord = tf.train.Coordinator() threads = tf.train.start_queue_runners(coord=coord) test_label = sess.run([test_features['recons_label']]) self.assertEqual([7], test_label) coord.request_stop() for thread in threads: thread.join()
def testSingleTestDistorted(self): with self.test_session(graph=tf.Graph()) as sess: features = mnist_input_record.inputs( data_dir=MNIST_DATA_DIR, batch_size=1, split='test', num_targets=1, distort=True, batch_capacity=2) coord = tf.train.Coordinator() threads = tf.train.start_queue_runners(coord=coord) images, recons_image, recons_label = sess.run([ features['images'], features['recons_image'], features['recons_label'] ]) self.assertEqual([7], recons_label) self.assertEqual(24, features['height']) self.assertEqual((1, 24, 24, 1), images.shape) self.assertAllEqual(recons_image, images) coord.request_stop() for thread in threads: thread.join()
def testSingleTestDistorted(self): with self.test_session(graph=tf.Graph()) as sess: features = mnist_input_record.inputs(data_dir=MNIST_DATA_DIR, batch_size=1, split='test', num_targets=1, distort=True, evaluate=True, batch_capacity=2) coord = tf.train.Coordinator() threads = tf.train.start_queue_runners(coord=coord) images, recons_image, recons_label = sess.run([ features['images'], features['recons_image'], features['recons_label'] ]) self.assertEqual([7], recons_label) self.assertEqual(24, features['height']) self.assertEqual((1, 24, 24, 1), images.shape) self.assertAllEqual(recons_image, images) coord.request_stop() for thread in threads: thread.join()
def testSingleTrain(self): with self.test_session(graph=tf.Graph()) as sess: features = mnist_input_record.inputs( data_dir=MNIST_DATA_DIR, batch_size=1, split='train', num_targets=1, batch_capacity=2) coord = tf.train.Coordinator() threads = tf.train.start_queue_runners(coord=coord) images, labels, recons_image = sess.run( [features['images'], features['labels'], features['recons_image']]) self.assertEqual((1, 10), labels.shape) self.assertEqual(1, np.sum(labels)) self.assertItemsEqual([0, 1], np.unique(labels)) self.assertEqual(28, features['height']) self.assertEqual((1, 28, 28, 1), images.shape) self.assertEqual(recons_image.shape, images.shape) self.assertAllEqual(recons_image, images) coord.request_stop() for thread in threads: thread.join()