TL;DR
Compositional Neural Painter is a novel stroke-based rendering framework that eliminates boundary artifacts by dynamically predicting the next painting region instead of using a rigid grid. By combining a reinforcement learning-driven compositor network with a WGAN-stabilized painter network, it achieves state-of-the-art image reconstruction and structure-preserving style transfer.
What Problem Does This Paper Address?
Stroke-based rendering (SBR) mimics human artists by generating images stroke-by-stroke rather than pixel-by-pixel. However, complex real-world images require too many strokes for standard neural networks to predict all at once. To scale up, existing methods uniformly partition the image into a static $k \times k$ grid and paint each block independently.
This "blindness" to adjacent blocks creates ugly boundary inconsistency artifacts, such as missing or discontinuous strokes at the edges of the grid blocks. Semantic-guided methods try to avoid grids by focusing on foreground objects, but they rely heavily on pre-trained object detection models and fail on complex scenes like landscapes that lack clear foregrounds.
Methods
The authors introduce the Compositional Neural Painter, which splits the problem into two distinct questions across $T$ sequential steps: "where to paint" and "what to paint".
- Compositor Network ("Where to paint"): This network takes the target image and the current canvas and dynamically selects a rectangular bounding box $(x, y, w, h)$ to paint next. Because cropping an image based on coordinates requires non-differentiable rounding operations, standard backpropagation cannot be used. Instead, the authors train the compositor using a Reinforcement Learning (RL) framework (DDPG) paired with a novel phasic reward function. This reward function non-linearly amplifies small improvements in the later stages of painting, forcing the model to focus on fine-grained details.
- Painter Network ("What to paint"): Once a region is selected, a CNN-based painter network predicts the specific parameters (position, size, rotation, color) for $N$ strokes within that crop. To prevent the network from repeatedly painting the same generic, coarse strokes, it is trained alongside a WGAN-GP discriminator that penalizes repetitive generation.
- Stroke Renderer: A differentiable neural network maps the predicted stroke parameters into actual pixel masks and images to update the canvas.
For style transfer tasks, the authors extend this framework by introducing a differentiable distance transform (DT) loss. This loss aligns the edge maps of the rendered strokes with the original image structure, preventing the blurred boundaries common in previous SBR style transfer methods.
Datasets
The model was trained and evaluated on two widely used image datasets:
- CelebA-HQ: A high-quality dataset of human faces, useful for evaluating fine facial details.
- ImageNet: A massive dataset containing diverse real-world objects and complex scenes, testing the model's robustness against varied textures and compositions.
For both datasets, 1,000 images were randomly selected for testing, while the remainder were used for training.
Key Insights and Ideas
- Dynamic over Static Windows: Moving away from fixed grids to an agent-driven dynamic window completely resolves boundary artifacts while allowing a natural global-to-local (coarse-to-fine) painting flow.
- The Phasic Reward Trick: Standard $L_2$ pixel rewards stall out when the canvas looks "close enough" to the target. Amplifying the reward non-linearly past a specific threshold ($d \le 0.005$) gives the RL agent the necessary incentive to correct tiny errors.
- WGAN as an Anti-Repetition Mechanism: Without a discriminator, pixel-loss optimization causes the painter to play it safe, spamming identical coarse strokes. The WGAN forces the painter to explore diverse stroke types to fool the discriminator.
Key Results
- Quantitative Superiority: On the ImageNet dataset with 1,000 strokes, the proposed model achieved an $L_2$ distance of 0.0068 and a PSNR of 22.72, significantly outperforming Paint Transformer (0.0221 / 17.28) and Stylized Neural Painting (0.0079 / 21.90).
- High Efficiency: The inference time for 1,000 strokes is just 0.2162 seconds on a single RTX 3090 GPU. This makes it nearly as fast as the fastest feed-forward models while delivering much higher reconstruction quality.
- Structure-Preserving Style Transfer: Quantitative evaluation of style transfer via Gram matrix distance showed a massive improvement (0.6943 for this model vs. 1.4048 for Stylized Neural Painting), preserving crisp structural boundaries.
Limitations and Future Work
Not discussed in the paper.
Summary updated