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

Scoring the model

The scoring approach that we are going to use is simple. It assigns business-level labels by averaging the image-level predictions. I did this in a simplistic manner, but you can try using a better approach. What I did is assign a business as label 0 if the average of the probabilities across all of its images belonging to class 0 are greater than a certain threshold, say, 0.5:

public static INDArray scoreModel(MultiLayerNetwork model, INDArray ds) {        return model.output(ds);    }

Then, I collected the model predictions from the scoreModel() method and merged them with alignedData:

/** Take model predictions from scoreModel and merge with alignedData*/public static List<Pair<String, Double>> aggImgScores2Business(INDArray scores, ...

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