Skip to content

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

License

Notifications You must be signed in to change notification settings

szaza/tensorflow-java-examples-spring

Repository files navigation

TensorFlow Java tutorial with Spring Framework and Gradle

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.

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://localhost:8080 and you should see the webpage.

Demo application

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

Have a look at my previous project for better understanding of the object detection part: Tensorflow Java API example application or visit my site: https://sites.google.com/view/tensorflow-example-java-api.

News about YoloV3 support

The current solution doesn't support the YoloV3 model and unfortunately, I do not have time to implement it, however I would be very happy if I could help to implement and I could review a PR with this feture. For this reason I've started a new branch here: https://github.com/szaza/tensorflow-java-examples-spring/tree/feature/add-yolov3-support; If you are interested in this feature and you would like to be a collabortor, please add a comment for this thread: #2;

Many-many thank for any support!

About

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

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published