Abstract
Traditional stroke-based rendering (SBR) often relies on rigid, grid-based division of images, leading to visible boundary artifacts and a lack of global compositional awareness. We present the Compositional Neural Painter, a framework that employs a "where-then-what" strategy. By dynamically predicting painting regions and utilizing a novel phasic reinforcement learning strategy alongside a WGAN discriminator, our model eliminates "seams" and captures intricate details more effectively than previous methods.
Introduction: The Grid-Based Bottleneck
Stroke-based rendering (SBR) mimics the human artistic process by reconstructing images through a sequence of brushstrokes. However, high-resolution images require thousands of strokes, making global prediction computationally prohibitive. To address this, existing state-of-the-art models typically employ a uniform-block-dividing strategy. This approach splits the canvas into a fixed grid (e.g., 4x4 or 16x16) and paints each block in isolation.
While efficient, this method introduces "boundary inconsistency artifacts"—unsightly seams where strokes from adjacent blocks fail to align or simply stop at the edge. Furthermore, it lacks the hierarchical focus of a human artist, who might prioritize a central subject before detailing the background.
Methodology: The Compositional Neural Painter
Our framework decomposes the painting process into two specialized components: the Compositor and the Painter.
1. The Compositor Network ("Where to Paint")
The Compositor Network moves beyond fixed grids by observing the current canvas and the target image to predict the optimal bounding box for the next set of strokes. It is trained using Deep Deterministic Policy Gradient (DDPG), a reinforcement learning framework.
To overcome the challenge of diminishing rewards as a painting nears completion, we introduce a Phasic RL strategy. This strategy uses a non-linear mapping to amplify small improvements in the final stages, incentivizing the model to focus on fine textures and sharp edges that would otherwise be ignored by standard linear reward functions.
2. The Painter Network ("What to Paint")
Once a region is selected, a CNN-based Painter Network predicts stroke parameters such as position, shape, color, and rotation. To prevent "mode collapse"—where the model repeatedly produces generic, "safe" strokes—we incorporate a WGAN (Wasserstein GAN) discriminator. This adversarial setup acts as a critic, forcing the painter to explore a more diverse and detailed stroke vocabulary.
3. Structural Preservation in Style Transfer
We extend this framework to artistic style transfer by introducing a differentiable distance transform (DT) loss. This loss maintains the structural integrity of the content image by calculating the distance between original edges and rendered strokes, ensuring that heavy stylization does not distort the underlying geometry of the subject.
Experimental Results
The model was evaluated on the CelebA-HQ and ImageNet datasets, comparing performance against six state-of-the-art SBR methods.
- Quantitative Performance: On ImageNet (using 1,000 strokes), our model achieved a PSNR of 22.72, significantly outperforming Paint Transformer (17.28) and Learning to Paint (21.99). In terms of perceptual similarity (LPIPS), our model scored 0.1305, leading the field.
- Qualitative Quality: Visual analysis confirms the total elimination of grid-line artifacts. The model excels at capturing sharp edges in complex subjects, such as animal fur or architectural details, which often appear as "mush" in grid-based reconstructions.
- Efficiency: Despite its two-stage architecture, the model maintains high inference speeds, averaging 0.2162 seconds per image—comparable to the much lower-quality grid-based baselines.
Conclusion and Future Directions
The Compositional Neural Painter demonstrates that dynamic region selection is superior to rigid grid division for high-quality SBR. While the current model uses a fixed number of steps, future iterations could benefit from an adaptive stroke count, allowing the model to decide when a region is "finished." Expanding the framework to support diverse media like watercolor or pencil sketches remains a promising avenue for further research.
Summary updated