Benchmarking the Keras API on GPU: the use of tensorflow and CNTK libraries as back-end. (3rd February 2022) - Florencio, Felipe; Moreno, Edward David
With the popularisation of convolutional neural networks (CNNs), many tools were developed to facilitate the development of models. One of the main tools developed is the Keras API, which is a high-level API for creating and training models. The Keras API acts as a high-level layer to facilitate the implementation of neural networks while other CNN libraries can run as backend. There is a demand for studies that compare the performance of a CNN implemented with the Keras API and the performance of CNNs implemented only with native methods to CNN libraries. To evaluate the impact of the Keras API on the performance of TensorFlow 1, TensorFlow 2 and CNTK libraries in relation to the execution time in GPUs, an experiment was conducted for measuring the execution time of the LeNet-5 model. It was implemented with the aid of the Keras API and implemented without it. Models implemented with Keras API methods showed longer execution times than models implemented only with native methods from CNTK libraries. The performance difference can be significant for some applications. The Keras API sacrifices library performance up to four times when compared to native methods.