Autoencoders as a Path to Unsupervised Face Clustering

Back to neural networks, this time with the Google QuickDraw face sketches. The immediate goal isn't to generate new faces, but to cluster the existing ones without supervision. The plan is straightforward: get the model to sort faces into groups, find a cluster whose style appeals, and then possibly train a separate model on just that preferred subset.

Why Not Just Use k-Means?

Standard clustering algorithms like k-means operate on fixed-length vectors. The face drawings are not single vectors at all—they are sequences of vectors (stroke data). That makes traditional k-means unsuitable.

A quick search for "rnn unsupervised clustering" points toward autoencoders as a solution. The high-level idea is to set up two cooperating recurrent networks:

  1. An encoder RNN that reduces the input to a low-dimensional vector (say, 4 dimensions).
  2. A decoder RNN that reconstructs the input from that compressed representation.

Both are trained together with an objective that drives

loss = F.cross_entropy(decoder(encoder(input)), input)

so that the reconstructed output closely matches the original input. The PyTorch wiki has a relevant sequence-to-sequence translation tutorial that demonstrates this encoder/decoder architecture, albeit for French-to-English translation rather than clustering.

Open Questions on the Architecture

Despite the broad strokes being clear, several details are still murky. These are the sticking points that need resolving:

  • Embedding necessity: The translation task uses nn.Embedding because its inputs are integer token IDs. The face strokes are already numeric vectors, not discrete labels, so an embedding layer may not be needed—but that isn't fully confirmed.
  • What counts as the encoding? The Encoder in the tutorial returns both an output and a hidden vector. It's not yet clear which of these (or both) should be treated as the meaningful, compressed representation of the input.
  • Compression width: Should the hidden state be wide (like 50 dimensions) or kept narrow to match the target number of face clusters (like 5)? The former works well for translation, but the latter might be more intuitive for direct clustering.
  • Activation functions: The examples being studied use a relu activation inside their networks. The precise role of relu in this context is still unclear.

Plan: Simplify the Problem First

Attempting an unfamiliar architecture on a complex dataset is proving both confusing and discouraging. A better next step is to build a toy autoencoder and run it on small, synthetic data. That should clarify how the pieces fit together before returning to the face sketches.