Input 0 Of Layer Conv1d_1 Is Incompatible With The Layer: Expected Ndim=3, Found Ndim=2. Full Shape Received: [none, 200]
I'm working on application that should predict interesting moments in 10 sec audio files. I divided audio on 50ms chunks and extracted notes, so I have 200 notes for each example.
Solution 1:
The 1D convolution over sequences expects a 3D input. In other words, for each element in the batch, for each time step, a single vector. Consider the following:
X = tf.random.normal([10, 200])
convolved = tf.keras.layers.Conv1D(32, 3, padding='same', activation=tf.nn.relu, input_shape=[None, 200])
print(convolved(X))
This throws an error:
ValueError: Input 0 of layer conv1d_3 is incompatible with the layer: expected ndim=3, found ndim=2. Full shape received: [10, 200]
However, If we provide for each of the 10 batch samples, for each of the 5 time steps, a 200 dimensional vector:
Baca Juga
- Valueerror When Loading A Previously Saved Retrained Vgg16 Model Using Keras
- Valueerror: Input 0 Of Layer Sequential_16 Is Incompatible With The Layer: Expected Ndim=5, Found Ndim=4. Full Shape Received: [none, 224, 224, 3]
- How To Classify Both Sentiment And Genres From Movie Reviews Using Cnn Tensorflow
X = tf.random.normal([10, 5, 200])
convolved = tf.keras.layers.Conv1D(32, 3, padding='same', activation=tf.nn.relu, input_shape=[None, 200])
print(convolved(X)
This works as it should. Therefore, in your case, for each audio file, for each second (depends on how you sample the data), you will have a single vector.
Post a Comment for "Input 0 Of Layer Conv1d_1 Is Incompatible With The Layer: Expected Ndim=3, Found Ndim=2. Full Shape Received: [none, 200]"