I have a task to train CNN with an image as input and an image as output. I have tried to do it at the beginning with Matlab tutorial, but matlab has no image as output, but a vector. https://de.mathworks.com/help/deeplearning/examples/train-a-convolutional-neural-network-for-regression.html any idea how i can do this tutorial again but with image as output? For example you could insert input as image for number one and the output is also for number one but rotated or deformed.
Kshitij Singh answered .
2025-11-20
layers = [
imageInputLayer([64 64 1]) % My initial image is 64x64
convolution2dLayer(3,8,'Padding','same')
batchNormalizationLayer
reluLayer
% averagePooling2dLayer(2,'Stride',1) % Don't want this
convolution2dLayer(3,16,'Padding','same')
batchNormalizationLayer
reluLayer
% averagePooling2dLayer(2,'Stride',1) % Don't want this
convolution2dLayer(3,32,'Padding','same')
batchNormalizationLayer
reluLayer
convolution2dLayer(3,1,'Padding','same') % Because my initial image 3rd dimension is one.
batchNormalizationLayer
reluLayer
dropoutLayer(0.2)
% fullyConnectedLayer(10) % Don't want this
regressionLayer];