Manga (Japanese comics) have attracted readers all over the world. Because manga are usually created with a pen and ink on white paper, most existing manga are monochrome. To make the existing manga more attractive, there is a strong demand for a colorization technique for monochrome manga. However, manual colorization [Iizuka et al. 2016 ]. (b) Results by [Iizuka et al. 2016 ] + adversarial loss [Goodfellow et al. 2014 ]. (c) Our results.
of manga is a time-consuming task because the artist needs to edit each page one by one.
To efficiently colorize manga, full automatic colorization methods with convolutional neural networks (CNNs) have been proposed [Cheng et al. 2015; Iizuka et al. 2016; Zhang et al. 2016 ]. However, it is impossible for such full automatic methods to beautifully colorize a whole manga title (a set of manga pages) because of the "color ambiguity problem. "
The color ambiguity problem is defined as follows. A manga title typically consists of hundreds of pages, where each page is composed of several panels (Fig. 1) . It is therefore essential to colorize the same character by the same color across all panels. This is not a trivial task, because (1) the same character might be visually different, and (2) different characters might seem visually similar. This is the color ambiguity problem, and is the reason that fully automatic methods do not work well. Fig. 2 illustrates an example. Each column contains three panels with the same character, where the automatic method does not work well. The first and second columns show the colorized results by fully automatic methods. Fig. 2(a) shows the results by [Iizuka et al. 2016 ]. Fig. 2(b) shows the results by [Iizuka et al. 2016 ] + adversarial loss [Goodfellow et al. 2014 ]. Our objective is to colorize three panels beautifully by the same color composition. Fig. 2 (a) and (b) show two typical tendencies of the automatic methods. Fig. 2 (a) is colorized by "faint" colors, i.e., reddish and non-vivid in this case. By this type of method, all images are colorized by such faint and non-vivid colors. On the other hand, each character of Fig. 2(b) is colorized by vivid colors (e.g., the fresh green hair color of the third row). However, the same character might be colorized by the different colors, such as the yellow hair of the second row. These two tendencies caused by the color ambiguity problem are typical of automatic methods. To colorize the same character by the same color, the results become faint and non-vivid. If the system colorizes characters more vividly, the same character would have the different colors.
To solve the color ambiguity problem, we propose a semi-automatic colorization method (Fig. 3) . To colorize the input manga images, our system takes reference images as additional inputs. From each reference image, a color feature is extracted. Our system colorizes the manga images using the extracted color feature. Fig. 2(c) shows the result of the proposed approach with a reference image. The characters are colorized not only vividly but also with the same color for the same area, such as orange hair. Compared to the manual colorization, our system drastically reduces the operations because only a small number of interactions are required (only selecting reference images for each character). Fig. 1 illustrates other examples, where several manga pages were colorized using reference images.
To further refine the result, our system provides standard interactive refinement functions, such as providing color dots [Sangkloy et al. 2017; Zhang et al. 2017] or controlling the dominant color. A user who is not satisfied with the result can interactively modify it. Fig. 3 shows an overview of our system. The pre-processing step, including the automatic panel segmentation, is explained in Sec. 2.1. Sec. 2.2 introduces the semi-automatic colorization method. The revision functions are explained in Sec. 2.3. Sec. 2.4 describes the post-processing step for obtaining a complete colorized manga page.
Our system requires manga pages and reference images of each character as inputs. First, we binarize the input manga. Then, our system segments the input manga pages into panels for the colorization phase. Panel detection and segmentation are performed automatically on the basis of [Ishii et al. 2009 ]. This process is illustrated in Fig. 3 (a).
Each segmented panel (character) is colorized using our CNN architecture ( Fig. 3(b) ). Our architecture is based on [Iizuka et al. 2016] , which is a convolutional encoder-decoder network with an additional classification branch. Our model has three improvements over theirs:
• leveraging color features from reference images, • training the classification branch using character names,
• training with adversarial loss for vivid colorization.
Please see Sec.5 for the details of our architecture and training procedure. All source code is available. 1 Color feature: We extract color features from reference images, and feed them into the CNN architecture to achieve consistent colorization for the same character. Given a reference image, we scan all pixels in order to create a color histogram. The histogram is first normalized by the number of pixels, and quantized from Fig. 3 . Illustration of our colorization pipeline. The inputs of the system are manga page images and reference images. (a) The system then segments the manga page images into panel images for colorization (described in Sec. 2.1). (b) The colorization step is the main operation of our tool. This task is performed semi-automatically using input reference images (described in Sec. 2.2). (c) Then, the revision is carried out by the user. The user can interactively modify the result by applying color dots and/or adjust color histogram (described in Sec. 2.3). (d) Finally, the colorized panels are restored to the original layout via resizing and overlaying the text and contours from the original page (described in Sec. 2.4). a typical 256 3 bins to 6 3 bins. The resultant color histogram for each reference is h ∈ N 216 . We further binarize this histogram to p ∈ {0, 1} 216 to handle the color feature more implicitly. We call this 216-dimensional binary vector p a palette. Compared to the color histogram, a palette is robust against the difference of the ratio of colors between the reference image and the input image.
Classification training by character names: The original model of [Iizuka et al. 2016 ] has a classification branch. This branch predicts the category of the scene to better illustrate the result. For example, if the model recognizes an input image as sea, the model tends to colorize the image using more blue than green. In our case, we train this categorization branch by the pair of the name of the character and its image, using our character dataset.
Adversarial loss for vivid color: Additionally, we add an adversarial loss to the objective function to this architecture [Goodfellow et al. 2014; Radford et al. 2017] . Recent studies showed that the adversarial loss helps to colorize images more vividly Sangkloy et al. 2017] , and we also follow this line. At training time, we input ground-truth and generated images to the discriminator one by one, and the discriminator outputs 0 (= Fake) or 1 (= Real). Following the previous approaches, the loss of the discriminator is sigmoid cross entropy.
Optionally, our system allows users to interactively revise the colorized results (Fig. 3 (c)). Our system has two functions for revision: histogram and color dots. The histogram is used for global revision of the panel, and color dots are used for local revision.
Histogram: If the user fails to select colors by a palette, he or she can interactively change the color feature from the palette p to its original histogram h. The user can manually adjust the amount of the most frequent color bin (typically, the background color). The color feature is then automatically normalized with the adjustment. This adjustment of the frequent color bin is useful to for preventing color bleeding.
Color dots: Our method can accept color dots in addition to color features. If a user applies a color dot to a region, the area around the selected region is colorized by the color of the dot. Because our model is trained using not only typical images but also images with synthesized color dots, we can directly feed an input image with color dots to our model.
Finally, we finish the colorization by the following four steps: To improve the results, whitish and blackish areas are automatically changed to pure black and white, respectively. To resize the panel images to the original size, we perform super-resolution. Finally, the colorized panels are re-composed to the original page. The texts and contours from the original page are then overlaid. This process is illustrated in Fig. 3(d) .
In this section, we briefly explain how to train the network for colorization.
We collected hand-drawn character images as a training dataset instead of manga images because there are very few pairs of monochrome and colorized manga images publicly available. We binarized each color manga image using [Otsu 1979 ] to make a pair of color and monochrome images. The original color image is used as an input, and the monochrome image is used as a ground truth for the training process.
Given pairs of training images (input and ground truth), our network was trained based on the mean squared error criterion over the L*a*b color space, with an additional adversarial loss and a classification loss.
To handle revision by color dots, we trained our network using synthesized color dots that are created on the basis of the colors in the ground truth images. Fig. 4 shows inputs and the colorization results of our model. Fig. 4(a) shows the input images. Fig. 4(b) shows the colorized results using the palette of the reference images at the top. In the case of Fig. 4(c) , the color version of the input character was used as a reference. Our method successfully colorized a set of input characters vividly with the same color composition, using a reference character. Fig. 4(c) was revised via manual revisions as shown in the next column. The bleeding of the yellow color to the girl's clothes on the left side was prevented by adjusting the histogram. Incomplete areas such as the forehead, hair, and collar were successfully colorized by providing color dots. Because characters across different panels can be easily colorized using the same color, our method is highly suitable for manga colorization.
Limitations: Our semi-automatic colorization algorithm sometimes fails to colorize the panel image when multiple characters appear. In the case of such failure, the user can edit the image with many color dots.
We crawled several color illustrations from niconico-seiga 2 , which is one of the largest illustration-sharing website in Japan. In niconicoseiga, creators draw an illustration of a character, and post it on the service with the name of the character.
To train our model, we leveraged the niconico-seiga dataset, which contains these images. Because our objective is to colorize manga vividly, we removed images that have a low saturation value in the HSV color space from the dataset. Because our main target is a character, we used only character images that were detected by an animation-face-detector 3 . We eventually used a total of 160,000 images as the training dataset.
First, each image was resized to 256×256 pixels. We then randomly cropped regions to 224×224 pixels from each image. This cropping makes our model robust. For further robustness, we also randomly flipped the images horizontally with 50% probability. Fig. 5 shows the architecture of the networks in our system. This architecture was based on [Iizuka et al. 2016] , whose model has four networks: a global features network, low-level features network, mid-level features network, and colorization network. In addition to [Iizuka et al. 2016 features from reference images, training the classification branch using character names, and training with adversarial loss for vivid colorization. We explain the implementation details of (1) fusing the color features into the network, (2) preparing the data for the global network, and (3) setting the parameters. How to fuse color features: In the original model of [Iizuka et al. 2016] , given an input image, the visual information (the weight tensor in R 28×28×256 ) is extracted via low-and mid-level feature networks. The global information (the weight vector in R 256 that represents a category of the image) is extracted via global feature networks. These two features are concatenated so as to form a latent variable of the network ("fusion layer" in Fig. 5) 4 .
In our proposed network, we further concatenated a 256-dimensional color feature to the fusion layer in the same manner as the concatenation of the global feature. With the color feature, the color information of a reference image is automatically incorporated to colorize the input image. Data preparation for the global network: The global features network of the original model predicts the label (scene category) of the input image. Unlike the original model, the global network of our model predicts the label of the name of the character. The label information was based on the service of niconico-seiga (as shown Sec. 5.1). The total number of collected labels was 428.
Parameter settings: Table 1 illustrates the detailed parameter settings of the networks. We trained the model for 550,000 iterations with a batch size of 30.
As an activation function, we used a sigmoid function for the final output layer, and ReLU for the other layers. We inserted a batchnormalization layer [Ioffe and Szegedy 2015] after each convolution layer.
Our network was trained on the basis of the mean squared error (MSE) criterion over the L*a*b color space, with an additional adversarial loss and a classification loss. These losses were weighted as:
MSE : adversarial : classi f ication = 1 : 1 : 0.003.
(1) We trained our network using the Adam optimizer [Kingma and Ba 2015] . We used the Adam parameters α = 0.0001, β 1 = 0.9, and β 2 = 0.999. We used the optimization procedure until convergence of the loss.
Our system enables users to interactively revise the colorized result using color dots. To train a network to recognize these control color dots at test time, we synthesized pseudo color dots for the training data. We generate synthesized color dots on the basis of the colors in the ground truth image.
We put synthesized color dots at random positions on the input monochrome image. Each pixel of the resultant image consists of three values. The first value is zero or one, which represents the pixel value of the original input monochrome image. The second and the third values are the "a" and "b" values, respectively, of the color dots in the L*a*b color space. If the color dot does not exist in the pixel, zero is padded for the second and the third value.
The size of synthesized color dots is one pixel, and the number of the dots is decided randomly from 0 to 15. The model becomes robust by feeding a random number of dots. Our method works perfectly even if the number of the inputs is more than 15, the maximum of the number of given synthesized color dots, except for unusual cases such as all points placed in the same position. In the testing phase, users can provide any number of points to the system to enhance the result.
In this paper, we propose the first system to colorize an entire manga at once. Our method colorizes a whole page (not a single panel). Moreover, with color features extracted from the input reference image, we confirmed that our system was able to colorize the same character by the same color. By employing adversarial loss, we confirmed that adversarial networks emphasize the effect of given color information. We demonstrated that the color features help the inference by our deep colorization network. In addition, our tool allows users to revise the colorization result interactively by adjusting color histogram and adding color dots.
Although we used character illustrations as the training datasets, manga contains special components drawn with lines, such as many contours of panels, text balloons, and the text itself. Because the resolution of the image is changed during the colorization process, the contours and texts tend to be blurred unintentionally. To remove such unintentional blurring, we apply a super-resolution (SR) method for clear colorization. A sample result of the process is shown in Fig. 6 . The architecture of super-resolution is inspired by PaintsChainer 5 , whose superresolution model was originally based on [Ronneberger et al. 2015] . The original size of colorized images by our colorization network is 224 × 224 pixels for each panel (Fig.6 (b) ). By applying superresolution, we obtain a high-resolution image with 448×448 pixels (Fig. 6 (c) ).
In this section, we discuss the effect of histogram adjustment and using color dots with results. Fig. 7 explains the comparison of color features. Fig. 7 shows the results of using a palette, a raw histogram, and an adjusted histogram. For all rows, the results with a palette (Fig. 7 (c) ) have less color breeding than those with a raw histogram (Fig. 7 (d) ). This indicates that the palette enables us to robustly colorize images 5 https://github.com/pfnet/PaintsChainer with less breeding, because the palette constrains the possible color space. In the result using a raw histogram (Fig. 7 (d) ), the dominant color is spread. At the top-row image, the red-brown color of the hair in the reference image bleeds beyond the boundaries (Fig. 7 (1-d)); this occurs in the second row as well ( Fig. 7 (2-d) ). In the third row ( Fig. 7 (3-d) ), the background color is white, and the most frequent color in the reference image is white. Consequently, the result with a raw histogram is too whitish. By adjusting the ratio of the dominant color (white), the result is improved (Fig. 7 (e)), where the hair and skin is colorized with pink.
In addition, we introduce how users can combine color features and color dots effectively. Figure 8 shows the colorized results along with the number of color dots. The images show the use of color dots ( Fig. 8 (b) ), a histogram (Fig. 8 (c) ), or a combination of both ( Fig. 8 (d) ). When the user adds six dots, the colorization result is as shown in Fig. 8 (b) . The user adds four dots for the hairs (two dots near the head and the others at the hair ends of the right side and the left side), and two dots to both eyes. Although the colorized result is similar to the target ( Fig. 8 (a) ), several interactions are required (providing six dots). If the user uses only the histogram extracted from the target (Fig. 8 (a) ) as reference, the colorization result is as shown in Fig. 8 (c) . In this image, the eye color differs from that of the target image, but most regions are colorized using the same colors as the target image. Fig. 8 (d) shows the result with two additional dots to Fig. 8 (c) . Two dots are added to both eyes. This result is colorized like the target by adding fewer color dots in comparison ( Fig. 8 (b) ). We recommend that the user colorizes using the color features calculated from the reference image first and then specifying the local regions by adding only a few color dots.
Our semi-automatic colorization algorithm sometimes fails to colorize the panel image when multiple characters appear (Fig. 9) . In Fig. 9 (a) , two characters appear in the input panel. In Fig. 9 (c) , the girl on the left side is colorized unappealingly, because the hair is colorized using the same color as her hair on the right side. As in one of the revision examples, the user edits the image with many color dots ( Fig. 9 (d) ). However, this interaction wastes the color information from the reference image.
Regarding this problem, we consider that histogram blending (Fig. 10) is perhaps suitable for overcoming this problem. Instead of using many color dots, we used two reference images ( Fig. 10 (b) and (c)) at an equal ratio. In Fig. 10 (d) , we finally get the suitable colorized result by using the blended histogram. When the size of each character is different, the user should adjust the blending ratio of the reference images. 
We show further colorization results in Fig. 11 . In Fig. 11 , the same manga pages were colorized with different reference images, and reference images were used as the palettes. Each result was colorized with the colors of each combination of reference images. In addition to this, we colorize all monochrome manga in the Manga 109 Dataset [Matsui et al. 2016] using the palette of the cover image of its manga.