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 ビュー (過去 30 日間)
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.
What is the problem?
Thanks for reading.

回答 (1 件)

Avadhoot
Avadhoot 2024 年 1 月 16 日
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:
  1. 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
  2. Sequence-to-sequence classification: https://www.mathworks.com/help/deeplearning/ug/sequence-to-sequence-classification-using-deep-learning.html
I hope it helps.

カテゴリ

Help Center および File ExchangeImage Data Workflows についてさらに検索

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by