1. BigTexture
  2. Resolution 120.0
  3. Resolution 310.0
  4. Resolution 800.0
  5. Resolution 1024.0

BigTexture

Creates a large texture based on a style using:
  1. Random plasma initialization
  2. Standard VGG19 layers
  3. Operators constraining and enhancing style
  4. Progressive resolution increase
  5. View layer to enforce tiling

Subreport: com.simiacryptus.mindseye.art.examples.BigTextureEC2%24_7ad6df67-6df4-48ac-b6cc-e86d9ca93912_log_com.simiacryptus.ref.lang.ReferenceCountingBase

Code from BigTexture.scala:64 executed in 0.00 seconds (0.000 gc):

    () => {
      implicit val implicitLog = log
      // First, basic configuration so we publish to our s3 site
      log.setArchiveHome(URI.create(s"s3://$s3bucket/$className/${log.getId}/"))
      log.onComplete(() => upload(log): Unit)
      // Fetch image (user upload prompt) and display a rescaled copy
      loadImages(log, styleUrl, (400 * Math.sqrt(1)).toInt).foreach(img => log.p(log.jpg(img, "Input Style")))
      val canvas = new RefAtomicReference[Tensor](null)
  
      // Tiling layer used by the optimization engine.
      // Expands the canvas by a small amount, using tile wrap to draw in the expanded boundary.
      def tilingLayer(dims: Seq[Int]) = {
        val paddingX = Math.min(256, Math.max(16, dims(0) / 2))
        val paddingY = Math.min(256, Math.max(16, dims(1) / 2))
        val layer = new ImgViewLayer(dims(0) + paddingX, dims(1) + paddingY, true)
        layer.setOffsetX(-paddingX / 2)
        layer.setOffsetY(-paddingY / 2)
        layer
      }
  
      // Execute the main process while registered with the site index
      val registration = registerWithIndexJPG(() => canvas.get())
      try {
        // Display a pre-tiled image inside the report itself
        withMonitoredJpg(() => {
          val tensor = canvas.get()
          val image = tensor.toImage
          tensor.freeRef()
          image
        }) {
          // Display an additional, non-tiled image of the canvas
          withMonitoredJpg(() => Option(canvas.get()).map(tensor => {
            val image = tensor.toRgbImage
            tensor.freeRef()
            image
          }).orNull) {
            paint(
              contentUrl = initUrl,
              initUrl = initUrl,
              canvas = canvas,
              network = new VisualStyleNetwork(
                styleLayers = List(
                  // We select all the lower-level layers to achieve a good balance between speed and accuracy.
                  VGG19.VGG19_0b,
                  VGG19.VGG19_1a,
                  VGG19.VGG19_1b1,
                  VGG19.VGG19_1b2,
                  VGG19.VGG19_1c1,
                  VGG19.VGG19_1c2,
                  VGG19.VGG19_1c3,
                  VGG19.VGG19_1c4,
                  VGG19.VGG19_1d1,
                  VGG19.VGG19_1d2,
                  VGG19.VGG19_1d3,
                  VGG19.VGG19_1d4
                ),
                styleModifiers = List(
                  // These two operators are a good combination for a vivid yet accurate style
                  new GramMatrixEnhancer(),
                  new MomentMatcher()
                ),
                styleUrls = Option(styleUrl),
                magnification = 1,
                viewLayer = tilingLayer
              ),
              optimizer = new BasicOptimizer {
                override val trainingMinutes: Int = 60
                override val trainingIterations: Int = 20
                override val maxRate = 1e9
              },
              aspect = Option(aspectRatio),
              resolutions = new GeometricSequence {
                override val min: Double = 120
                override val max: Double = 800
                override val steps = 3
              }.toStream.map(_.round.toDouble)
            )
            paint(
              contentUrl = initUrl,
              initUrl = initUrl,
              canvas = canvas,
              network = new VisualStyleNetwork(
                styleLayers = List(
                  // We select all the lower-level layers to achieve a good balance between speed and accuracy.
                  VGG19.VGG19_0b,
                  VGG19.VGG19_1a,
                  VGG19.VGG19_1b1,
                  VGG19.VGG19_1b2,
                  VGG19.VGG19_1c1,
                  VGG19.VGG19_1c2,
                  VGG19.VGG19_1c3
                ),
                styleModifiers = List(
                  new GramMatrixEnhancer(),
                  new GramMatrixMatcher()
                ),
                styleUrls = Option(styleUrl),
                magnification = 1,
                viewLayer = tilingLayer
              ),
              optimizer = new BasicOptimizer {
                override val trainingMinutes: Int = 90
                override val trainingIterations: Int = 10
                override val maxRate = 1e9
              },
              aspect = Option(aspectRatio),
              resolutions = new GeometricSequence {
                override val min: Double = 1024
                override val max: Double = 4000
                override val steps = 3
              }.toStream.map(_.round.toDouble)
            )
          }
        }
        null
      } finally {
        registration.foreach(_.stop()(s3client, ec2client))
      }
    }

Returns:

    <function0>

Input Style

Input Style

Resolution 120.0

Subreport: Optimization

Resolution 310.0

Subreport: Optimization

Resolution 800.0

Subreport: Optimization

Resolution 1024.0