use of org.deeplearning4j.ui.weights.ConvolutionListenerPersistable in project deeplearning4j by deeplearning4j.
the class ConvolutionalListenerModule method getImage.
private Result getImage() {
if (lastTimeStamp > 0 && lastStorage != null) {
Persistable p = lastStorage.getStaticInfo(lastSessionID, TYPE_ID, lastWorkerID);
if (p instanceof ConvolutionListenerPersistable) {
ConvolutionListenerPersistable clp = (ConvolutionListenerPersistable) p;
BufferedImage bi = clp.getImg();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
try {
ImageIO.write(bi, "jpg", baos);
} catch (IOException e) {
log.warn("Error displaying image", e);
}
return ok(baos.toByteArray()).as("image/jpg");
} else {
return ok(new byte[0]).as("image/jpeg");
}
} else {
return ok(new byte[0]).as("image/jpeg");
}
}
Aggregations