def get_training_batch(self):
self.logger.info('Going to create batch of images and ground truths')
images_batch = []
groundtruth_batch = []
sequence_length = 300
for filename in self.training_filenames:
self.logger.info('Creating input queue for training sample at:{}'.format(filename))
associations = np.loadtxt(os.path.join(filename, "associate.txt"), dtype="str", unpack=False)
groundtruth = np.loadtxt(os.path.join(filename, "groundtruth.txt"), dtype="str", unpack=False)
twist, rgb_filepaths, depth_filepaths = self._get_data(associations, groundtruth, sequence_length)
rgb_filepaths = [os.path.join(filename, filepath) for filepath in rgb_filepaths]
depth_filepaths = [os.path.join(filename, filepath) for filepath in depth_filepaths]
rgb_filepaths_tensor = tf.convert_to_tensor(rgb_filepaths)
depth_filepaths_tensor = tf.convert_to_tensor(depth_filepaths)
input_queue = tf.train.slice_input_producer([rgb_filepaths_tensor, depth_filepaths_tensor, twist], shuffle=False)
image, outparams = self.read_rgbd_data(input_queue)
images_batch.append(image)
groundtruth_batch.append(outparams)
# images, outparam_batch = tf.train.batch([image, outparams], batch_size=self.batch_size,
# num_threads=20, capacity=4 * self.batch_size)
return images_batch, groundtruth_batch
评论列表
文章目录