<p>Hidden variables z are used in VAEs as the extracted features for dimensionality reduction. Here is an example dimensionality reduction from four features in the original space (<code>[x1,x2,x3,x4]</code>) to two features in the reduced space (<code>[z1,z2]</code>) (<a href="https://arxiv.org/pdf/2002.10464.pdf" rel="nofollow noreferrer">source</a>):</p>
<p><a href="https://i.stack.imgur.com/AWNEc.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/AWNEc.png" alt="enter image description here" /></a></p>
<p>Once you have trained the model, you can pass a sample to the encoder it extracts the features. You may find a Keras implementation example on mnist data <a href="https://keras.io/examples/generative/vae/" rel="nofollow noreferrer">here</a> (see the <code>plot_label_clusters</code> function):
<a href="https://i.stack.imgur.com/MZg4l.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/MZg4l.png" alt="enter image description here" /></a></p>
How to use Variational Autoencoder as a Feature Extractor?
<p>I want to use my VAE trained on an image dataset as a feature extractor for another task, so that I could for example replace a ResNet for feature extraction with my VAE.
Which Layers do I use for this?</p>
<p>With &quot;standard&quot; autoencoders you just take the encoding network, but since the latent layer of the VAE consist of mean and distribution I do not know which layers I should use for feature extraction.</p>
<p>Does somebody know how to use a VAE as a feature extractor and what to consider with using different components?</p>