4 min read

A lot of people rave about TensorFlow and Theano, but there are is one complaint you hear fairly regularly: that they can be a little challenging to use if you’re directly building deep learning models. That’s where Keras comes to the rescue. It’s a high-level deep learning library written in Python that can be used as a wrapper on top of TensorFlow or Theano, to simplify the model training process and to make the models more efficient.

Sujit Pal is Technology Research Director at Elsevier Labs. He has been working with Keras for some time. He is an expert in Semantic Search, Natural Language Processing and Machine Learning. He’s also the co-author of Deep Learning with Keras, which is why we spoke to him about why you should use start using Keras (he’s very convincing).

5 reasons you should start using Keras

  1. Keras is easy to get started with if you’ve worked with Python before and have some basic knowledge of neural networks.
  2. It works on top of Theano and TensorFlow seamlessly to create efficient deep learning models.
  3. It offers just the right amount of abstraction – allowing you to focus on the problem at hand rather than worry about the complexity of using the framework.
  4. It is a handy tool to use if you’re looking to build models related to Computer Vision or Natural Language Processing.
  5. Keras is a very expressive framework that allows for rapid prototyping of models.

Why I started using Keras

Packt: Why did you start using using Keras?

Sujit Pal: My first deep learning toolkit was actually Caffe, then TensorFlow, both for work related projects. I learned Keras for a personal project and I was impressed by the Goldilocks (i.e. just right) quality of the abstraction. Thinking at the layer level was far more convenient than having to think in terms of matrix multiplication that TensorFlow makes you do, and at the same time I liked the control I got from using a programming language (Python) as opposed to using JSON in Caffe. I’ve used Keras for multiple projects now.

Packt: How has this experience been different from other frameworks and tools? What problems does it solve exclusively?

Sujit: I think Keras has the right combination of simplicity and power. In addition, it allows you to run against either TensorFlow or Theano backends. I understand that it is being extended to support two other backends – CNTK and MXNet. The documentation on the Keras site is extremely good and the API itself (both the Sequential and Functional ones) are very intuitive. I personally took to it like a fish to water, and I have heard from quite a few other people that their experiences were very similar.

What you need to know to start using Keras

Packt: What are the prerequisites to learning Keras? And what aspects are tricky to learn?

Sujit: I think you need to know some basic Python and have some idea about Neural Networks. I started with Neural Networks from the Google/edX course taught by Vincent Van Houke. It’s pretty basic (and taught using TensorFlow) but you can start building networks with Keras even with that kind of basic background. Also, if you have used numpy or scikit-learn, some of the API is easier to pick up because of the similarities.

I think the one aspect I have had a few problems with is building custom layers. While there is some documentation that is just enough to get you started, I think Keras would be usable in many more situations if the documentation for the custom layers was better, maybe more in line with the rest of Keras. Things like how to signal that a layer supports masking or multiple tensors, debugging layers, etc.

Packt: Why do you use Keras in your day-to-day programming and data science tasks?

Sujit: I have spent most of last year working with Image classification and similarity, and I’ve used Keras to build most of my more recent models. This year I am hoping to do some work with NLP as it relates to images, such as generating image captions, etc. On the personal projects side, I have used Keras for building question answering and disease prediction models, both with data from Kaggle competitions.

How Keras could be improved

Packt: As a developer, what do you think are the areas of development for Keras as a library? Where do you struggle the most?

Sujit: As I mentioned before, the Keras API is quite comprehensive and most of the time Keras is all you need to build networks, but occasionally you do hit its limits. So I think the biggest area of Keras that could be improved would be extensibility, using its backend interface. Another thing I am excited about is the contrib.keras package in TensorFlow, I think it might open up even more opportunity for customization, or at least the potential to maybe mix and match TensorFlow with Keras.

Data Science Enthusiast. A massive science fiction and Manchester United fan. Loves to read, write and listen to music.

LEAVE A REPLY

Please enter your comment!
Please enter your name here