lateautumntear
lateautumntear

Reputation: 440

keras dense input layer

I am mainly a caffe user, I wonder how can I input my color image in a fully connected layer and then flatten it ( I know this is not the best solution but I need it). This is a sample that is not working:

model = Sequential()
model.add(Dense(1000, input_shape=(img_channels, img_rows, img_cols)))
model.add(Activation('relu'))

Any suggestion? I think I have to set the input layer and then flatten it but I don't know how.

Thanks in advance.

Upvotes: 3

Views: 1634

Answers (1)

lateautumntear
lateautumntear

Reputation: 440

Just found the solution...

model = Sequential()
model.add(Flatten(input_shape=(img_channels, img_rows, img_cols)))
model.add(Dense(1000))
model.add(Activation('relu'))

It was obvious though. :(

Upvotes: 4

Related Questions