The imaging code requires that you add the following getters to your network class:
// To be added
public double[][] getInputLayer(){ return inputLayer; }
public double[][][] getConv1Output(){ return conv1Output; }
public double[][][] getPool1Output(){ return pool1Output; }
public double[][][] getConv2Output(){ return conv2Output; }
public double[][][] getPool2Output(){ return pool2Output; }
public double[] getFc1Output(){ return fc1Output; }
public double[] getFc2Output(){ return fc2Output; }
public double[] getOutputLayer(){ return outputLayer; }
Here is the code for displaying the activations of the LeNet5: NetworkVisualizer.java
public double computeLoss(int label) {
// Cross-entropy loss
return -Math.log(outputLayer[label] + 1e-10);
}
public int getPrediction() {
int maxIndex = 0;
double maxValue = outputLayer[0];
for (int i = 1; i < OUTPUT_NUM_NEURONS; i++) {
if (outputLayer[i] > maxValue) {
maxValue = outputLayer[i];
maxIndex = i;
}
}
return maxIndex;
}