Hi, I got a problem during train model. Input size is (75441, 1) as numpy ndarray type. Also I tried to train it using fit method. Here is the model code.
input_size = layers.Input(shape=(npx.shape))
model = keras.Sequential(name="inputAndLFEM")
model.add(layers.Conv1D(428, 32, padding='same'))
model.add(layers.BatchNormalization(),)
model.add(layers.Activation('relu'))
model.add(layers.Conv1D(428, 32, padding='same'))
model.add(layers.Conv1D(93, 64, padding='same'))
model.add(layers.BatchNormalization(64))
model.add(layers.Activation(keras.activations.relu))
model.add(layers.MaxPool2D(pool_size=(93, 64)))
model.add(layers.Conv1D(93, 64, padding='same'))
model.add(layers.Conv1D(47, 64, padding='same'))
model.add(layers.BatchNormalization(64))
model.add(layers.Activation(keras.activations.relu))
model.add(layers.MaxPool2D(pool_size=(47, 64)))
model.add(layers.Conv1D(47, 64, padding='same'))
model.add(layers.Conv1D(24, 128, padding='same'))
model.add(layers.BatchNormalization(128))
model.add(layers.Activation(keras.activations.relu))
model.add(layers.MaxPool2D(pool_size=(24, 128)))
model.add(layers.Conv1D(12, 128, padding='same'))
model.add(layers.Conv1D(6, 256, padding='same'))
model.add(layers.BatchNormalization(256))
model.add(layers.Activation(keras.activations.relu))
model.add(layers.MaxPool2D(pool_size=(6, 256)))
model.add(layers.Conv1D(6, 256, padding='same'))
model.add(layers.Conv1D(3, 256, padding='same'))
model.add(layers.BatchNormalization(256))
model.add(layers.Activation(keras.activations.relu))
model.add(layers.MaxPool2D(pool_size=(3, 256)))
gru_out = keras.Sequential(name="nowGRU")
gru_out.add(layers.Dropout(1))
gru_out.add(layers.GRU(768))
gru_out.add(layers.Dense(96))
gru_out.add(layers.Softmax(axis=5))
print(model)
print(len(model.layers))
print(gru_out)
print(len(gru_out.layers))
and train code is here.
X_np = np.array(X)
y_np = np.array(y)
model.compile(optimizer=keras.optimizers.Adam(), loss=keras.losses.mae, metrics=['mae'])
# model.fit(tf.expand_dims(X_np, axis=-1), y=y_np, epochs=EPOCH)
model.fit(X_np, y=y_np, epochs=EPOCH)
model.summary()
and lastly, error messages are here.
[INFO] Read records file from ./mit_data/
[SIZE] X length : 75441
y length : 75441
[SIZE] X_test length : 37158
y_test length : 37158
[SIZE] NpX lenght : (75441, 428)
NpY length : (75441, 1)
[SIZE] X_test length : (37158, 428)
y_test length : (37158, 1)
Epoch 1/200
Output exceeds the size limit. Open the full output data in a text editor
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
C:\Users\HILAB_~1\AppData\Local\Temp/ipykernel_20644/2743995616.py in <module>
4 model.compile(optimizer=keras.optimizers.Adam(), loss=keras.losses.mae, metrics=['mae'])
5 # model.fit(tf.expand_dims(X_np, axis=-1), y=y_np, epochs=EPOCH)
----> 6 model.fit(X_np, y=y_np, epochs=EPOCH)
7 model.summary()
c:\Users\HILAB_Labtop_02\anaconda3\lib\site-packages\keras\utils\traceback_utils.py in error_handler(*args, **kwargs)
65 except Exception as e: # pylint: disable=broad-except
66 filtered_tb = _process_traceback_frames(e.__traceback__)
---> 67 raise e.with_traceback(filtered_tb) from None
68 finally:
69 del filtered_tb
c:\Users\HILAB_Labtop_02\anaconda3\lib\site-packages\keras\engine\training.py in tf__train_function(iterator)
13 try:
14 do_return = True
---> 15 retval_ = ag__.converted_call(ag__.ld(step_function), (ag__.ld(self), ag__.ld(iterator)), None, fscope)
16 except:
17 do_return = False
ValueError: in user code:
File "c:\Users\HILAB_Labtop_02\anaconda3\lib\site-packages\keras\engine\training.py", line 1051, in train_function *
...
Call arguments received by layer "inputAndLFEM" (type Sequential):
• inputs=tf.Tensor(shape=(None, 428), dtype=float32)
• training=True
• mask=None
<keras.engine.sequential.Sequential object at 0x000001C428FF3610>
28
<keras.engine.sequential.Sequential object at 0x000001C41BDB00A0>
4
I can’t figure it out why does it not working. Some guys talking that batch size parameter could be problem but… i didn’t use that bruh… help me plz, thanks guys.