MixSA: Training-free Reference-based Sketch Extraction via Mixture-of-Self-Attention

Rui Yang, Xiaojun Wu, Shengfeng HeIEEE TVCG 2025

Introduction

Sketch extraction is a fundamental task in computer vision and digital art, traditionally handled by edge detection algorithms like Canny or data-driven models like SketchKeras. However, these approaches often lack artistic nuance or require prohibitively large paired datasets. MixSA (Mixture-of-Self-Attention) introduces a training-free framework that leverages pre-trained Latent Diffusion Models (LDMs) to extract high-quality sketches from color images while mimicking arbitrary reference styles. By manipulating the self-attention layers of the model, MixSA allows for precise control over line texture and artistic interpolation without the need for expensive, paired training data.

Methodology

MixSA operates by leveraging the visual priors of a pre-trained diffusion model without requiring additional training. The workflow consists of several key stages:

  1. DDIM Inversion: The color input, an initial edge map (generated via TEED), and a reference style sketch are inverted into the latent noise space to provide a structural skeleton.
  2. Mixture-of-Self-Attention (MixSA): This core mechanism replaces the Keys ($K$) and Values ($V$) of the target image’s self-attention layers with those from the reference sketch. This effectively "injects" the brushstroke characteristics of the reference into the target's structure.
  3. Decomposing Contours and Texture (DCT): Using a parameter $\beta$, the model blends the query features ($Q$) of the color image and the initial edge map. This allows the system to balance the preservation of internal textures against the adherence to primary outlines.
  4. Addressing Color Averaging: To combat the tendency of diffusion models to produce mid-tone grays (the "color averaging" effect), the authors implement a binarization post-processing step and anchor the generation to a high-contrast contour map, ensuring crisp black-and-white lines.

Experimental Evaluation

The framework was evaluated across three diverse datasets: 4SKST (professional sketch styles), FS2K (facial sketches), and an Anime dataset.

Quantitative and Qualitative Performance

On the 4SKST dataset, MixSA achieved superior results with an LPIPS of 0.1124 and a PSNR of 35.65, outperforming state-of-the-art methods like Ref2sketch and StyleID. Qualitatively, MixSA demonstrates a unique ability to handle "unseen" styles, successfully replicating complex brushstrokes that data-driven models often fail to capture when presented with styles outside their training set.

Original color image of the Shanghai skyline used as input.

User Preference

A user study involving 50 participants confirmed the visual appeal of the generated sketches. MixSA’s outputs were preferred 71.68% of the time compared to three other leading models, highlighting its effectiveness in producing artistically satisfying results.

Conclusion and Future Work

MixSA provides a robust, training-free solution for style-controllable sketch extraction. While highly effective, the method faces challenges with low-contrast reference sketches and computational overhead due to the DDIM inversion process. Future research will focus on optimizing inversion efficiency and improving the handling of subtle artistic details in complex scenes.

Summary updated

BibTeX
@article{yang2025mixsa,
  author = {Rui Yang and Xiaojun Wu and Shengfeng He},
  title = {{MixSA: Training-free Reference-based Sketch Extraction via Mixture-of-Self-Attention}},
  journal = {IEEE Trans. Vis. Comput. Graph.},
  year = {2025},
  url = {https://openreview.net/forum?id=WaSFTp6ltE},
}
Figure