I have a problem about fixing reshape process of train and test in **CNN** via Python.

While train set has `(270, 660, 3)` , test set has `(163, 600, 3)`. Because of this, these are not the same shape.

How can I fix it?

Here is my block shown below.

**Here is CNN**

```
classifier = Sequential()
classifier.add(Convolution2D(filters = 32, 
                             kernel_size=(3,3), 
                             data_format= "channels_last", 
                             input_shape=(270, 660, 3), 
                             activation="relu")
              )

classifier.add(MaxPooling2D(pool_size = (2,2)))

classifier.add(Convolution2D(32, (3, 3), activation = 'relu'))
classifier.add(MaxPooling2D(pool_size = (2, 2)))

classifier.add(Convolution2D(32, (3, 3), activation = 'relu'))
classifier.add(MaxPooling2D(pool_size = (2, 2)))

classifier.add(Flatten())

classifier.add(Dense(units = 128, activation = 'relu'))
classifier.add(Dense(units = 1, activation = 'sigmoid'))

classifier.compile(optimizer = 'adam', loss = 'binary_crossentropy', metrics = ['accuracy'])

```

**Fitting the CNN to the images**

```
train_datagen = ImageDataGenerator(
        rescale=1./255,
        shear_range=0.2,
        zoom_range=0.2,
        horizontal_flip=True)
test_datagen = ImageDataGenerator(rescale=1./255)

```

**Create Training Test and Training Test**

```
training_set = train_datagen.flow_from_directory(train_path, 
                                                 target_size=(270, 660), 
                                                 batch_size=32, 
                                                 class_mode='binary')

test_set = test_datagen.flow_from_directory(
        test_path,
        target_size=(270, 660),
        batch_size=32,
        class_mode='binary')

```

**Fit the CNN to the training set and then evaluate our test set**

```
classifier.fit_generator(
        training_set,
        steps_per_epoch=50,
        epochs=30,
        validation_data=test_set,
        validation_steps=200)

```

**Prediction**

```
directory = os.listdir(test_genuine_path)
print(directory[3])

print("Path : ", test_genuine_path + "/" + directory[3])

imgFGenuine = cv2.imread(test_genuine_path + "/" + directory[3])
plt.imshow(imgFGenuine)

pred = classifier.predict(np.expand_dims(imgFGenuine,0)) # ERROR
print("Probability of Genuine Signature : ", "%.2f" % (1 - pred))

```

The error :

```
ValueError: Error when checking input: expected conv2d_19_input to have 4 dimensions, but got array with shape (163, 660, 3)

```