Introduction
As I finished up my Data Science program at the Flatiron School, I wanted to create a convolutional neural network for an image classification problem I was attempting for my capstone project. However, I wasn’t sure at first if I should use TensorFlow or Keras to build my neural network model. This lead me to writing this blog to give a general overview of the differences of TensorFlow and Keras. Hopefully this will help others avoid the same dilemma and research I went through when starting to craft my model.
TensorFlow and Keras
Both TensorFlow and Keras are frameworks to use in Python Data Science programming. Specifically, both can be applied to Deep Learning problems. Let’s look at TensorFlow first.
TensorFlow
TensorFlow is an open source project designed to help in Machine Learning. It provides a "toolbox" of resources to help craft workflows using high level APIs. You can use different levels of these APIs to accomplish different Machine Learning tasks. TensorFlow in general creates a framework that allows for easy to model building and training, as well as model deployment for all of the machine learning models generated. My personal take, however, is that TensorFlow’s model building code structure is more customizable, but more labor intensive and confusing as compared to Keras.
Keras
Keras runs on top of TensorFlow and is, in fact, a specifically designed Deep Learning wrapper of TensorFlow. It allows for quick, easy model architecture and building. Keras is also set up to run models seamlessly with both CPUs and GPUs. If you use Python, Keras will have another advantage, as it was built in Python. This makes for easier debugging. Like TensorFlow, Keras creates a framework that allows for easy model building. The code in Keras is also very consistent across different types of neural networks, which is a big advantage. Since Keras’s model building code acts like a series of building blocks, this also allows models to be improved and extended with ease. One personal take for Keras is that it also provides very clear error messages as compared to TensorFlow. It is very easy to debug your code when encountering errors while using Keras.
Recommendation
If you are someone who has very strong coding skills and wants to build an extremely customized Deep Learning model, then TensorFlow is probably the right framework to use. In all other cases, I would recommend using the Keras framework. It provides for easier coding using building blocks of code, easier debugging, and can run quicker when using GPUs.
Conclusion
Both Keras and TensorFlow are awesome frameworks to get to know for your Machine Learning needs. Remember that Keras is a framework built as a wrapper on top of TensorFlow, specifically for Deep Learning needs. TensorFlow has much more overall Machine Learning capabilities than Keras, but when it comes to building neural networks, Keras is a great framework to take advantage of.
