I’m trying to concatenate 4 models with 2 different input lengths and i get the
ValueError:Data cardinality is ambiguous: x sizes: 9000, 9000, 1926, 1926 y sizes: 9000, 9000, 1926, 1926 Make sure all array contain the same number of samples.
I wanted the first two models to capture shorter temporal dependencies and the other two to focus on longer. But I don’t seem to be able to merge these models because model.fit requires all array to have the same number of samples (?).
X_land, y_final = create_sequences(X_landmarks, y_first, 6, 3)
X_degree, y_final = create_sequences(X_degree, y_first, 6, 3)
X_land_lstm, y_final_lstm = create_sequences(X_landmarks, y_first, 42, 14)
X_degree_lstm, y_final_lstm = create_sequences(X_degree, y_first, 42, 14)
create_sequences looks like this:
def create_sequences(data, labels, seq_length, step):
X, y = [], []
for start in range(0, len(data) - seq_length + 1, step):
end = start + seq_length
X.append(data[start:end])
y.append(labels[end-1])
return np.array(X), np.array(Y)
merged_model.fit([X_landmarks_train, X_degree_train, X_land_lstm_train, X_degree_lstm_train], [y_train, y_train, y_lstm_train, y_lstm_train] ...)
Models can operate seperately, so the input arrays were correctly arranged if concatenating is out of question. Also, I believe I correctly arranged the model output dimensions so they match, but i think i cannot fit the initial data to begin with.
yimithan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.