How to use Matlab trainnet to train a network without an explicit output layer (R2024a)
I’ve attempted to train a CNN with the goal of assigning N numeric values to different input images, depending on image characteristics. It looked like the network’s output layer could be a fully-connected layer with N outputs (because I have not found a linear output layer in Deep Network Designer). I am not sure if I can use a non-linear output layer instead, because this is fundamentally a regression task.
However, when using a fully-connected layer in place of an output layer the trainnet gives repeating errors indicating that I must have an output layer.
So basically, I have two questions:
1) Is it possible to use trainnet in a network without an output layer? It is difficult to imagine that a built-in training function has an oversight like this. Do I really need to construct a custom training loop if my network?..
2) Are there any alternatives? In essence, all I am looking for is an output layer that is either a) linear or b) does not change the previous layer’s output. Just anything that is compatible with a regression task.
If any clarification is needed on my issue or network construction, I would be happy to provide it.
Thank you so much for your help!
Deep Learning Toolbox Version 24.1 (R2024a) , trainnet function, Matlab 2024.I’ve attempted to train a CNN with the goal of assigning N numeric values to different input images, depending on image characteristics. It looked like the network’s output layer could be a fully-connected layer with N outputs (because I have not found a linear output layer in Deep Network Designer). I am not sure if I can use a non-linear output layer instead, because this is fundamentally a regression task.
However, when using a fully-connected layer in place of an output layer the trainnet gives repeating errors indicating that I must have an output layer.
So basically, I have two questions:
1) Is it possible to use trainnet in a network without an output layer? It is difficult to imagine that a built-in training function has an oversight like this. Do I really need to construct a custom training loop if my network?..
2) Are there any alternatives? In essence, all I am looking for is an output layer that is either a) linear or b) does not change the previous layer’s output. Just anything that is compatible with a regression task.
If any clarification is needed on my issue or network construction, I would be happy to provide it.
Thank you so much for your help!
Deep Learning Toolbox Version 24.1 (R2024a) , trainnet function, Matlab 2024. I’ve attempted to train a CNN with the goal of assigning N numeric values to different input images, depending on image characteristics. It looked like the network’s output layer could be a fully-connected layer with N outputs (because I have not found a linear output layer in Deep Network Designer). I am not sure if I can use a non-linear output layer instead, because this is fundamentally a regression task.
However, when using a fully-connected layer in place of an output layer the trainnet gives repeating errors indicating that I must have an output layer.
So basically, I have two questions:
1) Is it possible to use trainnet in a network without an output layer? It is difficult to imagine that a built-in training function has an oversight like this. Do I really need to construct a custom training loop if my network?..
2) Are there any alternatives? In essence, all I am looking for is an output layer that is either a) linear or b) does not change the previous layer’s output. Just anything that is compatible with a regression task.
If any clarification is needed on my issue or network construction, I would be happy to provide it.
Thank you so much for your help!
Deep Learning Toolbox Version 24.1 (R2024a) , trainnet function, Matlab 2024. trainnet output layer MATLAB Answers — New Questions