How to reuse activations of two concatenated layers into a new one
1 view (last 30 days)
Show older comments
I have two streams pre-trained networks (alexnet), I got the activations from the conv5 layer (for the two stream), then, concatenate the training feature for each stream and also the testing features as a mat file. the dimension of the output of the conv5 is 18462x43682 which will be 18462x87364.
Now I just want to feed the concatenated features into new layers ending with fully connected and classification layer.
1- should I use a new network and feed the concatenated features as an input. or using one of the old networks? 2- how to get the activations which have huge dimension after concatenation to the next layer?
Many Thanks
7 Comments
Meiyan Huang
on 5 Mar 2018
I have the same problem. Do you solve it? If so, could you please tell me? Many thanks!
Kenta
on 29 Mar 2020
This demo shows what you want to do or what is similar to that.
Accepted Answer
Bernhard Suhm
on 10 Jan 2018
1) If you have R2017b, there is support for DAG networks. You'd extract the layers from the networks using the “Layers” property. Then you would created a “LayerGraph” object using the “layerGraph” function, add the layers with the “addLayers” function, and use “connectLayers” to add any new connections.
2) To clarify, are the dimensions of 18462x87364 the output of “activations”. In 2017b and earlier, the default output of activations is NumObs-by-featureDims. This implies that 18,462 is the number of observations. So if you create a DAGNetwork like described above, you can reduce ‘MiniBatchSize’ to split those 18,462 observations into a series of batches that will be processed one by one to keep memory usage low. Let me know if that assumption wasn't correct.
Yes, looks like you are out of software maintenance (account "off" in your terms), or else tech support would have picked up your question a long time ago. If you are current on your maintenance, reach out to tech support to validate that you are eligible for support, and ask your questions that way. This forum is not watched closely - I am making an attempt to catch up, but there is no guarantee for fast turn around on MATLAB answers.
1 Comment
Meiyan Huang
on 5 Mar 2018
I followed the suggestions as you mentioned above. However, there was something wrong when I connected multi-inputs into the network (two sets of data for two streams pre-trained alexnet respectively, then concatenate the training feature for each stream). There were "Layer graphs can contain only one input layer." appeared on the Matlab. Could you please tell me how to add multi-inputs into the network? Many thanks!
More Answers (0)
See Also
Categories
Find more on Image Data Workflows in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!