Code from DeepDream.scala:60 executed in 0.00 seconds (0.000 gc):
implicit val _ = log
// First, basic configuration so we publish to our s3 site
log.setArchiveHome(URI.create(s"s3://$s3bucket/${getClass.getSimpleName.stripSuffix("$")}/${log.getId}/"))
log.onComplete(() => upload(log): Unit)
// Fetch input image (user upload prompt)
ImageArtUtil.load(log, contentUrl, resolution)
val canvas = new AtomicReference[Tensor](null)
// Execute the main process while registered with the site index
val registration = registerWithIndexJPG(canvas.get())
try {
// In contrast to other uses, in this painting operation we are enhancing
// an input image (content) only, with no other inputs or canvas preparation.
withMonitoredJpg(() => canvas.get().toImage) {
paint(contentUrl, contentUrl, canvas, new VisualStyleNetwork(
styleLayers = List(
// DeepDream traditionally uses the last layer of a network
VGG16.VGG16_3b
),
styleModifiers = List(
// This operator increases the RMS power of any signal
new ChannelPowerEnhancer()
),
styleUrl = List(contentUrl)
), new BasicOptimizer {
override val trainingMinutes: Int = 180
override val trainingIterations: Int = 200
override val maxRate = 1e9
}, new GeometricSequence {
override val min: Double = resolution
override val max: Double = resolution
override val steps = 1
}.toStream.map(_.round.toDouble): _*)
null
}
} finally {
registration.foreach(_.stop()(s3client, ec2client))
}
}
<function0>
Code from BasicOptimizer.scala:75 executed in 5521.31 seconds (74.157 gc):
val lineSearchInstance: LineSearchStrategy = lineSearchFactory
IterativeTrainer.wrap(trainable)
.setOrientation(orientation())
.setMonitor(new TrainingMonitor() {
override def clear(): Unit = trainingMonitor.clear()
override def log(msg: String): Unit = trainingMonitor.log(msg)
override def onStepFail(currentPoint: Step): Boolean = {
BasicOptimizer.this.onStepFail(trainable, currentPoint)
}
override def onStepComplete(currentPoint: Step): Unit = {
if (0 < logEvery && (0 == currentPoint.iteration % logEvery || currentPoint.iteration < logEvery)) {
val image = currentImage
timelineAnimation += image
val caption = "Iteration " + currentPoint.iteration
out.p(caption + "\n" + out.jpg(image, caption))
}
BasicOptimizer.this.onStepComplete(trainable, currentPoint)
trainingMonitor.onStepComplete(currentPoint)
super.onStepComplete(currentPoint)
}
})
.setTimeout(trainingMinutes, TimeUnit.MINUTES)
.setMaxIterations(trainingIterations)
.setLineSearchFactory((_: CharSequence) => lineSearchInstance)
.setTerminateThreshold(java.lang.Double.NEGATIVE_INFINITY)
.runAndFree
.asInstanceOf[lang.Double]
Reset training subject: 1108108400058100
Reset training subject: 1108115147189900
Adding measurement 92d1782 to history. Total: 0
LBFGS Accumulation History: 1 points
Constructing line search parameters: GD+Trust
th(0)=-1.0263648102663125;dx=-2.33836742334228E-6
New Minimum: -1.0263648102663125 > -1.0263668513245987
WOLFE (weak): th(2.154434690031884)=-1.0263668513245987; dx=-2.3383232399747416E-6 evalInputDelta=2.0410582861618565E-6
New Minimum: -1.0263668513245987 > -1.0263707222972105
WOLFE (weak): th(4.308869380063768)=-1.0263707222972105; dx=-2.3385343932501096E-6 evalInputDelta=5.912030897947673E-6
New Minimum: -1.0263707222972105 > -1.0263838132227703
WOLFE (weak): th(12.926608140191302)=-1.0263838132227703; dx=-2.3383343874598623E-6 evalInputDelta=1.900295645773653E-5
New Minimum: -1.0263838132227703 > -1.0264418074306265
WOLFE (weak): th(51.70643256076521)=-1.0264418074306265; dx=-2.3386546806963814E-6 evalInputDelta=7.699716431397441E-5
New Minimum: -1.0264418074306265 > -1.0267495849439217
WOLFE (weak): th(258.53216280382605)=-1.0267495849439217; dx=-2.3403091117703104E-6 evalInputDelta=3.847746776091121E-4
New Minimum: -1.0267495849439217 > -1.028681270658511
WOLFE (weak): th(1551.1929768229563)=-1.028681270658511; dx=-2.3603650981603752E-6 evalInputDelta=0.0023164603921983495
New Minimum: -1.028681270658511 > -1.0425226722357266
WOLFE (weak): th(10858.350837760694)=-1.0425226722357266; dx=-2.3076372231522412E-6 evalInputDelta=0.016157861969414045
New Minimum: -1.0425226722357266 > -1.1445353284306423
END: th(86866.80670208555)=-1.1445353284306423; dx=-1.7082322021950888E-6 evalInputDelta=0.11817051816432977
Fitness changed from -1.0263648102663125 to -1.1445353284306423
Iteration 1 complete. Error: -1.1445353284306423 Total: 81.6541; Orientation: 0.0719; Line Search: 60.8348
<a id="p-10"></a>Iteration 1
<a id="p-9"></a>![Iteration 1](etc/e2e132ef-ef4f-4f1e-8cc7-e156eec77a06.jpg)
Adding measurement 32d5279 to history. Total: 1
LBFGS Accumulation History: 2 points
th(0)=-1.1
...skipping 182301 bytes...
536790787016; dx=-0.0017151779161694019 evalInputDelta=2.305426290340506
Fitness changed from -414.87994161752965 to -417.18536790787016
Iteration 198 complete. Error: -417.18536790787016 Total: 33.7004; Orientation: 1.4643; Line Search: 26.1743
Adding measurement 712594f4 to history. Total: 3
Rejected: LBFGS Orientation magnitude: 3.252e+03, gradient 5.029e-02, dot -0.805; [ec55e1b5-309b-4b47-8b69-91e14ce695a9 = 1.000/1.000e+00]
Orientation rejected. Popping history element from -407.2201477231623, -412.4313473347618, -414.87994161752965, -417.18536790787016
LBFGS Accumulation History: 3 points
Removed measurement 6ec77cab to history. Total: 4
th(0)=-417.18536790787016;dx=-0.002529467773043591
New Minimum: -417.18536790787016 > -418.994012435411
END: th(11432.347912323548)=-418.994012435411; dx=-0.001506774560350311 evalInputDelta=1.808644527540821
Fitness changed from -417.18536790787016 to -418.994012435411
Iteration 199 complete. Error: -418.994012435411 Total: 21.2265; Orientation: 1.4692; Line Search: 13.0229
Adding measurement 76bdfc19 to history. Total: 3
Rejected: LBFGS Orientation magnitude: 5.888e+03, gradient 5.170e-02, dot -0.768; [ec55e1b5-309b-4b47-8b69-91e14ce695a9 = 1.000/1.000e+00]
Orientation rejected. Popping history element from -412.4313473347618, -414.87994161752965, -417.18536790787016, -418.994012435411
LBFGS Accumulation History: 3 points
Removed measurement 3b1895e to history. Total: 4
th(0)=-418.994012435411;dx=-0.002672765171288766
New Minimum: -418.994012435411 > -419.1541890592065
END: th(24630.24693082344)=-419.1541890592065; dx=-0.001062113611227595 evalInputDelta=0.16017662379550757
Fitness changed from -418.994012435411 to -419.1541890592065
Iteration 200 complete. Error: -419.1541890592065 Total: 21.0440; Orientation: 1.4827; Line Search: 13.2479
<a id="p-96"></a>Iteration 200
<a id="p-95"></a>![Iteration 200](etc/fbf42b6d-e4a2-4ccf-bb69-9cb1405d970e.jpg)
Final threshold in iteration 200: -419.1541890592065 (> -Infinity) after 5521.303s (< 10800.000s)
-419.1541890592065