Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conv2D 사이즈 관련 질문드립니다 #1

Open
Kcrong opened this issue Feb 7, 2018 · 0 comments
Open

Conv2D 사이즈 관련 질문드립니다 #1

Kcrong opened this issue Feb 7, 2018 · 0 comments

Comments

@Kcrong
Copy link

Kcrong commented Feb 7, 2018

z = Conv2D(1, (7, 7))(x)

리포지토리 코드와 책에 따르면 인코딩 모델의 마지막 레이어는 7x7 사이즈를 갖도록 설정되었는데요,

_________________________________________________________________
Layer (type)                 Output Shape              Param #   
=================================================================
input_12 (InputLayer)        (None, 28, 28, 1)         0         
_________________________________________________________________
cnn1 (Conv2D)                (None, 26, 26, 4)         40        
_________________________________________________________________
max_pooling1 (MaxPooling2D)  (None, 13, 13, 4)         0         
_________________________________________________________________
cnn3 (Conv2D)                (None, 11, 11, 8)         296       
_________________________________________________________________
max_pooling2 (MaxPooling2D)  (None, 6, 6, 8)           0         # <--- 이 부분
_________________________________________________________________
final_cnn (Conv2D)           (None, 1, 1, 1)           289       
=================================================================
Total params: 625
Trainable params: 625
Non-trainable params: 0
_________________________________________________________________

max_pooling2 레이어의 출력값이 6x6 인데 CNN 7x7 을 사용할 수 있나요?

위 summary() 결과를 얻기 위해 사용한 모델 코드는 아래와 같습니다.

        input_layer = Input(shape=self.input_shape)
        
        x = Conv2D(4, (3, 3), name='cnn1')(input_layer)
        x = MaxPooling2D((2, 2), padding='same', name='max_pooling1')(x)
        x = Conv2D(8, (3, 3), name='cnn3')(x)
        x = MaxPooling2D((2, 2), padding='same', name='max_pooling2')(x)
        
        output_layer = Conv2D(1, (6, 6), name='final_cnn')(x)

또한 7x7 사이즈의 CNN 을 사용했을 때, 나오는 에러는 아래와 같습니다.

ValueError: Negative dimension size caused by subtracting 7 from 6 for 'final_cnn_4/convolution' (op: 'Conv2D') with input shapes: [?,6,6,8], [7,7,8,1].
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant