Painterly Image Harmonization by Learning from Painterly Objects

Li Niu, Junyan Cao, Yan Hong, Liqing Zhang

Introduction

Painterly image harmonization is the task of seamlessly blending a photographic object into an artistic painting. This process is significantly more complex than standard image composition because it requires matching not just colors, but also the intricate textures, brushstrokes, and patterns characteristic of a specific artist's style. When a photo is simply pasted into a painting, the result is often jarring and visually inconsistent.

The Problem: Global Style vs. Local Nuance

Existing feed-forward solutions for this problem often rely on global style transfer, which calculates the average style statistics of a background painting and applies them to the inserted object. However, this approach frequently fails because paintings are rarely uniform.

Style locality in paintings: different regions (red vs. blue) exhibit distinct style statistics, demonstrating why global style transfer often fails to produce natural results.

As shown in the figure above, a single canvas can contain vastly different textures—for instance, thick impasto strokes on a house versus smooth gradients in the sky. Applying a global average "smears" these distinct styles, leading to unnatural compositions. Furthermore, the field lacks "ground truth" data, as there is no objective reference for how a specific photograph should look when rendered in a particular painterly style.

Proposed Method: ArtoPIH

The authors introduce ArtoPIH (Artistic Object Painterly Image Harmonization), a framework designed to "hallucinate" object-aware styles rather than simply migrating global statistics.

Core Architecture

The model is built on a U-Net structure utilizing a VGG-19 encoder. The key innovation is the ObAdaIN (Object-aware AdaIN) module, which is integrated into the network's bottleneck and skip connections.

The ArtoPIH architecture: features from a VGG encoder are processed through a projection module and ObAdaIN layers to hallucinate contextually appropriate styles before decoding.

Key Components

  1. Style Hallucination: Instead of copying background statistics, the model learns a mapping. By considering both the background style and the semantic features of the object (e.g., recognizing it as a "boat"), the model predicts what the style of that specific object should be in that specific context.
  2. Domain-Invariant Features: To bridge the gap between photographic and painterly domains, a projection module extracts features that remain consistent across both. This ensures the model maintains the structural integrity of the object (like the geometry of a face) regardless of the artistic medium.
  3. Learning from "Real" Art: By training on actual objects painted by humans, the model learns to apply textures that look like brushstrokes rather than generic filters, preserving essential object structures that traditional methods often distort.

The Arto Dataset

To overcome the lack of ground truth, the researchers created the Arto (Artistic Object) dataset. They used object detection to identify over 33,000 painterly objects within 57,025 paintings from WikiArt. By retrieving similar photographic objects from the COCO dataset and placing them over the original painterly objects, they created training pairs where the original human-painted object serves as the target "ground truth."

Results and Performance

ArtoPIH demonstrates significant improvements in both qualitative and quantitative measures:

  • User Preference: In a large-scale study involving 550,000 pairwise comparisons, ArtoPIH achieved a Bradley-Terry (B-T) score of 0.953, nearly doubling the performance of the next best competitor, PHDNet (0.485).
  • Efficiency: The model is highly optimized for real-time use, with an inference time of approximately 0.025 seconds per image on an RTX 3090.
  • Visual Quality: The method excels at maintaining structural integrity while applying contextually appropriate textures, avoiding the "melting" effect common in generic style transfer.

Conclusion

By shifting the focus from global style migration to local style hallucination, ArtoPIH provides a more sophisticated and artistically faithful solution for image harmonization. While future work may explore even more complex occlusions and diverse artistic categories, ArtoPIH represents a major step forward in creating seamless, structurally sound artistic compositions.

Summary updated

BibTeX
@inproceedings{niu2024painterly,
  author = {Li Niu and Junyan Cao and Yan Hong and Liqing Zhang},
  title = {{Painterly Image Harmonization by Learning from Painterly Objects}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2024},
  doi = {10.1609/aaai.v38i5.28231},
}
Figure