Keras vs Tensorflow vs Pytorch – No More Confusion !!

Introduction

When starting out with Deep Learning, people are often confused about which framework to pick. Usually, the choice of contenders are Keras, Tensorflow, and Pytorch. In this article, we will do an in-depth comparison between Keras vs Tensorflow vs Pytorch over various parameters and see different characteristics of the frameworks and their popularity chart.

Let us go through the comparisons.

Keras vs Tensorflow vs Python

Development and Release

  • Keras is an open-source deep-learning library created by Francois Chollet that was launched on 27th March 2015.
  • Tensorflow is a symbolic math library that is used for various machine learning tasks, developed and launched by Google on 9th November 2015. 
  • PyTorch is a machine learning library that was launched in Oct 2016 by Facebook.

API Level

  • Keras is a high-level API that can run on top of other frameworks like TensorFlow, Microsoft Cognitive Toolkit, Theano where users don’t have to focus much on the low-level aspects of these frameworks. It is worth noting however that multi backend support of Keras will fade away in the future as per the roadmap.
  • TensorFlow offers both low-level and high-level API, and so it can be used by both beginner and advanced users. As part of its high-level API, it provides tensorflow.keras which is nothing but Keras APIs presented out of the box to Tensorflow users and maintained by Google. (tf.keras in Tensorflow 2.0 is very well synced with the original Keras) 
  • PyTorch is also a low-level API with its own sets of functionalities and operations similar to that of python numpy.

Speed

When training huge deep learning models, a lot of weightage is given to its training time and the speed of the underlying framework becomes very significant.

  • Keras, being a high-level API, lags behind its two counterparts when it comes to speed.
  • TensorFlow and PyTorch,  as low-level frameworks, are fast and their speed is comparable making it difficult to choose between the two for speed.

Supported Languages

  • Keras primarily supports Python language but it also offers R interface.
  • TensorFlow supports Python, Javascript, C++, Java, GO, Swift. 
  • PyTorch supports Python, C++, and Java.

[adrotate banner=”3″]

Beginner Friendliness

  • Keras was built with the purpose of easy experimentation and quick prototyping of the Deep Learning model.  Thus it is very beginner-friendly where users can build neural networks just like stacking legos block.
  • Tensorflow (its low-level API) and Pytorch are not beginner-friendly and have their own steep learning curve.

Debugging

  • Keras is usually easy to work with and it is not often you will find yourself in a difficult spot. But since it has too many levels of abstractions on backend frameworks, debugging can sometimes get tricky.
  • In the case of TensorFlow, debugging is a tough nut to crack. It offers a dedicated debugging module for debugging which is usually overwhelming for users.
  • Pytorch is straight forward to debug like any python code and we can use any standard python debugger for this purpose.

Dataset Size

  • Remember that Keras was originally built for quick prototyping and has slow speed. So it is not the best deep learning framework for large datasets.
  • On the other hand, TensorFlow and PyTorch are competent to work with large datasets as they are low-level framework with good speed.

Google Trends Popularity

Google Trends is a good parameter to understand the popularity of Keras vs Tensorflow vs Python.  As we can see that for the worldwide trends of the past 5 years, Keras is winning the race of popularity, with TensorFlow on the second position and PyTorch at third.

 

GitHub Popularity

The activities inside the GitHub repositories of these frameworks also gives us an insight into their popularity. When we analyze their repositories through stars, forks, watchers, and contributors, we see that TensorFlow is the most popular framework for all the 4 GitHub attributes. The second spot is taken by PyTorch and it is followed by Keras.

Keras vs Tensorflow vs Pytorch - Github Popularity
Keras vs Tensorflow vs Pytorch – Github Popularity (Github Graphs Courtesy – KDNuggets)

Job Listings

Going by the recent openings on popular job portals like Indeed, Monster, Linkedin shows that TensorFlow is the most in-demand deep learning framework for all the job aspirants. PyTorch being the second most preferred framework and Keras in the third position.    

Keras vs Tensorflow vs Pytorch - Job Listing Popularity
Keras vs Tensorflow vs Pytorch – Job Listing Popularity (Courtesy:KDNuggets)

Medium Articles Popularity

Sometimes back, the research showed that Medium saw more article submission for Tensorflow, followed closely by Keras. PyTorch articles were very few in comparison.

Keras vs Tensorflow vs Pytorch - Medium Article Popularity
Keras vs Tensorflow vs Pytorch – Medium Article Popularity (Courtesy:KDNuggets)

arXiv Popularity

arXiv is an online portal for research paper submissions and archival. The same study showed that Tensorflow has got the highest number of mentions or usage in the research papers, followed by Pytorch and then Keras.

Keras vs Tensorflow vs Pytorch - arXiv Popularity
Keras vs Tensorflow vs Pytorch – arXiv Popularity (Courtesy:KDNuggets)

Used By Companies

  • Keras is used by major companies like Apple, Google, Nvidia, Microsoft, Netflix, Uber, Amazon AWS.
  • Tensorflow is getting used in Google, AirBnB, AMD, Bloomberg, Linkedin, PayPal, Qualcomm, Snapchat.
  • Pytorch is being used by Facebook, Genentech, JPMorgan Chase, Microsoft, Salesforce, Toyota, Wells Fargo.

Usecase Examples

Keras

  • Keras library is proficient in turning the models into products for companies like Apple and Google.
  • Keras supports deep learning backend engines of companies like Google, Microsoft, and Nvidia.

Tensorflow

  • PayPal is using TensorFlow to improve its fraud detection services
  • Qualcomm is leveraging TensorFlow models for incorporating them in snapdragon mobile platforms.
  • Coca Cola using Tensorflow for Digital Marketing.

Pytorch

  • Microsoft is using PyTorch for building their language modeling service
  • Airbnb is looking to improve their customer experience through PyTorch powered AI conversational tools.
  • Car giant Toyota has added new driver support features with the help of PyTorch.

Conclusion

So we have reached the end of this article, here we learned about the three most popular deep learning frameworks –  Keras, TensorFlow, and PyTorch. We looked at various parameters to compare these 3 frameworks. Beginners may like to start with Keras due to its simplicity and low learning curve. They may also use Keras API from Tensorflow itself, in fact, tf.keras has a tighter integration in Tensorflow 2.0. An advanced user may use either of low-level APIs of Tensorflow or Pytorch and it is a matter of preference only.

  • Palash Sharma

    I am Palash Sharma, an undergraduate student who loves to explore and garner in-depth knowledge in the fields like Artificial Intelligence and Machine Learning. I am captivated by the wonders these fields have produced with their novel implementations. With this, I have a desire to share my knowledge with others in all my capacity.

Follow Us

Leave a Reply

Your email address will not be published. Required fields are marked *