-1

I am working on an images classification using Keras. There is my model:

model = Sequential()

model.add(Conv2D(filters = 8, kernel_size = (3,3),padding = 'Same', 
                 activation ='relu', input_shape = (64,64,3)))
model.add(MaxPool2D(pool_size=(2,2)))



model.add(Conv2D(filters = 16, kernel_size = (3,3),padding = 'Same', 
                 activation ='relu'))
model.add(MaxPool2D(pool_size=(2,2)))

model.add(Conv2D(filters = 32, kernel_size = (3,3),padding = 'Same', 
                 activation ='relu'))
model.add(MaxPool2D(pool_size=(2,2)))


model.add(Dropout(0.2))


model.add(Flatten())
model.add(Dense(32, activation='relu'))
model.add(Dropout(0.1))
model.add(Dense(3, activation = "sigmoid"))

I would like to avoid Flatten() since in this case we are losing some spatial information. I looked some tutorials, but all of them used Flatten(). Is it possible to use some thing like deconvolution instead?

1 Answers1

1

Flatten is fine.

The "spatial" relations of Flatten going into a Dense layer are, in a sense preserved. As all values from a particular position map to the same weight in the dense layer. So every point is mapped consistently across the dataset. The "spatial" relations mapped in the convolutional layers are looking for localized patterns, and in those layers keeping the input unaltered is important.

Cole Howard
  • 343
  • 1
  • 8