def get_data(path, size, dataset): # Retrieves all preprocessed images and labels using a tensorflow queue. # This only uses the cpu. os.environ["CUDA_VISIBLE_DEVICES"] = "" with tf.device("/cpu:0"): dataset = cifar_input.build_data(path, size, dataset) sess = tf.Session() images, labels = sess.run(dataset) sess.close() return images, labels
def get_data(path, size): os.environ['CUDA_VISIBLE_DEVICES'] = '' with tf.device('/cpu:0'): queue = cifar_input.build_data(path, size) sess = tf.Session() coord = tf.train.Coordinator() tf.train.start_queue_runners(sess, coord=coord) images, labels = sess.run(queue) coord.request_stop() sess.close() return (images[:int(size / 3), :], images[int(size / 3):int(2 * size / 3), :], images[int(2 * size / 3):, :], labels)
def get_data(path, size, dataset): # Retrieves all preprocessed images and labels using a tensorflow queue. # This only uses the cpu. os.environ["CUDA_VISIBLE_DEVICES"] = "" with tf.device("/cpu:0"): queue = cifar_input.build_data(path, size, dataset) sess = tf.Session() coord = tf.train.Coordinator() tf.train.start_queue_runners(sess, coord=coord) images, labels = sess.run(queue) coord.request_stop() sess.close() return images, labels