0 votes
1 view
in Data Science by (17.6k points)

In keras fit function

model.fit(X_train, y_train, nb_epoch=20, batch_size=16)

How should I input the data when i have more columns?

I want to input image, and detect object of class 1 on it. So the output is (x, y, width, height)

The input image should be 416 x 416 x 3 and output matrix should be 13x13x4 so i want to detect up to 169 objects.

Should the


variable be loaded set of images ( so it will be 4 dimensional array of N x 416 x 416 x 3 )



be 2D array of N x 4 , where 4 represents ( x ,y , width, height ) ?

If so what do i have to pass in validation_data arguments?

I am really confused.

1 Answer

0 votes
by (38.2k points)

Here, the condition is that the shape of test data and training data should be same.

X must be "feedable" into the network and y must be "comparable" to the output of the network, it doesn’t matter if it is testing or training.

Also, the assumption is made you want to detect 169 objects at once per training instance.

X_train.shape == (N, 416, 416, 3)

y_train.shape == (N, 169, 4)

... then the test data


X_test.shape == (M, 416, 416, 3)

y_test.shape == (M, 169, 4)

If you wanted to learn about Python visit this Python For Data Science Course.

Welcome to Intellipaat Community. Get your technical queries answered by top developers !