MagicColor: Multi-Instance Sketch Colorization

Yinhan Zhang, Yue Ma, Bingyuan Wang, Qifeng Chen, Zeyu WangarXiv 2025

Abstract

We present Follow-Your-Color, a diffusion-based framework for multi-instance sketch colorization. The production of multi-instance 2D line art colorization adheres to an industry-standard workflow, which consists of three crucial stages: the design of line art characters, the coloring of individual objects, and the refinement process. The artists are required to repeat the process of coloring each instance one by one, which is inaccurate and inefficient. Meanwhile, current generative methods fail to solve this task due to the challenge of multi-instance pair data collection. To tackle these challenges, we incorporate three technical designs to ensure precise character detail transcription and achieve multi-instance sketch colorization in a single forward pass. Specifically, we first propose the self-play training strategy to address the lack of training data. Then we introduce an instance guider to feed the color of the instance. To achieve accurate color matching, we present fine-grained color matching with edge loss to enhance visual quality. Equipped with the proposed modules, Follow-Your-Color enables automatically transforming sketches into vividly-colored images with accurate consistency and multi-instance control. Experiments on our collected datasets show that our model outperforms existing methods regarding chromatic precision. Specifically, our model critically automates the colorization process with zero manual adjustments, so novice users can produce stylistically consistent artwork by providing reference instances and the original line art.

TL;DR

Follow-Your-Color is a novel diffusion-based framework designed to colorize complex line art containing multiple distinct objects or characters in a single pass. By leveraging a "self-play" training strategy and an instance-aware guidance system, it maintains high color consistency across multiple instances while preventing the common "color bleeding" issues that plague traditional automated colorization methods.

What Problem Does This Paper Address?

In the professional 2D animation industry, colorizing line art is a grueling, manual process. Artists must meticulously apply color palettes to every individual object, frame by frame, ensuring that a character’s shirt in one shot matches the same shirt in the next.

While AI has made strides in "reference-based colorization," existing models face three major hurdles:

  1. Domain Adaptation Gap: Models often require the reference image and the sketch to have nearly identical poses (isomorphic geometry), which is rarely the case in creative workflows.
  2. Granularity Control: Most models struggle to colorize multiple different objects in the same image simultaneously (e.g., colorizing a car, a ball, and a character in one go).
  3. Color Consistency: In sketches with "non-closed" lines, colors often "bleed" into adjacent areas, ruining the professional look.

Methods

The authors introduce Follow-Your-Color, a framework built on a dual-UNet architecture (a reference net and a main denoising UNet) with several key innovations:

  • Self-Play Training Strategy: To solve the lack of multi-instance training data, the authors use a two-stage approach. They use the Segment Anything Model (SAM) to "chop up" single images into individual instances, which are then randomly fused, scaled, and shuffled to create synthetic multi-instance training pairs.
  • Instance Guider (ICM): This module uses DINOv2 features to extract "spatial identity." It aligns the bounding boxes of reference instances with the target sketch in the latent space, allowing the model to know exactly which color belongs to which object.
  • Fine-Grained Color Matching with Edge Loss: Instead of treating every pixel equally, the authors implemented a re-weighted edge loss. By focusing the model’s "attention" on high-frequency areas (edges), they significantly reduced color bleeding and improved the precision of color placement within thin line art.
Example of multi-instance colorization where a character sketch is colored using specific reference items like a hat, rose, and backpack.

Datasets

The model was trained and evaluated using a mix of high-quality animation and hand-drawn data:

  • Training Data: Sourced from Sakuga, ATD-12K, and various internet-collected animation frames.
  • Animation Test Set: 1,570 pairs derived from the films Your Name and Spirited Away.
  • Hand-Drawn Test Set: 100 pairs of real-world sketches collected from users to test the model's robustness to "messy" human input.

Key Insights and Ideas

  • Synthetic Multi-Instance Data is Key: The "aha moment" here is that you don't need a massive dataset of multi-character scenes to train a multi-character model. By programmatically "kit-bashing" single-object images together (the self-play strategy), the model learns to handle complex scenes.
  • Latent Alignment over Geometric Matching: By aligning features in the latent space rather than trying to warp the reference image to fit the sketch, the model becomes much more flexible regarding pose and viewpoint differences.
  • Edges as Loss Weights: Using an edge map as a weight for the loss function forces the diffusion process to respect the boundaries of the line art, which is the most critical requirement for professional-grade colorization.

Key Results

Follow-Your-Color significantly outperformed state-of-the-art GAN and diffusion-based baselines (like MangaNinja and AnimeDiffusion) across both quantitative and qualitative metrics:

  • Quantitative: On the Animation Dataset, it achieved an FID of 28.953 (lower is better), nearly 33% better than the next best model (MangaNinja at 43.165). It also led in PSNR (23.751) and SSIM (0.783), indicating higher structural and chromatic accuracy.
  • Qualitative: Visual results show the model successfully colorizing scenes with multiple disparate objects (e.g., a car, a book, and a hat) while keeping colors perfectly contained within the lines, even when the reference objects were in completely different orientations.
The model successfully colorizes a scene with multiple disparate objects, maintaining color boundaries and respecting the original line art.

Limitations and Future Work

Despite its strengths, the authors note a few areas for improvement:

  • Complex Occlusions: When objects heavily overlap or "tangle" with one another, the model can occasionally lose track of fine details.
  • Scaling Instances: While it handles multiple instances well, there is a practical limit to how many distinct references can be fed in before the latent control becomes crowded.
  • Future Directions: The team plans to expand the number of supported reference instances and further enhance the model's ability to maintain semantic consistency in extremely dense scenes (like a forest or a battle sequence).

Summary updated

BibTeX
@misc{zhang2025magiccolor,
  author = {Yinhan Zhang and Yue Ma and Bingyuan Wang and Qifeng Chen and Zeyu Wang},
  title = {{MagicColor: Multi-Instance Sketch Colorization}},
  year = {2025},
  eprint = {2503.16948},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2503.16948},
}
Figure