I am facing a problem of improving the training speed / efficiency of a Tensorflow implementation of point cloud object detection algorithm.
The input data is a [8000, 100, 9] float32 tensor, with a size roughly 27MB per sample. On a batch size of 5, data loading becomes a bottleneck in training as most of the time GPU utlization rate is 0% until data arrives.
I have tried the following methods to increase data loading speed.
- Use
num_parallel_callsin tf.Dataset.mapAPI, and use multiple threads for reading this big tensor. The problem is.mapwraps apy_funwhich is subject to Global Interpreter Lock and thus multi-threading does not improve I/O efficiency. - Use tf.Dataset
.interleaveAPI. Since it's also multi-threading based, it has the same problem as 2. - Use TFRecord format. This is even slower than method 1 and 2. Possibility is TFRecord will convert tensor to numpy, then serialize numpy to bytes, then wrap this bytes to tensorflow structure and write to disk. Numpy to Tensor takes a long time for my data as measured by
tf.convert_to_tensor().
Any suggestions how to move forward would be helpful. Thanks!
Follow up on comments
- Am I using slow disks? Data is stored on a mounted disk. Could be a reason.
- Can the data be fit into GPU memory? Unfortunately no. There are ~70,000 samples. I tried cache a small dataset into RAM and GPU utlization rate is 30%~40%, which is probably the highest expectation for this particular network.