1. StyleTransfer
  2. Resolution 320.0
  3. Resolution 620.0
  4. Resolution 1200.0


Paints an image in the style of another using:

  1. Random plasma initialization
  2. Standard VGG16 layers
  3. Operators to match content and constrain and enhance style
  4. Progressive resolution increase

Code from StyleTransfer.scala:65 executed in 0.00 seconds (0.000 gc):

    implicit val _ = log
    // First, basic configuration so we publish to our s3 site
    log.onComplete(() => upload(log): Unit)
    // Fetch input images (user upload prompts) and display a rescaled copies
    log.p(log.jpg(ImageArtUtil.load(log, styleUrl, (maxResolution * Math.sqrt(magnification)).toInt), "Input Style"))
    log.p(log.jpg(ImageArtUtil.load(log, contentUrl, maxResolution), "Input Content"))
    val canvas = new AtomicReference[Tensor](null)
    // Execute the main process while registered with the site index
    val registration = registerWithIndexJPG(canvas.get())
    try {
      // Display an additional image inside the report itself
      withMonitoredJpg(() => canvas.get().toImage) {
        paint(contentUrl, initUrl, canvas, new VisualStyleContentNetwork(
          styleLayers = List(
            // We select all the lower-level layers to achieve a good balance between speed and accuracy.
          styleModifiers = List(
            // These two operators are a good combination for a vivid yet accurate style
            new GramMatrixEnhancer(),
            new MomentMatcher()
          styleUrl = List(styleUrl),
          contentLayers = List(
            // We use fewer layer to be a constraint, since the ContentMatcher operation defines
            // a stronger operation. Picking a mid-level layer ensures the match is somewhat
            // faithful to color, contains detail, and still accomidates local changes for style.
          contentModifiers = List(
            // Standard content matching operator
            new ContentMatcher()
          magnification = magnification
        ), new BasicOptimizer {
          override val trainingMinutes: Int = 60
          override val trainingIterations: Int = 20
          override val maxRate = 1e9
        }, new GeometricSequence {
          override val min: Double = minResolution
          override val max: Double = maxResolution
          override val steps = StyleTransfer.this.steps
        }.toStream.map(_.round.toDouble): _*)
    } finally {
      registration.foreach(_.stop()(s3client, ec2client))



Input Style

Input Content

Resolution 320.0

Subreport: Optimization

Resolution 620.0

Subreport: Optimization

Resolution 1200.0

Subreport: Optimization