【问题标题】:How do I call ExampleValidator to analyze split data sets?如何调用 ExampleValidator 来分析拆分数据集?
【发布时间】:2020-09-26 16:45:21
【问题描述】:

使用:

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 来分析拆分数据集?

【问题讨论】:

  • 请注意,Keras 组件示例 here 遇到了同样的问题,所以我打开了一个问题 here
  • 升级 tfx 到 0.24 解决了这个问题

标签: tensorflow2.0 tfx


【解决方案1】:

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

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

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

【讨论】:

    猜你喜欢
    • 2018-12-10
    • 2021-04-08
    • 2020-11-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-09-25
    相关资源
    最近更新 更多