I would like to change my old queue based pipeline to the new dataset API on tensorflow for reasons of performance. However, once my code changed, it runs in 8 hours instead of 2.
The use of my GPU was about 30/40% and it's now between 0 and 6%.
I found the line which making it so slow, and it's when I apply gaussian blur on my dataset :
def gaussian_blur(imgs,lbls):
imgs = tf.nn.conv2d(imgs,k_conv,
strides=[1, 1, 1, 1],
padding='SAME',
data_format='NHWC'
)
return imgs, lbls
ds = ds.map(gaussian_blur)
With my old queue-based pipeline, this line almost doesn't slow my program.
I think it's because this line used to run on the GPU but the new dataset API forces it to run on the CPU which is way slower and already 100% used.
Do you have any idea on how can I apply gaussian blur with out decreasing so much the performance? Should I keep my old queue based pipeline?