# deeplearning4j **Repository Path**: cyhjb/deeplearning4j ## Basic Information - **Project Name**: deeplearning4j - **Description**: Deeplearning4j(简称DL4J)是为Java和Scala编写的首个商业级开源分布式深度学习库。DL4J与Hadoop和Spark集成,为商业环境(而非研究工具目的)所设计。Deeplearning4j包括了分布式、多线程的深度学习框架,以及普通的单线程深度学习框架。定型过程以集群进行,也就是说,Deeplearning4j可以快速处理大量数据。神经网络可通过[迭代化简]平行定型,与Java、Scala和Clojure均兼容。Deeplearning4j在开放堆栈中作为模块组件的功能,使之成为首个为微服务架构打造的深度学习框架。在Eclipse中Deeplearning4J(DL4J)生态系统是一组项目旨在支持基于JVM的深度学习应用的所有需求。这意味着从原始数据开始,从任何位置以任何格式加载和预处理原始数据,以构建和调整各种简单和复杂的深度学习网络。 DL4J堆栈包括: DL4J:高级API,用于构建具有各种层(包括自定义层)的MultiLayerNetworks和ComputationGraphs。支持从h5导入Keras模型,包括tf.keras模型(从1.0.0-beta7开始),还支持在Apache Spark上进行分布式培训 ND4J:通用线性代数库,具有500多种数学,线性代数和深度学习运算。ND4J基于高度优化的C ++代码库LibND4J,它通过OpenBLAS,OneDNN(MKL-DNN),cuDNN,cuBLAS等库提供对CPU(AVX2 / 512)和GPU(CUDA)的支持和加速。 SameDiff:ND4J库的一部分,SameDiff是我们的自动差异化/深度学习框架。SameDiff使用基于图的(先定义然后运行)方法,类似于TensorFlow图模式。计划执行急切图(TensorFlow 2.x急切/ PyTorch)。SameDiff支持导入TensorFlow冻结模型格式.pb(protobuf)模型。已计划导入ONNX,TensorFlow SavedModel和Keras模型。Deeplearning4j还具有完整的SameDiff支持,可轻松编写自定义图层和丢失函数。 DataVec:ETL,用于各种格式和文件(HDFS,Spark,图像,视频,音频,CSV,Excel等)的机器学习数据 仲裁器:用于超参数搜索的库 LibND4J:支撑一切的C ++库。有关JVM如何处理本机数组和操作的更多信息,请参阅JavaCPP。 DL4J生态系统中的所有项目都支持Windows,Linux和macOS。硬件支持包括CUDA GPU(OSX除外的10.0、10.1、10.2),x86 CPU(x86_64,avx2,avx512),ARM CPU(arm,arm64,armhf)和PowerPC(ppc64le)。 - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 1 - **Created**: 2020-12-13 - **Last Updated**: 2021-06-10 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README

