Introduction
Line drawings, whether digitized from physical paper or created natively in digital environments, frequently suffer from unintended gaps. These discontinuities are not merely aesthetic flaws; they pose significant technical hurdles for downstream tasks like "flood fill" coloring, which relies on closed boundaries. Traditional inpainting solutions, such as PatchMatch, are optimized for natural images and typically require a manually defined mask to identify regions for repair. Moreover, these methods often fail to preserve the structural integrity—specifically the consistent thickness and smooth curvature—of lines across a gap.
This paper presents a deep learning-based approach for the joint detection and inpainting of line drawings. By utilizing a fully convolutional neural network (CNN), the system automatically identifies and repairs gaps without user intervention or pre-defined masks.
Methodology
The core of the proposed system is a 16-layer Fully Convolutional Network (FCN) utilizing an encoder-decoder architecture. To handle images of varying resolutions, the model avoids fully connected layers. Downsampling is achieved through strided convolutions to capture broader contextual information, while nearest-neighbor upsampling is employed to restore the image to its original resolution.
Training and Data Augmentation
A significant challenge in training such a model is the lack of a large-scale dataset of "broken" line drawings. The authors overcome this by using a small dataset of 60 clean images and applying aggressive on-the-fly data augmentation.
During training, segments of lines are programmatically erased using random squares. Combined with random rotations, scaling, and flips, this process generates millions of unique training pairs. This strategy forces the network to learn the underlying "grammar" of line structures, enabling it to predict missing segments based on surrounding curvature and thickness.
Key Results
The model demonstrates a remarkable ability to distinguish between intentional line endings and accidental gaps. Unlike traditional patch-based methods, the CNN naturally absorbs complex heuristics for line continuity.
In a user study involving 18 participants, the proposed method was preferred over state-of-the-art competitors like Image Melding and PatchMatch more than 90% of the time. Quantitatively, the method achieved an average score of 4.2 out of 5, significantly higher than the 2.8 achieved by the next best method. Furthermore, the implementation is highly efficient; on a modern GPU, it can process a 1024 x 1024 image in approximately 21 milliseconds—roughly 60 times faster than traditional CPU-based approaches.
Discussion and Limitations
While the model excels at standard gap repair, it faces challenges in highly ambiguous scenarios. When multiple lines intersect near a gap, the network may occasionally connect the wrong endpoints. Additionally, very large gaps remain difficult to fill accurately as the network loses the necessary geometric context to project the line's path. Future work may involve expanding the training dataset and refining loss functions to better handle complex artistic styles and larger structural failures.
Summary updated