I'm trying to train a keras model with 2 inputs: an image part that's a tf.data.Dataset
and a nor mal part represented by a pd.DataFrame
from tensorflow.keras.optimizers import Adam
opt = Adam(learning_rate=1e-3, decay=1e-3 / 200)
model.compile(loss="mean_absolute_percentage_error", optimizer=opt)
model.fit(
x=[df.loc[:, df.columns != 'target'], ds.batch(8)], y=df["target"],
epochs=200)
I was trying to fit the model but I get ValueError
ValueError: Unrecognized data type: x=[...][401059 rows x 52 columns]
, <_BatchDataset element_spec=(TensorSpec(shape=(None, 32, 256, 256, 3),
dtype=tf.float32, name=None),
TensorSpec(shape=(None, 32, 256, 256, 3), dtype=tf.float32, name=None))>] (of type <class 'list'>)
the problem was an error in tensoflow zipping and reformating dataset helped
def post_zip_process(example1, example2):
reshaped_input = tf.transpose(example1[0], [0, 1, 2 ,-1])
reshaped_input = reshaped_input[0, :, :, :]
print(reshaped_input.shape)
return (reshaped_input, example2[0]), example1[1]