Skip to content

Tensorflow Java tutorial with Spring and Gradle. This is a simple example application what uses Yolo with TF Java API and Spring Framework.

License

Notifications You must be signed in to change notification settings

ruanfeixiong/tensorflow-java-examples-spring

 
 

Repository files navigation

TensorFlow Java tutorial with Spring Framework and Gradle

Object detection server application

Object detection server side application sample program written in Java. It uses the TensorFlow Java API with a trained YOLOv2 model. The server application is implemented with Spring Framework and it is built by Gradle.

How it works?

It provides a web user interface to upload images and detect objects. Please have a look at the following screenshots:

TensorFlow Java API home page
Step1: upload your image

TensorFlow Java API object detection page
Step2: display the recognized objects

Compile and run

Preconditions:

  • Java JDK 1.8 or greater;
  • TensorFlow 1.6 or grater;
  • Git version control system;

Strongly recommended to install:

  • nVidia CUDA Toolkit 8.0 or higher version;
  • nVidia cuDNN GPU accelerated deep learning framework;

Download the frozen graph and the label file

Before compiling the source code you have to place the frozen graph and the label file into the ./graph/YOLO directory. Download one of my graphs from my google drive. There are two graphs: tiny-yolo-voc.pb and yolo-voc.pb. The tiny-yolo.pb has a lower size, however it is less accurate than the yolo-voc.pb. Modify the application.yml configuration file if it is necessary. Here you can increase the file upload limit also.

Compile with Gradle

Compile the code by typing ./gradlew clean build in the terminal window.
Run it with the command ./gradlew bootRun

Open the http://localhot:8080 and you should see the webpage.
If you want to understand better how the image recognition part works, have a look at my previous project here: Tensorflow Java API example application

Demo application

Deployed to Google cloud: http://35.231.120.117:8080/

Deployed to Heroku with a tiny-yolo model: https://still-crag-64816.herokuapp.com/

About

Tensorflow Java tutorial with Spring and Gradle. This is a simple example application what uses Yolo with TF Java API and Spring Framework.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 85.4%
  • HTML 14.6%