# I am asking for help on a Dl4j code to extract class labels from the output layer of a FaceNetNN4Small2 computationgraph

**URL:** <https://community.konduit.ai/t/i-am-asking-for-help-on-a-dl4j-code-to-extract-class-labels-from-the-output-layer-of-a-facenetnn4small2-computationgraph/2447>\
**Category:** Uncategorized\
**Created:** [April 6, 2023, 9:11pm UTC](https://community.konduit.ai/t/i-am-asking-for-help-on-a-dl4j-code-to-extract-class-labels-from-the-output-layer-of-a-facenetnn4small2-computationgraph/2447 "2023-04-06T21:11:58Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![AUGUSTINE-BEILEL](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/augustine-beilel/32/1070_2.png) [@AUGUSTINE-BEILEL](https://community.konduit.ai/u/AUGUSTINE-BEILEL)\
**Post date:** [April 6, 2023, 9:11pm UTC](https://community.konduit.ai/t/i-am-asking-for-help-on-a-dl4j-code-to-extract-class-labels-from-the-output-layer-of-a-facenetnn4small2-computationgraph/2447/1 "2023-04-06T21:11:58Z")

</div>

I have the following code snippet but getLabels() does not work for dl4j version 1.0.0-m2.1. I would not wish to manually use this: String labels = {“Eight”, “Five”, “Four”, “Nine”, “One”, “Seven”, “Six”, “Three”, “Two”, “Zero”}; to access class lable names. Thank you

```
                          // Load the image and convert it to a 4D array
                           NativeImageLoader loader = new NativeImageLoader(height, width, channels);
                            INDArray testimage = loader.asMatrix(grabbedImage);
                           // testimage = testimage.reshape(1, 3, 96, 96); 
                            // Normalize the pixel values to be between 0 and 1
                            DataNormalization scalar = new ImagePreProcessingScaler(0, 1);
                            //then call that scalar on the image dataset
                            scalar.transform(testimage);
                            // Pass the input through the model to get the predictions
                            INDArray[] embeddings = model.output(testimage);

                            // Get the output layer index
                                int outputLayerIdx = model.getConfiguration().getNetworkOutputs().size() - 1;
                                // Get the output layer
                                Layer outputLayer = model.getLayer(model.getConfiguration().getNetworkOutputs().get(outputLayerIdx));
         // Get the labels for the output layer
                                String[] labels = ((BaseOutputLayer) outputLayer.conf().getLayer()).getLabels();

```
