How to create a hierarchy in PyTorch?

vainaijr: <p>something like<br>
------abcd------<br>
—ab…  …cd–<br>
a-----b…c----d</p>
<p>where a, b, c, d… are patterns learnt by a neural network.<br>
ab, cd is combination of the patterns learnt at the lower hierarchy and so on.</p>
<p>if a has learnt patterns for lips, b for nose, c for eyes, d for tongue, then abcd would be face.</p>

ptrblck: <p>This looks like the idea behind the hierarchical features learned in CNNs as described in <a href="http://www.cs.utoronto.ca/~rgrosse/cacm2011-cdbn.pdf" rel="nofollow noopener">Unsupervised Learning of Hierarchical Representations with Convolutional Deep  Belief Networks</a>.<br>
The figures from this paper are quite popular in presentation slides and blog posts (<a href="https://www.google.com/search?client=ubuntu&amp;hs=GjL&amp;channel=fs&amp;biw=1853&amp;bih=951&amp;tbm=isch&amp;sa=1&amp;ei=-_NXXYfxOa-LmwWq9bSgDw&amp;q=deep+learning+feature+hierarchy+ng+face&amp;oq=deep+learning+feature+hierarchy+ng+face&amp;gs_l=img.3...0.0..243977...0.0..0.0.0.......0......gws-wiz-img.NmJIpLMkR8k&amp;ved=0ahUKEwjH2pz19InkAhWvxaYKHao6DfQQ4dUDCAY&amp;uact=5" rel="nofollow noopener">Google search</a>).</p>

vainaijr: <p>I think it is a bit different,</p>
<p>What I am saying, is a whole neural network at the bottom, which only knows how to predict lips, similarly whole neural network for tongue.</p>
<p>And then these combine together to form next hierarchy.</p>
<p>But what is combining two neural networks in PyTorch, so if one of them is able to predict lips, other nose, then combination would be able to predict (nose + lips)?</p>

ptrblck: <p>I’m not sure, what your work flow would be and how you would like to force the submodels to predict only a part of the face.<br>
Would you want to use different label sets, i.e. one model would only get nose - not nose labels, while the others would get the mouth pairs etc.?<br>
Do you have a dataset, where only parts of faces would be visible?<br>
If the complete face is always visible, you wouldn’t be able to only force on a particular part.<br>
Or would you only use cropped patches of the face image?<br>
In that case, I’m not sure, how your validation/test set would look like.</p>

vainaijr: <p>This is related to one shot meta learning, so I have sample and query in meta train set, and sample and query in meta test set, the task is to make neural network classify by showing only one image, that is, show it one image in the sample of meta test set, and it would give correct classification for query in meta test set, for this we show images to neural network in sample of meta train set, and ask it to predict correctly in the query of meta train set, if it gives incorrect prediction, then loss increases, task is to minimize loss, once we have a neural network that gives low loss in meta train set, then it would give correct result by showing only one image in sample of meta test set and make correct prediction for query of meta test set. What I think is that we want our neural network to learn a whole hierarchy during meta training stage, that is, face, lips, tongue, eyes…, and after meta training we have a neural network that has learnt hierarchy, so in meta test set, it would adapt quickly to the sample, and be able to predict query of meta test set correctly.</p>