TL;DR
This paper introduces CLIPasso, a novel method for generating abstract object sketches from images. Unlike previous methods that rely on large sketch datasets, CLIPasso leverages the power of CLIP to understand image semantics and a differentiable rasterizer to optimize Bézier curves, allowing for controllable levels of abstraction without explicit sketch training data.
What Problem Does This Paper Address?
Sketching is an art form that relies heavily on abstraction – simplifying complex visual information into minimal, yet recognizable, representations. While artists achieve this through semantic understanding and prior knowledge, machines struggle with this. Existing automated sketching methods often require vast datasets of sketches at specific abstraction levels, limiting their flexibility and generalizability. This paper tackles the challenge of creating an automated system that can generate sketches with varying degrees of abstraction, mimicking an artist's ability to capture the essence of an object with fewer lines, while still maintaining its core visual identity.
Methods
CLIPasso's core innovation lies in its use of CLIP (Contrastive Language-Image Pre-training) for semantic understanding and a differentiable rasterizer for sketch generation. Instead of relying on explicit sketch datasets, CLIPasso treats a sketch as a collection of Bézier curves. The parameters of these curves are optimized directly using a CLIP-based perceptual loss. This loss function combines:
- Semantic Loss ($L_{semantic}$): Measures the cosine distance between the CLIP embeddings of the input image and the generated sketch, ensuring semantic coherence.
- Geometric Loss ($L_{geometric}$): Uses the L2 distance between intermediate CLIP activations to preserve spatial features and structure.
The level of abstraction is controlled by simply varying the number of Bézier strokes used. A key component is the saliency-guided initialization process, which uses attention maps from a vision transformer (ViT) and edge maps from XDoG to intelligently place initial strokes, improving convergence to meaningful solutions.
Datasets
The paper does not introduce new datasets. It primarily uses existing datasets for evaluation and comparison:
- SketchyCOCO: Used for quantitative evaluation of sketch recognizability.
- NPR benchmark: Used for qualitative results on portrait-style human faces.
- Images from various sources: Used for generating sketches and qualitative comparisons, including images of animals, objects, and faces.
Key Insights and Ideas
- CLIP as a Universal Sketch Interpreter: CLIP's ability to bridge the gap between images and text allows it to interpret the semantic essence of an object from an image and guide the generation of a sketch that reflects this understanding, even without explicit sketch training data.
- Abstraction via Stroke Count: The number of Bézier strokes serves as a simple yet effective knob to control the level of abstraction, allowing for a spectrum from detailed to highly minimal sketches.
- Saliency-Guided Initialization is Crucial: The non-convex nature of the optimization problem makes initialization critical. Using saliency maps derived from attention mechanisms significantly improves the quality and semantic relevance of the generated sketches compared to random initialization.
- Balancing Geometry and Semantics: The proposed loss function, combining semantic and geometric terms derived from CLIP, is key to producing sketches that are both recognizable and structurally faithful to the original image.
Key Results
- Qualitative: CLIPasso generates sketches with varying levels of abstraction that maintain recognizability and essential visual components. It can handle diverse object categories and styles.
- Quantitative: User studies showed high instance-level recognition rates (e.g., 95% at 8 strokes) and category-level recognition (e.g., 97.9% at 16 strokes). The method also achieved competitive results in sketch classification tasks using standard classifiers.
- Comparison: CLIPasso outperforms or matches existing methods in generating abstract sketches, particularly in its ability to control abstraction levels and generalize to new categories without retraining.
Limitations and Future Work
- Background Handling: Performance degrades on images with complex backgrounds. While an external masking tool can help, integrating background handling into the loss function is a potential future direction.
- Sequential Generation: Strokes are optimized simultaneously, unlike traditional sketching. Future work could explore sequential stroke generation.
- Learned Stroke Count: The number of strokes is currently a hyperparameter. Making this a learned parameter that adapts to the image could be a valuable extension.
Summary updated