<p>In face recognition, the standard way to handle millions of classes is by using an <strong>embedding</strong>. The CNN produces an embedding of size between 64 and 1024.</p>

<p>In this embedding space, each class of images should form a cluster of images, and clusters of different classes should be far apart.</p>

<hr>

<p>The approach of Facebook is described in their <a href="https://research.facebook.com/publications/deepface-closing-the-gap-to-human-level-performance-in-face-verification/" rel="noreferrer">DeepFace paper</a> (June 2014), but I would recommend a more recent approach from Google using <strong>triplet loss</strong>: <a href="http://arxiv.org/abs/1503.03832" rel="noreferrer">FaceNet: A Unified Embedding for Face Recognition and Clustering</a>.</p>

<p><a href="https://i.stack.imgur.com/FM7LG.png" rel="noreferrer"><img src="https://i.stack.imgur.com/FM7LG.png" alt="triplet loss"></a></p>
one hot encoding for huge number of tags
<p>I am puzzled with a question and would like your opinions. I am working on a convolution Neural network in tensorflow. Now I have images with tags. There are around 10000 unique tags and I would like images to be automatically tagged.
Now I use one hot encoding for labels. For 10000 unique tags it will be like feature erruption. Howcan we deal with such situations?</p>

<p>How do facebook do it in face tagging? There are millions of faces. I guess they do not do one hot encoding for face tag right?</p>