Skip to content

Instantly share code, notes, and snippets.

@jesuino
Created October 22, 2017 21:08
Sample code to load the images from a directory to be used to feed a neural network using DeepLearning4J
ParentPathLabelGenerator labelGenerator = new ParentPathLabelGenerator();
File coinsTrainRootDir = Paths.get("/path/to/my/mycooldataset/train").toFile();
InputSplit trainData = new FileSplit(coinsTrainRootDir, BaseImageLoader.ALLOWED_FORMATS, new Random());
ImageRecordReader trainReader = new ImageRecordReader(IMG_WIDTH, IMG_HEIGHT, 3, labelGenerator);
trainReader.initialize(trainData);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment