본문 바로가기

컴퓨터/딥러닝

N neurons 라는 말은?

N개의 neuron이라는 말은 무슨 말일까? 

A “small” network was used to evaluate the influence of different components of the augmentation procedure on classification performance. It consists of two convolutional layers with 64 filters each followed by a fully connected layer with 128 neurons. This last layer is succeeded by a softmax layer, which serves as the network output.

위에서 128 neurons 라는 말은 무엇일까? 뉴런이라는건 레이어와 레이어 사이 노드를 말하는 것이다. 처음 헷갈렸던 것이 128개 뉴런이라는 말은 convolution layer를 모두 통과하고 난 후 flatten을 시켜서 128개의 노드가 생겼다는 것인 줄 알았는데 그게 아니다. Convolution시키고 flatten 시켜서 n개의 노드가 남으면 nn.Linear(n, 128)를 통과시킨다는 말이다.

 

왜 이렇게 처음 생각하게 되었느냐하면, 위 모델의 구조가 Conv2d, Conv2d, Linear, Softmax 순인줄 알았기 때문이다. 따라서 당연히 두번째 convolution layer를 통과하고 나서 128개의 노드가 생기면 nn.Linear(128, num_class)를 해주어 logit을 만들어주는 것이라고 생각했다. 여기서 혼동했던 부분은 이것이다.  Softmax layer란, softmax만 달랑 있는 것이 아니고 pytorch식으로 생각하면 linear + softmax인 것이다. 따라서 위 모델 구조는 사실 이렇다. Conv2d, Conv2d, Linear, Linear, Softmax이다. 마지막 Linear,Softmax를 합쳐서 softmax layer라 하는 것 같다.

'컴퓨터 > 딥러닝' 카테고리의 다른 글

Attention is all you need  (0) 2023.07.10