- Classification Layer : https://www.mathworks.com/help/deeplearning/ug/create-simple-deep-learning-network-for-classification.html#:~:text=fully%20connected%20layer.-,Classification%20Layer,-The%20final%20layer
- Sequence-to-sequence classification: https://www.mathworks.com/help/deeplearning/ug/sequence-to-sequence-classification-using-deep-learning.html
why do I have error that "Unexpected response size: If the network outputs sequences, then the responses must be arrays with feature dimension 5."
2 views (last 30 days)
Show older comments
Hi!
I am studying deeplearning toolbox.
To solve the problem of classifying 5 class, I created a sequence data store using a custom datastore.
The number of classes is 5 in total, and the last layer of the neural network is fullyConnectedLayer(5), which matches the number of classes.
However, when I try to train it, I get an error "Unexpected response size: If the network outputs sequences, then the responses must be arrays with feature dimension 5."
The last layer of the neural network is set to 5, so there is no problem I think.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/954365/image.jpeg)
What is the problem?
Thanks for reading.
0 Comments
Answers (1)
Avadhoot
on 16 Jan 2024
Hi Youngwoo,
I understand you're encountering an error related to the output dimensions of your network. Given that your input data is a sequence, the network is treating this as a sequence-to-sequence model, which requires the output to also be a sequence with a feature dimension of 5. Here, "feature dimension" means that each output should be an array with a length of 5.
The error arises because the "classificationLayer" at the end of your network is designed to predict one of the 5 classes, whereas your model expects a vector of length 5 for its output. If your goal is to perform classification on your data, the "numClasses" property is relevant. However, if you're solving a sequence prediction problem, you'll need to format your data so that the output is a sequence of vectors, each with a length of 5.
For more information about the following topics, refer to the below documentation:
I hope it helps.
0 Comments
See Also
Categories
Find more on Image Data Workflows in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!