I am working with some data to make a trainable model suing Neural Network. This is the code I am working on:
import os, time, random
import numpy as np
import pandas as pd
from google.colab import files
df = pd.read_csv('/content/drive/MyDrive/Deep Learning Final Project/ObjectDetection/train_solution_bounding_boxes (1).csv')
df.rename(columns={'image':'image_id'}, inplace=True)
df.head(13)
X = df.iloc[:,:2].values
y = df.iloc[:,3:10].values
print(X.shape, y.shape)
from sklearn.preprocessing import StandardScaler
model = StandardScaler()
X = model.fit_transform(X)
from sklearn.preprocessing import OneHotEncoder
ohe = OneHotEncoder()
y = ohe.fit_transform(y).toarray()
y
from sklearn.model_selection import train_test_split
X_train,X_test,y_train,y_test = train_test_split(X,y,test_size = 0.1)
# Building nural network model
import keras
from keras.models import Sequential
from keras.layers import Dense
model = Sequential()
model.add(Dense(1, input_dim=4, activation='relu'))
model.add(Dense(1, activation='relu'))
model.add(Dense(4, activation='softmax'))
model.compile(loss='categorical_crossentropy', optimizer='adam', metrics=['accuracy'])
# Here below I have a problem with running this section
history = model.fit(X_train, y_train, epochs=100, batch_size=64)
It gives me this error
ValueError: Input 0 of layer "sequential_5" is incompatible with the layer: expected shape=(None, 4), found shape=(None, 2)
Please any one can help we solving this problem.