[![Documentation](https://img.shields.io/badge/user-documentation-blue.svg)](https://deeplearning4j.konduit.ai/) [![Get help at the community forum](https://img.shields.io/badge/Get%20Help-Community%20Forum-blue)](https://community.konduit.ai/) [![javadoc](https://javadoc.io/badge2/org.deeplearning4j/deeplearning4j-nn/DL4J%20API%20Doc.svg)](https://javadoc.io/doc/org.deeplearning4j/deeplearning4j-nn) [![javadoc](https://javadoc.io/badge2/org.nd4j/nd4j-api/ND4J%20API%20Doc.svg)](https://javadoc.io/doc/org.nd4j/nd4j-api) [![License](https://img.shields.io/github/license/eclipse/deeplearning4j)](LICENSE) ![GitHub commit activity](https://img.shields.io/github/commit-activity/m/konduitai/deeplearning4j) The **[Eclipse Deeplearning4J](https://deeplearning4j.konduit.ai/)** (DL4J) ecosystem is a set of projects intended to support all the needs of a JVM based deep learning application. This means starting with the raw data, loading and preprocessing it from wherever and whatever format it is in to building and tuning a wide variety of simple and complex deep learning networks. Because Deeplearning4J runs on the JVM you can use it with a wide variety of JVM based languages other than Java, like Scala, Kotlin, Clojure and many more. The DL4J stack comprises of: - **DL4J**: High level API to build MultiLayerNetworks and ComputationGraphs with a variety of layers, including custom ones. Supports importing Keras models from h5, including tf.keras models (as of 1.0.0-beta7) and also supports distributed training on Apache Spark - **ND4J**: General purpose linear algebra library with over 500 mathematical, linear algebra and deep learning operations. ND4J is based on the highly-optimized C++ codebase LibND4J that provides CPU (AVX2/512) and GPU (CUDA) support and acceleration by libraries such as OpenBLAS, OneDNN (MKL-DNN), cuDNN, cuBLAS, etc - **SameDiff** : Part of the ND4J library, SameDiff is our automatic differentiation / deep learning framework. SameDiff uses a graph-based (define then run) approach, similar to TensorFlow graph mode. Eager graph (TensorFlow 2.x eager/PyTorch) graph execution is planned. SameDiff supports importing TensorFlow frozen model format .pb (protobuf) models. Import for ONNX, TensorFlow SavedModel and Keras models are planned. Deeplearning4j also has full SameDiff support for easily writing custom layers and loss functions. - **DataVec**: ETL for machine learning data in a wide variety of formats and files (HDFS, Spark, Images, Video, Audio, CSV, Excel etc) - **Arbiter**: Library for hyperparameter search - **LibND4J** : C++ library that underpins everything. For more information on how the JVM acceses native arrays and operations refer to [JavaCPP](https://github.com/bytedeco/javacpp) All projects in the DL4J ecosystem support Windows, Linux and macOS. Hardware support includes CUDA GPUs (10.0, 10.1, 10.2 except OSX), x86 CPU (x86_64, avx2, avx512), ARM CPU (arm, arm64, armhf) and PowerPC (ppc64le). ## Using Eclipse Deeplearning4J in your project Deeplearning4J has quite a few dependencies. For this reason we only support usage with a build tool. ```xml org.deeplearning4j deeplearning4j-core 1.0.0-beta7 org.nd4j nd4j-native-platform 1.0.0-beta7 ``` Add these dependencies to your pom.xml file to use Deeplearning4J with the CPU backend. A full standalone project example is [available in the example repository](https://github.com/eclipse/deeplearning4j-examples), if you want to start a new Maven project from scratch. ## A taste of code Deeplearning4J offers a very high level API for defining even complex neural networks. The following example code shows you how LeNet, a convolutional neural network, is defined in DL4J. ```java MultiLayerConfiguration conf = new NeuralNetConfiguration.Builder() .seed(seed) .l2(0.0005) .weightInit(WeightInit.XAVIER) .updater(new Adam(1e-3)) .list() .layer(new ConvolutionLayer.Builder(5, 5) .stride(1,1) .nOut(20) .activation(Activation.IDENTITY) .build()) .layer(new SubsamplingLayer.Builder(PoolingType.MAX) .kernelSize(2,2) .stride(2,2) .build()) .layer(new ConvolutionLayer.Builder(5, 5) .stride(1,1) .nOut(50) .activation(Activation.IDENTITY) .build()) .layer(new SubsamplingLayer.Builder(PoolingType.MAX) .kernelSize(2,2) .stride(2,2) .build()) .layer(new DenseLayer.Builder().activation(Activation.RELU) .nOut(500).build()) .layer(new OutputLayer.Builder(LossFunctions.LossFunction.NEGATIVELOGLIKELIHOOD) .nOut(outputNum) .activation(Activation.SOFTMAX) .build()) .setInputType(InputType.convolutionalFlat(28,28,1)) .build(); ``` ## Documentation, Guides and Tutorials You can find the official documentation for Deeplearning4J and the other libraries of its ecosystem at http://deeplearning4j.konduit.ai/. ## Want some examples? We have separate repository with various examples available: https://github.com/eclipse/deeplearning4j-examples ## Building from source It is preferred to use the official pre-compiled releases (see above). But if you want to build from source, first take a look at the prerequisites for building from source here: https://deeplearning4j.konduit.ai/getting-started/build-from-source. To build everything, we can use commands like ``` ./change-cuda-versions.sh x.x ./change-scala-versions.sh 2.xx ./change-spark-versions.sh x mvn clean install -Dmaven.test.skip -Dlibnd4j.cuda=x.x -Dlibnd4j.compute=xx ``` or ``` mvn -B -V -U clean install -pl '!jumpy,!pydatavec,!pydl4j' -Dlibnd4j.platform=linux-x86_64 -Dlibnd4j.chip=cuda -Dlibnd4j.cuda=9.2 -Dlibnd4j.compute= -Djavacpp.platform=linux-x86_64 -Dmaven.test.skip=true ``` An example of GPU "CC" or compute capability is 61 for Titan X Pascal. ## License [Apache License 2.0](LICENSE) ## Commercial Support Deeplearning4J is actively developed by the team at [Konduit K.K.](http://www.konduit.ai). [If you need any commercial support feel free to reach out to us.](https://konduit.ai/konduit-open-source-support/)