Setup environment for Deep learning with Deeplearning4j
In this tutorial, we shall see how to Setup environment for Deep Learning with Deeplearning4j and import dl4j-examples from Git to IntelliJ IDEA to start working on Deep Learning.
Following are the steps :
- Install Java.
- Install Apache Maven.
- Download IntelliJ IDEA Community Edition.
- Install Git.
- Start hands-on with dl4j-examplesClone – Git project “dl4j-examples”. – Build the project using Maven. – Import built project to IntelliJ IDEA as Maven.
Skip any of the above steps if you have already installed. Also, it is recommended to update the software to the latest available versions.
Install Apache Maven
Step 1 : Download the latest version of Maven at [https://maven.apache.org/download.cgi]
Step 2 : Install Maven following the instructions at [https://maven.apache.org/install.html]
Step 3 : Verify if maven is installed using the command
The result would be as shown in the below screenshot :
Download IntelliJ IDEA Community Edition
- Download the latest version of IntelliJ IDEA from [https://www.jetbrains.com/idea/download/]
- Extract the downloaded package and go into the folder where bin, lib, plugin, etc., folders are present. An installation guide, “Install-Linux-tar.txt” (for Linux installation), is present in the location. [A similar name would be present for other Operating Systems].
- Follow the instructions present in the setup guide.
Instructions for installing Git are available at https://git-scm.com/book/en/v2/Getting-Started-Installing-Git
Working with dl4j-examples
Create a new directory for working with dl4j projects. Say “dl4j-workspace”. And execute the following git command to download the dl4j-examples from the git repository.
|$ git clone https://github.com/deeplearning4j/dl4j-examples.git|
Following screenshot shows download in progress for dl4j-examples :
Once the download is completed, go to the folder dl4j-examples and build the project using the following command
|$ mvn clean install|
Note : Make sure the JAVA_HOME path variable is pointing to the JRE of the latest JDK available in your machine.
When the command “mvn clean insall” is run, the result is as shown in the below screenshot :
It takes some time for Maven to download all the artifacts mentioned in the pom file and build the project.
Note : Make sure your Java installation has got JavaFX. In case not, you would get a COMPILE ERROR. Try installing JavaFX by executing the following command and try “mvn clean install” again.
|sudo apt-get install openjfx|
Once the “mvn clean install” command is successful, you should see the BUILD SUCCESS as seen in the below screenshot :
Start IntelliJ IDEA.
- Click on Import Project
Choose the project folder. Click OK.
Import Project as Maven model. Click Next.
Project configuration. Keep defaults and Click on Next.
Select Profile – OpenJFX. Click Next.
Select the Maven projects in the project folder. Click Next.
Select project SDK. Click Next.
The final step, give a name to the project. Click Finish.
It takes some time for IntelliJ to index the resources in the project. And the project structure would look something link in the following screenshot.
The project “dl4j-examples” is successfully setup.
In this Deep Learning tutorial, we have seen how to setup environment for Deep learning with Deeplearning4j and import the Git project “dl4j-examples” to IntelliJ IDEA.