Tensorflow has 4 general ways to read data, link: https://www.tensorflow.org/api_guides/python/reading_data:
- tf.data
- Feeding
- QueueRunner
- Preloaded data
Trying tf.data...
-
tf.python_io.TFRecordWriter: the writer -
TFRecordDataset: high level API, it has two types of iterators:a.
make_initializable_iteratorb.
make_one_shot_iterator -
implemented a simple example here which applies two iterators:
one for train data, the other one for test data. In this way we can switch between them during training.a. pay attention to the
reminder(when num_samples/batch_size is not an interger)b. we need to make sure we
alawys have test data before finishing training, which means thetest iteratorshould not stop beforetrain iterator
write tfrecords from seperated samples such as images stored on hard drive.