How to read data into Tensorflow?

后端 未结 4 562
鱼传尺愫
鱼传尺愫 2021-02-05 22:22

I\'m trying to read data from CSV files to tensorflow,

https://www.tensorflow.org/versions/r0.7/how_tos/reading_data/index.html#filenames-shuffling-and-epoch-limits

4条回答
  •  借酒劲吻你
    2021-02-05 22:42

    1. You definitely don't need to define col1, col2, to col1000...

      generally, you might do things like this:

      
      columns = tf.decode_csv(value, record_defaults=record_defaults)
      features = tf.pack(columns)
      do_whatever_you_want_to_play_with_features(features)
      
    2. I do not know any off-the-shelf way to directly read data from MongoDB. Maybe you can just write a short script to convert data from MongoDB in a format that Tensorflow supports, I would recommend binary form TFRecord, which is much faster to read than csv record. This is a good blog post about this topic. Or you can choose to implement a customized data reader by yourself, see the official doc here.

提交回复
热议问题