Style Transfer with Convolutional Neural Networks


 This application adds a GUI to the style transfer convolutional neural network found in the DeepLearning4J examples.

Project Photos

 Here is a screenshot: application screenshot

Here is some sample output: babo block
babo edtaonisl

Software Prerequisites

  • Java 8 or better
  • JavaFX support (comes with Java 8 or as a dependency for versions after Java 8)

Software Walkthrough

 Becuase this project has a long running project it was important to observe the 1st rule of GUI development. Do not block the event dispatch thread.

For this project that means run any long running processes off of the 'JavaFX thread' and run any UI updates from the long running process on the JavaFX thread.

This translates to 'off the JavaFX thread' -> javafx.concurrent.Task
combined with task.messageProperty().addListener() {}

And 'on the JavaFX thread' -> Platform.runLater()

Running the application

 Clone the project (see the source code link in the 'Resources' section). Then build the software with 'mvn package'.

The issue 'java -jar style-transfer-i-10.jar'


 Select a content image, select a style image, then click the 'Apply Style' button. Once the processing completes, the 'please wait' dialog closes. The output images are placed alongside the content image under a directory named 'styled'.

Going Further

 This project has potential to go way further. Some ideas are included below

  • Add a user input control to specify the number of iterations.
  • Add user input controls to control hyper-parameters of the model itself.
  • Provide a way to view the output images at full size.

Date Created

Mon Nov 18 13:18:10 CST 2019

Last Updated


back    |    top