Which kind of input does a CNN for regression need?

10 visualizzazioni (ultimi 30 giorni)
My problem is to construct a CNN for regression. I have a lot of images, and each one has a specific coordinate x associated. I know how to construct the architecture of the CNN, but my question is about how to input the images into the CNN to perform the regression of the coordinate x associated to each image. I know that for a CNN for classification problem it is just sufficient to divide the dataset of images into training, validation and test. But for the regression problem I don't know if it is the same. Moreover the example "Train aConvolutional Neural Network for Regression" doesn't explain what to give as input to the CNN (a CNN for regression needs always for training and validation images 4-D arrays? Reading this example it seems yes, but not sure about it). Thank you for your help.

Risposta accettata

Antoni Woss
Antoni Woss il 14 Dic 2022
The input layer to the CNN that processes images, whether you are performing a regression or classification problem on those images, will need to be configured to the specific size of the images in your dataset. This can be done in the imageInputLayer - see https://uk.mathworks.com/help/deeplearning/ref/nnet.cnn.layer.imageinputlayer.html. The image inputs are typically 3-D arrays, pixel-by-pixel-by-channel (where for colour images you have 3 channels, RGB). The 4th dimension would be the observation or batch dimension, so pixel-by-pixel-by-channel-by-observation.
The division of data into training, validate and test is independent of the network task, i.e. whether it is classification or regression, and should always be considered for evaluating network performance. How much you partition your data set into these subsets is a hyperparameter that you as a network architect decide, for example, 70% training, 10% validation, 20% test.
The following example shows how to train a CNN on images for a regression task - https://uk.mathworks.com/help/deeplearning/ug/train-a-convolutional-neural-network-for-regression.html.

Più risposte (0)

Prodotti


Release

R2022b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by