Search code examples
deep-learningresnet

How fully connected layer after global average pooling works in Resnet50?


I have resnet50 network with the top layers that include global average pooling with shape (1, 2048) and dense layer using softmax with shape (1, 3). How output shape of (1,2048) in global average pooling layer becomes (1, 3) for the output of dense layer? How does it work? I can't find a reliable source for explain this


Solution

  • Dense or Fully connected layers are just matrix multiplication (with bias). So what you do is multiply a matrix with shape 1x2048 with another matrix of shape 2048x3 to get a output matrix of shape 1x3 which gives you scores for your 3 classes. Softmax converts these scores to probability. Of course your network learns the weights of these matrices using back-propagation.