Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in AI and Deep Learning by (50.2k points)

I am trying to find a tutorial that can help to train an image classification model in java. I should work the same way we train models in python.

1 Answer

0 votes
by (108k points)

To start with Java, you need to first set up a Maven project and add the following dependency to your pom.xml.

<dependency>

<groupId>org.tensorflow</groupId>

<artifactId>tensorflow</artifactId>

<version>1.7.0</version>

</dependency>

This is an enumeration of two libraries:

libtensorflow

libtensorflow_jni

This process wraps up all the TensorFlow C++ libraries and JNI connector to access it through Java programs.

By default, it works on CPU powers. You can also add the following dependency to support GPU acceleration. 

<dependency>

<groupId>org.tensorflow</groupId>

<artifactId>libtensorflow_jni_gpu</artifactId>

<version>1.7.0</version>

</dependency>

Now, you're ready to use TensorFlow features on Java.

For the whole program of training the model, refer the following link: https://github.com/tensorflow/models/blob/master/samples/languages/java/training/src/main/java/Train.java

Browse Categories

...