KotlinDL 0.2: Deep learning framework for JVM progresses


JetBrains has released KotlinDL 0.2, an update for the deep learning framework it is creating using Kotlin, adding capabilities such as a Functional API for Keras models, support for new layers, and a Model Zoo.

KotlinDL is a high-level deep learning framework that JetBrains is developing to make it easier to build and deploy deep learning models in JVM production environments. The first preview was released in December, and the 0.2 release shows how much progress has been made so far.

As KotlinDL is inspired by Keras, one of the new features in this release is a Functional API to create Keras models in addition to the existing Sequential API. While the Sequential API is simple and easy to use, it is also limited to creating relatively simple layer sequences. By contrast, the Functional API provides a way to create models that are more flexible and can handle models with non-linear topology, shared layers, and even multiple inputs or outputs.

The idea behind it is that a deep learning model is usually a directed acyclic graph (DAG) of layers, and so the Functional API is a way to build graphs of layers, according to JetBrains.

New features

Starting with this 0.2 release, KotlinDL comes with a Model Zoo, a collection of convolutional networks that are supplied already trained against a large image dataset known as ImageNet. This eliminates the need for developers to train a model from scratch for certain tasks such as image recognition, as the pre-trained models can be used immediately.

KotlinDL 0.2 also introduces a domain-specific language (DSL) that implements image pre-processing operations such as crop, resize, rotate and rescale. This is intended to make it easier for Kotlin developers and avoid some of the difficulties in JVM languages for preprocessing images, videos, and music, according to JetBrains.

Another change in this release is the Dataset API, which offers OnFlyDataset to perform batch processing of data, sequentially loading batch after batch into memory during one training epoch, or OnHeapDataset, which loads data into memory once without reading it repeatedly from the disk at each epoch, if the entire dataset will fit.

A variety of new layers have also been added to KotlinDL 0.2 that are required for ResNet and MobileNet models, implementing functions such as BatchNorm and ActivationLayer.

To use KotlinDL in a project, developers need to add a dependency to their build.gradle file – see The Kotlin Blog for full details. Further information is also available on GitHub.