tensorflow / tensorflow/java

How to use TfRecordDataset DatasetToTfRecord tf.io.tfRecordReader

未关闭
#452 10 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

主要语言
Java
星标
928
派生
227
PR 合并指标
30 天内没有已合并 PR

描述

tensorflow-java 0.4
spark 3.1
java 11

Hi :
Now I use tensorflow-java to read tfrecord file ,but can not get the data, and our not have example for it ,the TfRecordDataset DatasetToTfRecord tf.io.tfRecordReader java class have not same api like python ,could we give some example for how to use them. thank


    import org.tensorflow.{Operand, Session,EagerSession}
    import org.tensorflow.op.Ops
    import org.tensorflow.op.data.TfRecordDataset
    import org.tensorflow.op.data.{DatasetToTfRecord, TfRecordDataset}
    val session = EagerSession.create
    val tf = Ops.create(session)
    val  scope = tf.scope()
//    val fileName  =tf.constant( "/Users/zhanghaining/Downloads/tfrecord-kk2-test/")
    val fileName = tf.constant("/Users/zhanghaining/Downloads/BigDL/spark/dl/src/test/resources/tf/mnist_train.tfrecord")
    val compress = tf.constant("")
    val bufferSize = tf.constant(0l)
    val recordDataSet = TfRecordDataset.create(scope,fileName,compress,bufferSize)

    val record = DatasetToTfRecord.create(scope, recordDataSet,fileName,compress)

    val reader =  tf.io.tfRecordReader()

    println(record.op().name() )
    println(record.op().`type`())
    println(recordDataSet.op().numOutputs() )
    println(recordDataSet.asOutput().dataType())

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从 issue 中展示的 TfRecordDataset、DatasetToTfRecord 和 tf.io.tfRecordReader 入口点开始,并将它们的 Java API 与所请求的 Python 用法进行比较。完成的标准是提供一个可运行的 tensorflow-java 示例,该示例能够读取 TFRecord 数据并说明如何使用这些 API。

由索引模型根据 Issue 内容生成。

评估

技术栈
java, tensorflow
领域
data, machine-learning
Issue 类型
文档
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
需要澄清
新手友好度
25/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。