Clear Sky Science · en
AFMNet: an activation-free mural completion network via multi-head attention mechanism
Why Saving Faded Wall Paintings Matters
Ancient wall paintings in temples and caves are not just beautiful decorations; they are visual records of how people once lived, prayed, dressed, and imagined the world. Unfortunately, many of these murals are cracked, flaking, or partly lost. Restoring them by hand is slow, risky, and sometimes impossible. This study introduces AFMNet, a new computer method that can digitally "fill in" damaged areas of mural images in a way that looks convincing to the eye, runs efficiently on modest hardware, and helps protect fragile cultural treasures for research and virtual display.

The Problem With Broken Pictures
Traditional digital repair tools usually copy nearby colors and textures into missing regions, which works for small scratches but fails when entire faces, hands, or decorative patterns are gone. Modern artificial intelligence methods can imagine plausible content for large gaps, but most were designed for everyday photos, not for the unique styles of ancient art. Murals often feature one-of-a-kind figures, intricate borders, and irregular cracks that do not follow neat shapes. Existing systems either blur important details, introduce awkward shapes, or require heavy computing power that is impractical for many museums and conservation labs.
A Lean Network Built for Murals
AFMNet is a compact image-processing network shaped like a U, with an encoder that breaks a damaged image down into features and a decoder that rebuilds it into a complete picture. What makes it special is a dual-stream design: one stream carries information about the visible parts of the mural, and the other carries a map of which pixels are missing or unreliable. This map is updated at every stage, so the system always knows where to trust the original image and where it must invent new content. By explicitly separating sound and damaged regions, AFMNet focuses its efforts where they are most needed and avoids needlessly changing intact areas.

Mixing Global Patterns With Fine Detail
To make believable repairs, the system must understand both the overall scene and tiny brushstrokes. AFMNet’s core building block tackles this by looking at the image in three complementary ways at once. In the spatial view, it examines local neighborhoods of pixels, which helps it handle cracks and edges. In the frequency view, it uses a mathematical transform to see broader structures and repeating motifs across the entire mural. In the channel view, it learns which combinations of color and texture carry the most important artistic signals, and it quietly boosts those while ignoring less useful information. Instead of relying on standard, calculation-heavy activation functions, AFMNet uses a simple gate mechanism that multiplies pairs of feature maps to create nonlinearity, trimming the model’s size and computation without sacrificing expressiveness.
Letting Distant Regions Talk
Many murals contain figures, ornaments, and backgrounds that are related across large distances on the wall. To connect these far-apart elements, AFMNet adds a lightweight multi-head attention module at the narrowest point of the U. Here, the network allows each part of the image to "look" at all other valid parts and decide which ones should influence the repair. Different attention heads can specialize in different relationships—for example, keeping the curve of a halo consistent or aligning a repeated border pattern. Crucially, the attention module also sees the damage map, so it learns not to base decisions on regions that have already been synthetically filled and might still be uncertain.
Proving It Works in Practice
To test AFMNet rigorously, the authors trained it first on a large collection of everyday scenes and then fine-tuned it on a carefully curated set of Dunhuang cave murals. They created realistic damage masks using a random-walk process that mimics real cracks and flaking. Across several levels of damage, AFMNet consistently outperformed well-known competing methods on standard image quality measures, while using about one-third fewer parameters than a strong baseline. Visual comparisons on both synthetic and genuinely damaged murals showed that AFMNet better preserves facial features, decorative lines, and subtle textures, with fewer distracting artifacts, even when working at higher resolutions that are common in museum imaging.
What This Means for Cultural Heritage
In plain terms, AFMNet is a smart, efficient digital restorer that can guess missing parts of ancient murals in a way that respects their style and structure. It handles complex cracks and pigment loss more gracefully than many existing tools and can run fast enough on standard computers or laptops to be used on site. While it still struggles with the most severe soot damage and highly intricate textures, it provides conservators and researchers with a powerful aid for visualizing how damaged works may once have looked, planning physical interventions more safely, and creating engaging digital exhibitions that bring fragile wall paintings to life for broader audiences.
Citation: Hu, C., Luo, D., Xia, G. et al. AFMNet: an activation-free mural completion network via multi-head attention mechanism. npj Herit. Sci. 14, 239 (2026). https://doi.org/10.1038/s40494-026-02379-w
Keywords: digital mural restoration, image inpainting, cultural heritage, deep learning, attention networks