Learning Geometry-aware Representations by Sketching

Hyundo Lee, Inwoo Hwang, Hyunsung Go, Won-Seok Choi, Kibeom Kim, Byoung-Tak Zhang

TL;DR

Learning by Sketching (LBS) is a novel framework that represents images as a set of parametric strokes (sketches) to capture essential geometric information like shape, position, and orientation. Unlike previous methods, LBS performs this in a single inference step without requiring a dedicated sketch dataset, producing a compact, explainable, and mathematically equivariant representation that excels in downstream tasks across diverse domains.

What Problem Does This Paper Address?

Standard computer vision models typically represent images as dense grids of pixels or high-dimensional feature maps. While powerful, these representations often struggle to disentangle core geometric properties (like the "roundness" of a ball or the "parallelism" of lines) from "nuisance" features like texture, lighting, or complex backgrounds.

Humans, by contrast, are experts at abstraction. When we sketch a scene, we naturally discard the noise and preserve the geometry. Existing AI methods for sketch generation are either slow (requiring thousands of optimization steps per image) or require massive datasets of human-drawn sketches. This paper seeks to bridge that gap: How can we learn a compact, geometry-aware representation that mimics human sketching without needing a sketch dataset or a slow optimization process?

Methods

The authors introduce Learning by Sketching (LBS), which treats sketching as a form of representation learning.

  1. Architecture: The model uses a CNN encoder (ResNet18) to extract image features, which are then fed into a Transformer decoder. This decoder predicts the parameters for a set of $n$ strokes.
  2. Parametric Strokes: Each stroke is defined as a cubic Bézier curve (four control points) with specific color and thickness parameters. This turns the image into a mathematical vector of coordinates rather than a grid of pixels.
  3. Differentiable Rasterizer: To train the model, these strokes are converted back into a 2D image using a differentiable rasterizer. This allows the model to compare the generated sketch to the original image and backpropagate the errors.
  4. CLIP-based Perceptual Loss: Instead of a pixel-to-pixel comparison (which would force the model to recreate every detail), the authors use a loss function based on CLIP. This ensures the sketch is semantically and geometrically similar to the original image at a high level of abstraction.
  5. Progressive Optimization: During training, the model is guided by "guidance strokes" generated through a slow, optimization-based process (similar to CLIPasso). However, once trained, the LBS model can generate a sketch in a single forward pass (inference step).

A key theoretical contribution is the proof that this stroke-based representation is equivariant to affine transformations. This means if you rotate or scale the input image, the representation (the stroke coordinates) changes in a mathematically predictable, linear way.

Datasets

The authors evaluated LBS across a wide variety of benchmarks to test different aspects of geometric understanding:

  • rotMNIST: MNIST digits rotated at various angles to test equivariance and generalization.
  • Geoclidean: A synthetic dataset of Euclidean geometry concepts (e.g., parallel lines, triangles, bisectors) used to test high-level concept learning.
  • CLEVR: A 3D rendered dataset of simple geometric objects (cubes, spheres) used for attribute classification (color, shape, size, position).
  • STL-10: Real-world images (airplanes, birds, cars) used to test the model's performance on natural data and domain transfer.
  • QMUL-ShoeV2: A dataset for Fine-Grained Sketch-Based Image Retrieval (FG-SBIR).

Key Insights and Ideas

  • Sketching as a Bottleneck: By forcing the model to represent a complex scene with only a few dozen strokes, the model is effectively forced to learn a "geometric bottleneck." It must decide which lines are essential to define the objects.
  • Equivariance by Design: Because the representation consists of coordinates in a 2D space, spatial transformations (like rotation) are naturally preserved. This makes the representation much more robust than standard CNN features for tasks involving spatial reasoning.
  • Zero Sketch Data: The model learns to "sketch" purely by trying to satisfy the CLIP perceptual loss. It discovers the concept of a "line drawing" as the most efficient way to preserve semantic meaning under a stroke constraint.
  • Explainability: Unlike "black box" latent vectors, the LBS representation is a literal sketch. A human can look at the representation and see exactly what the model thinks is important in the scene.

Key Results

  • Attribute Classification: On the CLEVR dataset, LBS significantly outperformed baselines like SimCLR and $\beta$-TCVAE in classifying object attributes, particularly in unlabeled settings. For example, in size classification, LBS achieved 92.66% accuracy compared to SimCLR's 83.35%.
  • Geometric Concepts: On the Geoclidean dataset, LBS showed a superior ability to learn abstract concepts like "parallelism" or "bisectors" with very few training examples (only 10 per class).
  • Domain Transfer: A model trained on real-world STL-10 images could successfully describe synthetic CLEVR scenes, achieving high accuracy in shape and color classification. This suggests that the "language of strokes" is universal across domains.
  • Efficiency: LBS provides the quality of optimization-based sketching methods (which take ~2 minutes per image) but at the speed of a single neural network inference step.

Limitations and Future Work

  • Dependency on Pre-trained Models: The training process relies on a pre-trained CLIP model and, for some datasets, a U2-Net for background removal. The quality of the representation is somewhat capped by these external models.
  • Training Overhead: While inference is fast, the training phase requires generating "guidance strokes" via a time-consuming optimization process, which limits how quickly the model can be trained on massive new datasets.
  • Scene Complexity: The current work focuses on scenes with a limited number of objects. Representing highly cluttered, complex real-world scenes (like a busy street) with a small number of strokes remains a challenge.
  • Future Directions: The authors suggest scaling the method to more complex, realistic tasks and exploring how these geometry-aware features can improve robotic manipulation and 3D scene understanding.

Summary updated

BibTeX
@misc{lee2023learning,
  author = {Hyundo Lee and Inwoo Hwang and Hyunsung Go and Won-Seok Choi and Kibeom Kim and Byoung-Tak Zhang},
  title = {{Learning Geometry-aware Representations by Sketching}},
  year = {2023},
  eprint = {2304.08204},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2304.08204},
}
Figure