Preload whole dataset on gpu for training Keras model

前端 未结 1 845
深忆病人
深忆病人 2021-02-07 00:23

I have a specific case where the networks are relatively tiny and for convergence and generalization matters I should maintain small batch sizes (e.g. 256), which leads to hundr

1条回答
  •  栀梦
    栀梦 (楼主)
    2021-02-07 00:56

    You don't have to load the whole data. You can ingest the data piece by piece using the DataSet class.

    Tensorflow can take care of loading more data while your gpu is crunching your numbers. You can follow the below steps.

    1. Convert your dataset into a TFRecord dataset and save it to your disk.
    2. Load this dataset using the TFRecordDataset class
    3. Ingest it into your Kerasmodel.

    You can check the example listed here.

    Hope this is helpful.

    0 讨论(0)
提交回复
热议问题