Regression with images

I did age and gender classification, but now i want to modify it to try regression for age.
I have images and image name carry info about age of person.

ImageRegressionLabelGenerator labelMaker = new ImageRegressionLabelGenerator();

ImageRecordReader recordReader = new ImageRecordReader(height, width, channels, labelMaker);
recordReader.initialize(trainingData, getImageTransform());
DataSetIterator dataSetIterator = new RecordReaderDataSetIterator(recordReader, batchSize, 1, 1, true);;
dataSetIterator.setPreProcessor(dataNormalization);, numEpochs);

But when I start training, error is:
Labels and preOutput must have equal shapes: got shapes [32, 65] vs [32, 1]

Batch size is 32, i have 90k images in range from 0 to 64.
Last layer:
.addLayer(“outputAge”, new OutputLayer.Builder(LossFunctions.LossFunction.MSE)
.build(), “dense”);
For architecture I am using denseNet example.

How to create this, so i can make model which for provided image return age?

Take a look at our regression example here:

The key is setting up the recordreaderdatasetiterator to expect regression.

thank for response, but i need help with preparing dataset. I see in this example that we have as input same type of data as output (string value). But how to make this if i work with images? I should provide images as input and expect numeric value (example : image of person -> 47 years). Any tips how to do it?

Thanks on your time!

Check out this youtube video.
I have not done what you are doing but to play around a bit you could crop the faces with opencv and put them into an autoencoder to see what features get picked up.

After that put a feed forward network on the end of the auto encoders encoding side and do normal regression training. If you have a large dataset I think it would work.

Have you tried something like that?