1

使用:

Tensorflow version: 2.3.1
TFX version: 0.23.1
TFDV version: 0.24.0
TFMA version: 0.24.0

具有这样的交互式上下文:

from tfx.orchestration.experimental.interactive.interactive_context import \
    InteractiveContext
context = InteractiveContext(
    pipeline_root=os.path.join(os.getcwd(), "pipeline")
)

我使用以下方法创建了一个 ExampleGen:

output = example_gen_pb2.Output(
             split_config=example_gen_pb2.SplitConfig(splits=[
                 example_gen_pb2.SplitConfig.Split(name='train', hash_buckets=7),
                 example_gen_pb2.SplitConfig.Split(name='test', hash_buckets=2),
                 example_gen_pb2.SplitConfig.Split(name='eval', hash_buckets=1)
             ]))

example_gen = CsvExampleGen(input_base=os.path.join(base_dir, data_dir), output_config=output)
context.run(example_gen)

后来在代码中,我尝试使用 ExampleValidator 评估数据,但似乎 ExampleValidator 没有解析到拆分数据集的正确路径。

验证器的创建按预期工作:

example_validator = ExampleValidator(
             statistics=statistics_gen.outputs['statistics'],
             schema=schema_gen.outputs['schema'])
context.run(example_validator)

没有警告或错误,但试图显示结果,路径上的错误不正确:

context.show(example_validator.outputs['anomalies'])

NotFoundError:/home/jovyan/pipeline/ExampleValidator/anomalies/16/anomalies.pbtxt;没有这样的文件或目录

实际的目录结构是这样的:

.
└── anomalies
    └── 16
        ├── eval
        │   └── anomalies.pbtxt
        ├── test
        │   └── anomalies.pbtxt
        └── train
            └── anomalies.pbtxt

5 directories, 3 files

但代码似乎期望:

└── anomalies
    └── 16
        └── anomalies.pbtxt

如何调用 ExampleValidator 来分析拆分数据集?

4

1 回答 1

1

感谢@Lorin S.,分享解决方案参考。为了社区的利益,我在这里提供解决方案(答案部分),由github中的 1025KB 给出。

在 TFX 0.23 版本中添加了拆分,但 Colab 在 0.23 中没有更新。Colab 在此处固定为 0.24

通过将 tfx 升级到 0.24 解决了问题

于 2020-10-05T16:37:47.123 回答