When I try to run my training model the error comes what should I do to pass the error report?
Is there any problem with my model or my reshape part?
This is my reshape part
# Reshape and normalize training data
trainX = train.reshape(train.shape[0], 1, 10, 10).astype( 'float32' )
x_train = trainX / 255.0
y_train = train[:,99]
# print(y_train)
# # # Reshape and normalize test data
testX = test.reshape(test.shape[0], 1, 10, 10).astype( 'float32' )
x_test = testX / 255.0
y_test = test[:,99]
# print(y_test)
This is my model :
model = Sequential()
model.add(Conv2D(32, (3, 3), input_shape=(3, 32, 32),
activation='relu', padding='same'))
model.add(Dropout(0.2))
model.add(BatchNormalization())
model.add(Conv2D(64, (3, 3), padding='same'))
model.add(Activation('relu'))
model.add(MaxPooling2D(pool_size=(2, 2)))
model.add(Dropout(0.2))
model.add(BatchNormalization())
Then If I reshape my data like into 3*32*32 Then the value error report appears :
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-31-36bf3e556ae8> in <module>()
----> 1 trainX = train.reshape(train.shape[0], 3, 32, 32).astype( 'float32' )
2 x_train = trainX / 255.0
3 y_train = train[:,10]
4 # print(y_train)
5 # # # Reshape and normalize test data
Input shape of your Train and Test dataset differ from your model. When using input_shape() you need to keep in mind what is the size of the desired input. in you case your shape looks as (1,10,10) which is a 10x10 image with one level channel/depth (i.e. black and white image). However, the model you are using requires a (3,32,32) shape which is translated into a color images (i.e. 3 channel represents RGB colors) with 32x32 dimensions.
Thus if you change the model as followed code, it might work, but there other parameters you need to optimize as well, such as Conv2D desired feature map:
model.add(Conv2D(32, (3, 3), **input_shape=(1, 10, 10)**,activation='relu', padding='same'))