Abstract
Automated jigsaw puzzle solving is a complex task with applications in archaeology, document restoration, and self-supervised learning. Traditional methods often struggle with "erosion"—missing pixels at piece boundaries—and lack global context, leading to error propagation. This paper presents a novel framework that utilizes Vision Transformers (ViT) and a differentiable permutation learner to achieve state-of-the-art results. By integrating a specialized CNN edge encoder with a Transformer backbone, the model demonstrates exceptional robustness to edge degradation and provides a global perspective on puzzle reconstruction.
Introduction
The challenge of reconstructing fragmented objects, such as ancient frescoes or shredded documents, has long motivated the development of automated jigsaw puzzle solvers. While simple in concept, real-world puzzles present significant hurdles. Most notably, "erosion" occurs when the edges of pieces are damaged or missing, rendering traditional pixel-matching techniques ineffective. Furthermore, many existing algorithms employ a "greedy" approach, placing pieces one by one. This local strategy is prone to cumulative errors, where a single incorrect placement can derail the entire reconstruction process.
To address these limitations, this research introduces a deep learning architecture designed to handle global context and maintain stability under degraded edge conditions. By framing puzzle-solving as a permutation learning problem, the proposed method leverages the strengths of Transformers to model complex pairwise relationships across all pieces simultaneously.
Methodology
The proposed architecture consists of three primary components designed to work in synergy: a CNN edge encoder, a Transformer backbone, and a differentiable assignment layer.
CNN Edge Encoder
Rather than processing the entire piece, a specialized Convolutional Neural Network (CNN) focuses specifically on the four edges of each puzzle piece. This encoder is trained using a triplet loss function with cosine dissimilarity. The goal is to map the visual features of piece edges into a latent space where edges that should be adjacent in the final reconstruction are positioned close to one another.
Transformer Backbone
The core of the model is a 6-layer Vision Transformer (ViT). Transformers are inherently permutation invariant, making them ideal for tasks where the initial order of inputs is arbitrary. Through its self-attention mechanism, the Transformer evaluates the relationships between all pieces in the puzzle, allowing it to develop a global understanding of the image layout. This global view enables the model to resolve local ambiguities that might confuse a greedy solver.
Differentiable Assignment (Sinkhorn-Knopp)
To enable end-to-end training, the model must produce a permutation matrix. The authors utilize the Sinkhorn-Knopp algorithm to convert the network's output into a doubly stochastic matrix. This serves as a differentiable approximation of a permutation matrix, allowing the entire system to be optimized using a reconstruction loss.
Experimental Setup
The model was trained on a substantial dataset of 450,000 high-resolution images from the Laion-art collection. High-resolution images (exceeding 1000x1000 pixels) were selected to minimize extrapolation biases during the piece extraction process.
Evaluation was conducted using three standard benchmarks: MIT, McGill, and BGU. The testing suite included puzzles ranging from 70 to 600 pieces. To test robustness, varying levels of edge erosion (0, 2, and 4 pixels) were applied to the pieces.
Results and Discussion
The proposed framework significantly outperformed existing state-of-the-art (SOTA) methods, particularly in challenging scenarios involving significant erosion.
Robustness to Erosion
On the MIT dataset with 4-pixel erosion, the model achieved a remarkable 91.0% accuracy (ACC). In contrast, the previous leading deep learning method reached only 50.5%, while traditional greedy algorithms saw their performance drop to 12.1%. The model also achieved "Perfect Reconstruction" (PR) for 50% of the MIT puzzles even with 2-pixel erosion, a significant milestone in the field.
Joint Training Synergy
A key finding was the benefit of joint training. Training the CNN encoder simultaneously with the Transformer improved the encoder's performance by approximately 6%. This suggests that the global task of puzzle reconstruction provides valuable feedback that helps the local encoder learn more effective edge features.
Visual Consistency
Even when the model failed to achieve a perfect reconstruction, the errors were often visually consistent. Incorrect placements typically occurred in areas with pseudo-periodic patterns or uniform textures, such as clear skies or grass, where even human solvers would face difficulty.
Conclusion and Future Work
This research demonstrates that Vision Transformers are highly effective for global puzzle reconstruction, offering superior robustness to edge erosion compared to traditional and previous deep learning methods. However, challenges remain. The quadratic scaling of the self-attention mechanism ($O(N^2)$) limits the model's ability to solve puzzles with thousands of pieces on current hardware.
Future research will focus on extending the model to handle "Type-2" puzzles (where pieces can be rotated), irregularly shaped fragments common in archaeology, and scenarios involving missing or extra pieces. Adapting the Sinkhorn operator for these more complex constraints will be a primary area of investigation.
Summary updated