BT

InfoQ Homepage News Deep Java Library: New Deep Learning Toolkit for Java Developers

Deep Java Library: New Deep Learning Toolkit for Java Developers

Bookmarks

At the 2019 AWS re:Invent conference, Amazon released Deep Java Library (DJL), an open-source library with Java APIs to simplify training, testing, deploying, and making predictions with deep-learning models.

While Java remains the first or second most popular programming language since the late 90s, Python is the most used language for machine learning, with numerous resources and deep-learning frameworks. DJL aims to make deep-learning open-source tools accessible to Java developers, using familiar concepts and intuitive APIs. Java developers can use their favorite IDE with DJL or Jupyter Notebook-based code execution for Java.

DJL is framework agnostic; it abstracts away commonly used deep-learning functions, using Java Native Access (JNA) on top of existing deep-learning frameworks, currently providing implementations for Apache MXNet and TensorFlow.  

Common functions for training a model are shown in the sample DJL pseudocode below:

// Create an empty model
Model model = Model.newInstance())
. . .
// Setup training with configurations
Trainer trainer = model.newTrainer(config))
. . .
// Use trainer to fit model with training and validation datasets
TrainingUtils.fit(trainer, epoch, trainingSet, validateSet);                   
// Save the model         
model.save(modelDir, "mlp");  

For a complete image classification code example, read InfoQ's article "Getting to Know Deep Java Library (DJL)". Also the DJL GitHub repository comes with popular datasets, pre-trained models, code examples and Jupyter Notebook tutorials on use cases like image classification, instance segmentation, and action recognition.  

Another open-source, deep-learning library for Java is Deep Learning for Java (DL4J), which is written in Java and takes advantage of Apache Spark and Hadoop to accelerate training. DL4J is robust, flexible, effective, and a great framework for Java developers. However, comparing DL4J to DJL and other deep-learning frameworks, DL4J has the disadvantage that it cannot profit from the growing machine-learning Python codebases, which DJL can since it is framework agnostic.

To learn more about DJL, check out the DJL website, the Java Doc API Specification and the Getting Started page.

Rate this Article

Adoption
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

BT

Is your profile up-to-date? Please take a moment to review and update.

Note: If updating/changing your email, a validation request will be sent

Company name:
Company role:
Company size:
Country/Zone:
State/Province/Region:
You will be sent an email to validate the new email address. This pop-up will close itself in a few moments.