yu4u / age-gender-estimation

Keras implementation of a CNN network for age and gender estimation
MIT License
1.47k stars 503 forks source link

average_pooling #74

Open LogicHuu opened 5 years ago

LogicHuu commented 5 years ago

hi, yu: I want to ask the question about pool = AveragePooling2D(pool_size=(8, 8), strides=(1, 1), padding="same")(relu) The origin paper about w-resnet, the average pooling input size is 8X8, and pool_size(8, 8), the output is 1

and now is padding="same", the output is (None, 16, 16, 512). And I do not understand the reason. 16_50_16__12_12_2018

I hope you reply, thank you.

LogicHuu commented 5 years ago

wide resnet fig 1 1

yu4u commented 5 years ago

It depends on the input size. If the input image size is 64x64, the above result is normal. (Regarding the current implementation, ave-pool 8x8 should be replaced by global average pooling in order to reduce the dimensionality of the following flatten and fc layers...)

LogicHuu commented 5 years ago

Yes, I agree with you. GAP is perfect. I mean that I do not understand why you do like this (using padding="same"). That do not reduce the dim. You know the input of avg-pool is NoneX16x16x512, the output of avg-pool is also NoneX16X16X512.

yu4u commented 5 years ago

Omg, I got what you meant! The problem is strides=(1, 1) not padding="same". I'll fix this issue.

AveragePooling2D(pool_size=(8, 8), strides=(1, 1), padding="same")(relu)

should be

AveragePooling2D(pool_size=(8, 8))(relu)  # or 16

or

GlobalAveragePooling2D()(relu)
LogicHuu commented 5 years ago

GlobalAveragePooling is better. I have try.