This document is the API specification for the Deep Java Library (DJL).

The key design goal for the DJL is to simplify the use of deep learning for Java developers. Developers don't need to be machine learning/deep learning experts to get started. They can start with their existing Java expertise as a foundation to learn and use ML/DL. Developers can use their favorite IDE to build, train, and deploy their models. They can also easily integrate these models with their Java applications. They don't have to compromise on model performance, scale, or choice of GPU vs. CPUs.

DJL is deep learning engine agnostic. Developers don't have to make a choice between engines when they start their project. They can switch to a different engine at any time.

DJL provides a native Java development experience and functions just like any other regular Java library would. DJL's ergonomic API interface is designed to guide developers with best practices to accomplish deep learning tasks.

The following is an example of how to write inference code:

    // Assume user has a pre-trained already, they just need load it
    Model model = Model.load(modelDir, modelName);

    // User can implement Translator interface, read Translator for detail.
    Translator translator = new MyTranslator();

    // Next user need create a Predictor, and use Predictor.predict()
    // to get prediction.
    try (Predictor<Image, DetectedObjects> predictor = model.newPredictor(translator)) {
        DetectedObjects result = predictor.predict(img);
    }

More tutorials, documents, and examples can be on our GitHub repository.

Packages 
Package Description
ai.djl
Contains top level, engine-agnostic classes for both inference and training.
ai.djl.engine
Contains classes responsible for loading a deep learning engine.
ai.djl.inference
Contains classes to implement inference tasks.
ai.djl.metric
Contains classes to collect metrics information.
ai.djl.modality
Contains utility classes for each of the predefined modalities.
ai.djl.modality.cv
Contains utility classes for computer vision tasks and image processing.
ai.djl.modality.cv.output
Contains output types used in various computer vision applications.
ai.djl.modality.cv.transform
Contains Transforms for working with Images.
ai.djl.modality.cv.translator
Contains translators used for computer vision applications.
ai.djl.modality.cv.translator.wrapper
Contains wrappers to for multiple input formats to a BaseImageTranslator.
ai.djl.modality.cv.util
Contains utility classes for image manipulation.
ai.djl.modality.nlp
Contains utility classes for natural language processing tasks.
ai.djl.modality.nlp.bert
Contains classes that deal with BERT for natural language pre-processing tasks.
ai.djl.modality.nlp.embedding
Contains classes that deal with word embeddings for natural language pre-processing tasks.
ai.djl.modality.nlp.preprocess
Contains utility classes for natural language pre-processing tasks.
ai.djl.modality.nlp.qa
Contains utility classes for question and answer processing.
ai.djl.modality.nlp.translator
Contains utility classes for each of the predefined translator.
ai.djl.modality.rl
Contains utility classes for reinforcement learning.
ai.djl.modality.rl.agent
Contains agents to learn using reinforcement learning.
ai.djl.modality.rl.env
Contains environments to train reinforcement learning in.
ai.djl.ndarray
Contains classes and interfaces that define an n-dimensional array.
ai.djl.ndarray.index
Contains classes that help access NDArray's indices.
ai.djl.ndarray.index.dim
Contains classes that represent an index element in a NDArray's indices.
ai.djl.ndarray.index.full
Contains classes that represent simplified representations of an NDArray's indices.
ai.djl.ndarray.types
Contains classes that define n-dimensional array data types.
ai.djl.nn
Contains classes to construct neural networks.
ai.djl.nn.convolutional
Contains classes that define convolutional operations extending Convolution and Deconvolution.
ai.djl.nn.core
Contains classes that define simple neural network operations.
ai.djl.nn.norm
Contains classes that define normalizing neural network operations.
ai.djl.nn.pooling
Contains pooling neural network operations in Pool and helpers for it.
ai.djl.nn.recurrent
Contains classes for recurrent neural network operations.
ai.djl.nn.transformer
Contains blocks for transformer models.
ai.djl.repository
Contains a Maven-based Repository format for creating repositories of artifacts such as datasets and model zoos.
ai.djl.repository.zoo
Contains classes for working with model zoo repositories.
ai.djl.training
Contains classes and implementations to train a neural network.
ai.djl.training.dataset
Contains classes to download and prepare training and testing data.
ai.djl.training.evaluator
Contains classes for evaluating the effectiveness of models.
ai.djl.training.hyperparameter
Contains utilities to train, describe, and manipulate Hyperparameters.
ai.djl.training.hyperparameter.optimizer
Contains classes to optimize Hyperparameters.
ai.djl.training.hyperparameter.param
Contains different types of Hyperparameters.
ai.djl.training.initializer
Contains classes for initializing a Block's Parameters.
ai.djl.training.listener
Contains classes providing functionality during training through TrainingListener.
ai.djl.training.loss
Contains classes for measuring the Loss of a model.
ai.djl.training.optimizer
Contains classes for optimizing a neural network Block.
ai.djl.training.tracker
Contains classes for having a gradually changing hyper-parameter.
ai.djl.training.util
Contains utilities to use during training.
ai.djl.translate
Contains classes and interfaces that translate between java objects and NDArrays.