Mr. Fkcm95
Mr. Fkcm95

Reputation: 103

Resize Output Layer in Keras Python

my goal is to resize the output image from [32,32,1] to [8,8,1]

I try this with reshape but became a error:

Output_model = Reshape((8,8,-1))(out_1)
Error when checking target: expected reshape_1 to have shape (8, 8, 32) but got array with shape (32, 32, 1)

How can I solve this problem??

Thanks a lot

Upvotes: 0

Views: 245

Answers (1)

Tolik
Tolik

Reputation: 435

you cannot reshape the array directly because 32*32*1 not equal to 8*8*1, therefore you have to subsample:

import keras
x=keras.layers.Input((32,32,1))
x=keras.layers.MaxPooling2D((4,4))(x)

then your image will downsample to (8,8,1).

Upvotes: 1

Related Questions