Abstract: Sketch drawings capture the salient information of visual concepts. Previous work has shown that neural networks are capable of producing sketches of natural objects drawn from a small number of classes. While earlier approaches focus on generation quality or retrieval, we explore properties of image representations learned by training a model to produce sketches of images. We show that this generative, class-agnostic model produces informative embeddings of images from novel examples, classes, and even novel datasets in a few-shot setting. Additionally, we find that these learned representations exhibit interesting structure and compositionality.
Introduction
Traditional unsupervised representation learning often relies on pixel-based reconstruction, such as Variational Autoencoders (VAEs) or Generative Adversarial Networks (GANs). While these models can produce visually appealing reconstructions, they often lack "component-level awareness"—the understanding that an object is composed of distinct parts in a specific spatial arrangement. For instance, a GAN might generate a face with three eyes because it captures local textures without grasping global structure.
SketchEmbedNet addresses this by treating sketches as a "salient bottleneck." When humans draw, they distill complex visual information into a sequence of simple pen strokes. This paper investigates whether forcing a model to learn "how to sketch"—translating pixels into motor commands—results in robust, shape-biased representations that generalize to novel object categories.
Methods
SketchEmbedNet employs a class-agnostic encoder-decoder architecture designed to map images to sequential drawing actions.
- The Encoder: A CNN (either a simple 4-layer ConvNet or a ResNet-12) compresses a pixel image into a latent vector termed the SketchEmbedding ($z$).
- The Decoder: An autoregressive RNN (HyperLSTM) interprets this embedding as a "motor program," predicting a sequence of pen movements $(\Delta x, \Delta y)$ and pen states (on paper, lifted, or end of sequence).
- Pixel Loss and Differentiable Rasterization: Unlike standard sketch models that only match point sequences, SketchEmbedNet uses a differentiable rasterization function. This allows the model to compare the visual output of its predicted strokes against a target sketch using pixel-wise binary cross-entropy loss.
- Curriculum Learning: Training begins by following specific stroke sequences and gradually shifts focus toward the final visual appearance (pixel loss), encouraging the model to find efficient shape representations.
Experimental Setup
The model was evaluated on several benchmarks to test its generalization and representation quality.
- Quickdraw: 345 classes of human-produced simplified drawings.
- Sketchy: Pairs of natural, photorealistic images with loosely aligned human sketches.
- Downstream Tasks: Omniglot and mini-ImageNet were used to evaluate few-shot classification performance on unseen categories.
Key Insights and Results
The "SketchEmbedding" demonstrates several powerful properties:
- Shape Bias over Texture: By focusing on strokes, the model ignores distracting textures and lighting, prioritizing the "skeleton" of a concept. This leads to high robustness against domain shifts.
- Conceptual Compositionality: The latent space supports vector arithmetic. For example, subtracting the embedding of a "circle" from a "snowman" and adding a "square" results in a decoded sketch of a stack of boxes, indicating an understanding of components and their arrangements.
- Few-Shot Performance: On the Omniglot benchmark (20-way, 1-shot), SketchEmbedNet achieved 91.67% accuracy, vastly outperforming other unsupervised methods like CACTUs (48.09%) and rivaling supervised models like MAML.
- Natural Image Scaling: When trained on Sketchy and tested on mini-ImageNet, the model achieved 40.39% on 5-way 1-shot tasks, surpassing standard VAEs and contrastive baselines.
Conclusion
SketchEmbedNet demonstrates that learning to generate sketches provides a superior inductive bias for understanding object structure compared to raw pixel reconstruction. While the sequential generation process is computationally slower and requires careful loss balancing, the resulting embeddings are highly generalizable and compositionally rich. Future work may extend this "learning by drawing" paradigm to robotic manipulation and 3D scene understanding.
Summary updated