def _preprocess_batch(self, datum_batch, include_datum=False,
random_transform=True):
imgs_path = map(attrgetter('img_path'), datum_batch)
captions_txt = map(attrgetter('caption_txt'), datum_batch)
img_batch = self._image_preprocessor.preprocess_images(imgs_path,
random_transform)
caption_batch = self._caption_preprocessor.encode_captions(captions_txt)
imgs_input = self._image_preprocessor.preprocess_batch(img_batch)
captions = self._caption_preprocessor.preprocess_batch(caption_batch)
captions_input, captions_output = captions
X, y = [imgs_input, captions_input], captions_output
if include_datum:
return X, y, datum_batch
else:
return X, y
dataset_providers.py 文件源码
python
阅读 26
收藏 0
点赞 0
评论 0
评论列表
文章目录