Subreport: To Run Again On EC2
Subreport: Logs for com.simiacryptus.ref.lang.ReferenceCountingBase
NeuronDeconstructionRotors.scala:77 executed in 0.00 seconds (0.000 gc):
() => {
implicit val implicitLog = log
// First, basic configuration so we publish to our s3 site
if (Option(s3bucket).filter(!_.isEmpty).isDefined)
log.setArchiveHome(URI.create(s"s3://$s3bucket/$className/${log.getId}/"))
log.onComplete(() => upload(log): Unit)
val srcImage = ImageArtUtil.loadImage(log, sourceUrl, srcResolution)
log.p(log.jpg(srcImage, "Source"))
val animationDelay = 1000
val renderedCanvases = new ArrayBuffer[() => BufferedImage]
// Execute the main process while registered with the site index
val registration = registerWithIndexGIF(renderedCanvases.filter(_ != null).map(_ ()), delay = animationDelay)
try {
withMonitoredGif(() => renderedCanvases.filter(_ != null).map(_ ()), delay = animationDelay) {
val allData: List[(pipelineType, Int, Double, Double)] = (for (
res <- new GeometricSequence {
override def min: Double = 256
override def max: Double = srcResolution
override def steps: Int = 10
}.toStream;
layer <- Inception5H.values()
) yield {
val layerProduct: Tensor = simpleEval(layer.getPipeline.get(layer.name()), Tensor.fromRGB(ImageUtil.resize(srcImage, res.toInt, true)))
(0 until layerProduct.getDimensions()(2)).map(band => (layer, band, res, layerProduct.selectBand(band).getDoubleStatistics().getAverage()))
}).flatten.toList
val adj = allData.groupBy(_._1).mapValues(_.map(_._4).toArray).mapValues(x => x.sum.toDouble / x.size)
val bestPerResolution: Array[(pipelineType, Int, Double, Double)] = allData.groupBy(x => (x._1, x._2))
.mapValues(_.maxBy(_._4)).values.toArray.sortBy(t => t._4 / adj(t._1)).reverse.take(20)
for ((layer, rows) <- bestPerResolution.groupBy(_._1)) {
log.subreport("Neurons in " + layer.name(), (sub: NotebookOutput) => {
for ((_, band, res, _) <- rows) {
sub.h2(layer.name() + " " + band + " at " + res.floor.toInt)
sub.eval(() => {
allData.filter(_._1 == layer).filter(_._2 == band).map(t => t._3.toInt -> t._4).toMap
})
val size = renderedCanvases.size
(1 to repeat).map(_ => {
val image = test(layer, band, layer.name() + " " + band + " @ " + res.floor.toInt, 512)(sub)
if (renderedCanvases.size > size) {
renderedCanvases(size) = () => image
} else {
renderedCanvases += (() => image)
}
})
}
})
}
}
} finally {
registration.foreach(_.stop()(s3client, ec2client))
}
}
Returns
{ }
Subreport: Neurons in Inc5H_4d
Subreport: Neurons in Inc5H_2a
Subreport: Neurons in Inc5H_5b
Subreport: Neurons in Inc5H_4e