"Keras has the right combination of simplicity and power:" An interview with Sujit Pal

Amey Varangaonkar

September 11th, 2017

The rise of Deep Learning as a trend has led to the emergence of many tools and frameworks. Keras is one such tool, developed in order to ease the development and training of deep learning models. While we already have popular deep learning libraries like Theano and TensorFlow, using them directly for creating deep learning models can be a challenge. That’s where Keras comes to the rescue - a high-level 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, Technology Research Director at Elsevier Labs, has been working with Keras for quite some time. As an expert in Semantic Search, Natural Language Processing and Machine Learning, he has been successfully implementing these techniques in many of his projects. He is a keen Python enthusiast who also has a soft corner for JVM-based languages like Java and Scala. Sujit is an active member of the Keras community, and can often be seen on Quora, helping fellow developers with their queries. He also writes about new, cutting-edge technologies on his blog Salmon Run.

We spoke to Sujit about the excitement surrounding Keras, and why it's his framework of choice for Deep Learning.

Key takeaways

  • Keras is easy to get started with - if you’ve worked with Python before and have some basic knowledge of neural networks.
  • Keras works on top of Theano and TensorFlow seamlessly to create efficient deep learning models.
  • Keras will impress Goldilocks! 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.
  • Keras is a handy tool to use if you’re looking to build models related to Computer Vision or Natural Language Processing.
  • Although there’s scope for improvement, Keras is an expressive framework that allows for rapid prototyping of models.

What made you choose to adopt and use Keras in your projects?

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.

How has the Keras experience differed from other frameworks and tools? What problems does it solve exclusively?

SP: 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 are the prerequisites to learning Keras? And what aspects of Keras are tricky to learn?

SP: 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.

For what purpose in data science do you use Keras in your day-to-day programming?

SP: 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.

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

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.


If Keras has piqued your interest or if you simply want to get started with Deep Learning, a good starting point is Antonio Gulli & Sujit Pal’s book Deep Learning with Keras from Packt.