我们正在研究如何将ML管道从一组手动步骤转换为TFX管道。然而,我确实有一些问题,我想有一些更多的见解。
我们通常执行以下步骤(对于图像分类任务):
现在,我试图将其映射到典型的示例TFX管道上。
然而,这引起了一些问题:
- ExampleGen uses a CSV file containing pointers to the image to be loaded and the meta-data to be loaded (above step ‘1’). However:
- If this CSV file contains a path to an image file, can ExampleGen then load the image data and add this to its output?
- Is the output of ExampleGen a streaming output, or a dump of all example data?
- ExampleGen has TFRecords as input (output of above step ‘5’)
->这意味着我们仍然需要在TFX…之外实现步骤1-5。,这将降低TFX对我们…的价值。
你能告诉我什么是最好的办法吗?
谢谢你的见解。
发布于 2021-10-08 08:22:55
我将尝试用我在tfx方面的经验来解决大多数问题。
您也可以这样做,这里有一个非常简单的代码片段,我使用它来调整所有图像的大小并创建简单的功能。
try:
image = tf.io.decode_jpeg(image_string)
image = tf.image.resize(image,[image_resize_size,image_resize_size])
image = tf.image.convert_image_dtype(image/255.0, dtype=tf.uint8)
image_shape = image.shape
image = tf.io.encode_jpeg(image,quality=100)
feature = {
'height': _int64_feature(image_shape[0]),
'width' : _int64_feature(image_shape[1]),
'depth' : _int64_feature(image_shape[2]),
'label' : _int64_feature(labels_to_int(element[2].decode())),
'image_raw' : _bytes_feature(image.numpy())
}
tf_example = tf.train.Example(features=tf.train.Features(feature=feature))
except:
print('image could not be decoded')
return None
ImportExampleGen
组件将数据加载到tfx管道中。然后是StatisticsGen,它将计算特性的统计信息。当在云中运行所有这些时,它是在批处理模式下使用掩护下的数据流。
我想您可以从技术上创建一个自定义组件,该组件接受StatisticsGen工件,解析它并尝试进行类平衡,并创建一个包含balances类的新数据集。但老实说,我认为最好是在预处理阶段。
https://stackoverflow.com/questions/65848283
复制相似问题