AryaAftab / LIGHT-SERNET

Light-SERNet: A lightweight fully convolutional neural network for speech emotion recognition

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

InvalidArgumentError: Cannot batch tensors with different shapes in component 0.

ElizavetaSedova opened this issue · comments

Hello! Good job! But I have an error. I want to test the model with my audio files. I have created a folder my_test_3.0s_Segmented in date where the audio is tagged by emotion. Everything goes well, but I always get an error at the moment: list(test_dataset.as_numpy_iterator())
InvalidArgumentError: Cannot batch tensors with different shapes in component 0. First element had shape [103,40,1] and element 1 had shape [92,40,1]. [Op:IteratorGetNext]
This prevents me from testing. I used my code on test data generated while training the model. The code works and I get the result. How can I fix it?

Hi
I did not fully understand your question. If you have cut or padded your data into 3-second pieces, why does your data have different sizes after converting to MFCC features?
There is a problem with batching if you manually place your data in the desired folders without cutting or padding. You can't batch data with different shapes in one batch. You can use the following two methods to solve this problem:

  1. Equalize your data shape before or after converting it to MFCC features.
  2. Consider each data as a batch. For example, consider a data with a size of (102,40,1) as (1,102,40,1).

If you have more questions, feel free and ask.