[Paper Review] StrokeCoder: Path-Based Image Generation from Single Examples using Transformers
StrokeCoder proposes a Transformer-based generative model that learns to create diverse, style-preserving path-based images from a single hand-drawn sketch. By augmenting one example with path transformations and training a Transformer encoder with dynamic data shuffling, it generates varied, coherent sketches while preserving key stylistic attributes, as validated by human evaluation with a mean style deviation of 2.94 out of 12 adjectives.
This paper demonstrates how a Transformer Neural Network can be used to learn a Generative Model from a single path-based example image. We further show how a data set can be generated from the example image and how the model can be used to generate a large set of deviated images, which still represent the original image's style and concept.
Motivation & Objective
- To develop a one-shot generative model for path-based images using only a single example sketch.
- To preserve the original sketch’s style and conceptual structure while generating diverse variations.
- To enable creative design support tools and digital fabrication workflows using minimal training data.
- To explore the effectiveness of Transformers for sequence generation in path-based image synthesis.
Proposed method
- Represent each sketch as a sequence of line segments, flattened into a single token sequence for input to the Transformer.
- Use a Transformer encoder with learned positional encodings to model sequential dependencies in stroke paths.
- Generate synthetic training data by applying path-altering transformations (e.g., scaling, rotation, flipping) to the original sketch.
- Implement dynamic data shuffling across training epochs to prevent overfitting to limited examples.
- Apply top-k sampling during inference with varying k-values to control diversity vs. fidelity trade-offs.
- Use word embedding-style vectorization for stroke sequences, followed by linear and softmax layers for token prediction.
Experimental results
Research questions
- RQ1Can a single-example sketch be used to train a generative model that produces diverse, style-consistent path-based images?
- RQ2How effective is a Transformer encoder without a decoder for sequence generation in this context?
- RQ3What impact do data augmentation and dynamic data shuffling have on model generalization from one example?
- RQ4How do different sampling strategies (e.g., k=1 vs. k=10) affect the diversity and quality of generated sketches?
- RQ5To what extent do generated images preserve the stylistic attributes of the original sketch?
Key findings
- The model successfully generates diverse, coherent path-based images from a single sketch using data augmentation and dynamic training shuffling.
- Top-k sampling with k=10 produced significantly more diverse images than greedy sampling (k=1), though with slightly reduced stylistic fidelity.
- Greedy sampling (k=1) led to repetitive, low-variety outputs but high alignment with the original style.
- Human evaluation showed a mean style deviation of 2.94 out of 12 adjectives, indicating strong preservation of core stylistic attributes.
- The model struggled most with replicating precise stroke positioning and spatial layout, particularly in symmetric or structured sketches like 'boxes' and 'spikes'.
- Initialization vector length equal to half the sequence length yielded optimal performance, balancing model clarity and sequence understanding.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.