O'Reilly logo

Java Deep Learning Projects by Md. Rezaul Karim

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Preparing the ND4J dataset

As I said previously, we need an intermediate conversion to prepare the training set containing feature vectors and labels: features from images, but labels from the business labels.

For this, we have the makeND4jDataSets class (see makeND4jDataSets.java for details). The class creates an ND4J dataset object from the data structure from the alignLables function in the List[(imgID, bizID, labels, pixelVector)] form. First, we prepare the dataset using the makeDataSet() method as follows:

public static DataSet makeDataSet(FeatureAndDataAligner alignedData, int bizClass) {        INDArray alignedXData = makeDataSetTE(alignedData);        List<Set<Integer>> labels = alignedData.getBusinessLabels();        float[][] matrix2 = labels.stream().map(x ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required