How do I determine the output size of a fullyConnectedLayer?
조회 수: 20 (최근 30일)
이전 댓글 표시
Hello! I was working on turing this Siamese Network example into a 1D network to compare signals. I am trying to reduce how many convultional layers this network is using as my signals are very short. I was wondering how the number 4096 was determined for the output of the fullyConnectedLayer?
I am a beginner so a simplified explanation would be very helpful.
Thank you!
댓글 수: 0
답변 (1개)
Raunak Gupta
2020년 8월 7일
Hi,
You can use analyzeNetwork for inspecting what is the input and output size from each layer. This can help you determine valid inputs to the layer. Let’s assume you define a network as mentioned here you may use
analyzeNetwork(lgraph)
which will open the Deep Learning Network Analyzer and in that the activations column show the output size from a layer. Here since the output just before fullyConnectedLayer is having a size of 5x5x256 and we want the representation in 4096-dimensional feature vector hence the output size of fullyConnectedLayer is 4096.
If you remove some layers from the network, it will still work but will have less weight compared to previous model and may not be able to provide as accurate results as the previous one.
댓글 수: 2
Raunak Gupta
2020년 8월 13일
Hi Daniel,
We can take output based on the number of features we want at the end. So in this case the output feature vector required is having size 4096 that is why it is used. Be sure that the second last layer output will be multiplied with weight matrix of size 6400x4096 to get appropriate result (a feature vector of size 4096). Also if the last fully connected layer had let's say 1024 nodes then the layer would have been giving 1024 size vector as output and in that case the above mentioned matrix would have a size of 6400x1024.
Hope this clarifies your doubt!
참고 항목
카테고리
Help Center 및 File Exchange에서 Image Data Workflows에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!