Esempio n. 1
0
# Reshape the input data
rows, cols, channels = Preprocessing.GetInputShape(input_data)
reshaped_input_data = Preprocessing.ReshapeInputData3D(input_data,
                                                       image_data_format, rows,
                                                       cols * channels, 1)

# Split the datadset into the training set and testing set
(x_train, y_train), (x_test,
                     y_test) = Preprocessing.SplitDataset(reshaped_input_data,
                                                          target_data,
                                                          proportion=0.8,
                                                          shuffle=False)

# Get the input shape of input data and the output shape of target data
input_shape = Preprocessing.GetInputShape(x_train)
target_shape = Preprocessing.GetTargetShape(y_train)

# Build the model
model = Sequential()

model.add(
    Conv2D(filters=16,
           kernel_size=(2, 2),
           data_format=image_data_format,
           activation='relu',
           input_shape=input_shape))

model.add(
    Conv2D(filters=16,
           kernel_size=(2, 2),
           data_format=image_data_format,