Clear Filters
Clear Filters

Error : Network: Incompatible input and output sequence lengths. The network must return sequences with the same length as the input data or data without a time dimension.

18 views (last 30 days)
I would like to train a CNN model to perform motor fault diagnosis based on vibration signal. I would like to define my CNN parameter as shown in the picture below. This is from a reference paper: Jing, L., Zhao, M., Li, P., & Xu, X. (2017). A convolutional neural network based feature learning and fault diagnosis method for the condition monitoring of gearbox. Measurement: Journal of the International Measurement Confederation, 111. https://doi.org/10.1016/j.measurement.2017.07.017
But I got an error message as shown below. I have 5 motor's fault conditions, where each fault has 1536000 data points, and 6144 data points is selected as one segment. So, each fault has 250 datasets, where each dataset has 6144 data points. Total 5 motor fault conditions, I have 1250 datasets and split it into 625 for training and testing. So the input data to the CNN model is 625 datasets with 6144 data points in each dataset. labels_train corresponds to the data_train to label the fault condition of each datasets. May I know how to solve the error?

Answers (1)

Subhajyoti
Subhajyoti on 4 Sep 2024
Hi @Koo,
It is my understanding that you are trying to classify the motor fault conditions for every timesteps by modelling the problem into a sequence classification task.
The error you're encountering typically arises when there is a mismatch between the input and output sequence lengths in your network architecture.
In a Sequence Classification Task, the Batch-Size (B) and Time-Step (T) remain consistent throughout the network, and only the Channel-size (C) can vary. You can re-design the network architecture to maintain consistent timesteps throughout the layers.
You may go through the following MathWorks documentation link to learn more about ‘dlarray’:
You can refer to this resource for ’Sequence Classification Using Deep Learning’ in MATLAB :
I hope this helps.

Categories

Find more on Deep Learning Toolbox in Help Center and File Exchange

Tags

Products


Release

R2023a

Community Treasure Hunt

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

Start Hunting!