Python Tensorflow数据集-映射json
我正在尝试使用dataset api构建数据集,我的情况如下:Python Tensorflow数据集-映射json,python,json,tensorflow,tensorflow-datasets,Python,Json,Tensorflow,Tensorflow Datasets,我正在尝试使用dataset api构建数据集,我的情况如下: 我有一组json,为每个实例指示两个图像(在我的例子中是图像及其掩码) 我想映射每个json,并将两个图像作为张量返回 在纯python中,我会执行以下操作 import json import tensorflow as tf def parse_json(json_path): json_file = json.load(open(json_path)) img = tf.io.read_file(json_file['
import json
import tensorflow as tf
def parse_json(json_path):
json_file = json.load(open(json_path))
img = tf.io.read_file(json_file['img'])
mask = tf.io.read_file(json_file['mask']
return img, mask
如何使用Tensorflow API实现相同的结果?
谢谢你的帮助