Clear Sky Science · en
Frequency-guided few-shot pattern inpainting for Ming Dynasty rank badges restoration
Why saving old cloth badges matters
Museums around the world hold rare cloth squares from China’s Ming Dynasty that once showed an official’s rank through detailed bird-and-cloud designs. Many of these badges are torn, faded, or full of holes, making it hard for historians and the public to see their original beauty. This study introduces a digital restoration method that can carefully "fill in" the missing parts of these textiles on a computer screen, helping safeguard cultural heritage without touching the fragile originals.
The story behind the badges
Ming rank badges are not just pretty pictures; they are visual ID cards for imperial officials. Each rank was linked to a specific bird, from cranes for high officials to finches for lower ranks. The patterns are woven with repeating motifs and rich symbolism, so any loss of threads can erase both visual rhythm and historical meaning. Existing digital repair tools often work well for ordinary photos but stumble on these badges: they may invent believable textures that break the strict repetition of the weave, or they misrepresent the key bird symbol that signals status.

A smart way to learn from just a few examples
Unlike modern fashion images, historical textiles exist in small numbers, so computers cannot rely on millions of training examples. The authors address this "few-shot" problem by building a focused dataset of 685 Ming rank badges gathered from museums and private collections, with both intact and damaged pieces. Their system is trained to reconstruct missing areas using as few as five undamaged examples for each type of badge. Instead of treating these textiles as generic pictures, the method is tailored to fabrics that have strong repetition and clear symbolic elements, so it can generalize from limited data while respecting the badges’ cultural meaning.
Listening to patterns in two worlds
The core innovation is to make the computer look at each badge in two complementary ways: as an image and as a pattern of frequencies. In the usual image view, the system checks that the colors and textures it paints into a hole blend smoothly with surrounding threads. In the frequency view, a mathematical tool called the Fourier transform turns the repeating weave into bright points in a spectral map, much like turning music into a graph of pitches. Damage disrupts these regular peaks. The proposed network restores missing regions while forcing the frequency pattern of the repaired badge to match that of an intact one, helping it recover the correct rhythm of clouds, waves, and borders rather than random guesswork.

Keeping meaning, not just looks
To avoid losing the story behind each badge, the authors add another layer of guidance. A separate recognition model is trained to distinguish ranks based on the central bird and other symbolic cues. During restoration, the system is penalized if the completed image no longer looks like the same rank to this recognition model. This “culturally aware” loss nudges the inpainting process to preserve key symbols and overall composition, so a damaged crane badge is restored as a crane badge, not something that merely looks decorative. User studies with art historians and textile experts confirm that the new method better maintains pattern accuracy, symbol clarity, and color harmony than leading alternatives.
What the results mean for heritage
Tests show that the new approach produces sharper, more regular patterns and more convincing reconstructions than existing state-of-the-art inpainting tools, according to both numerical image-quality scores and expert opinion. While it can still struggle when enormous portions of a badge are missing, especially the central bird, it offers a powerful digital aid for museums and researchers. By combining smart learning from few examples with careful attention to the fabric’s underlying rhythm and symbolism, this work points toward a future where fragile historical textiles can be studied, shared, and even virtually “repaired” without putting the originals at risk.
Citation: Zhang, W., Zhang, Y. Frequency-guided few-shot pattern inpainting for Ming Dynasty rank badges restoration. npj Herit. Sci. 14, 234 (2026). https://doi.org/10.1038/s40494-025-02201-z
Keywords: cultural heritage, textile restoration, image inpainting, Ming Dynasty, deep learning