Skip to content

Instantly share code, notes, and snippets.

@schrum2
Created November 13, 2017 03:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save schrum2/254dec555ba6908c8f8a21f3141e023c to your computer and use it in GitHub Desktop.
Save schrum2/254dec555ba6908c8f8a21f3141e023c to your computer and use it in GitHub Desktop.
DL4J fatal exception
public static void main(String[] args) throws IOException {
ZooModel zooModel = new VGG16();
ComputationGraph vgg16 = (ComputationGraph) zooModel.initPretrained(PretrainedType.IMAGENET);
NativeImageLoader loader = new NativeImageLoader(224, 224, 3);
DataNormalization scaler = new VGG16ImagePreProcessor();
String contentFile = "data/cat.jpg";
INDArray content = loader.asMatrix(new File(contentFile));
scaler.transform(content);
// Input presentation: necessary?
INDArray[] result = vgg16.output(content);
Layer block1_conv2 = vgg16.getLayer("block1_conv2");
INDArray block1_conv2_features = block1_conv2.activate();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment