Fresco target detection method based on double-channel feature enhancement

CN122597767APending Publication Date: 2026-08-18BEIJING UNIV OF CIVIL ENG & ARCHITECTURE
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610751443.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-05-28
Publication Date
2026-08-18

AI Technical Summary

Technical Problem

然而,这些改进多局限于单一维度或固定策略,未能充分兼顾通道与空间信息的互补性,也难以根据目标尺度的变化动态调整特征提取范围,因此在面对壁画这类兼具复杂背景、多尺度目标和丰富细节的图像时,检测性能仍有较大提升空间

Benefits of technology

本发明通过通道注意力机制对多尺度特征图进行加权,强化重要通道的响应;同时引入空间注意力机制,对下采样后的区域进行跨尺度特征融合与亲和图计算,使网络能够聚焦于关键区域。二者串联使用,有效抑制了壁画图像中装饰纹样、褪色噪声等背景干扰,显著提升了目标与背景的区分度,从而提高了检测精度。本发明根据输入特征的空间分布自适应选择空洞率进行卷积操作,当目标尺度较小时,网络优先采用小空洞率以保留局部细节,当目标尺度较大时,采用大空洞率以捕获更广泛的上下文信息。这种动态感受野调节机制,使模型能够灵活适应壁画中从大型主尊到小型装饰图案的多尺度目标,提升了检测的鲁棒性。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122597767A_ABST
    Figure CN122597767A_ABST
Patent Text Reader

Abstract

The application discloses a mural target detection method based on double-channel feature enhancement, relates to the field of cultural heritage digitization protection and computer vision, and aims to overcome the defects of low detection precision of the prior art, and comprises the following steps: acquiring a mural image and inputting the mural image into a backbone network to extract a multi-scale channel feature map; generating a channel weight through global average pooling and convolution, outputting a channel weighted feature map; performing down-sampling and cross-scale fusion on the channel weighted feature map, generating a query vector, and performing region affinity graph calculation and attention processing on the query vector and key and value vectors to obtain a spatial weighted feature map; generating an on-off function through average pooling and convolution, adaptively selecting a hole rate for convolution operation, and outputting an enhanced feature map; and inputting the enhanced feature map and the original multi-scale feature map into a detection head after fusion. The application enhances the expression of key regions through channel and spatial attention, dynamically adjusts a receptive field in combination with a gate convolution, and can improve the detection precision and robustness of various targets in a mural image.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of digital preservation of cultural heritage and computer vision technology. More specifically, this invention relates to a method for mural target detection based on dual-channel feature enhancement. Background Technology

[0002] Murals contain rich historical information and artistic value. However, because they are mostly distributed in temple complexes across various regions, their dissemination and preservation have long faced difficulties. In recent years, with the advancement of the national cultural digitization strategy, utilizing digital technology to collect, analyze, and display murals has become an important direction for cultural heritage protection. Among these technologies, deep learning-based object detection technology can automatically identify key elements such as deities (e.g., Buddhas, Bodhisattvas) and patterns in murals, providing core technical support for the digital restoration, content retrieval, and virtual display of murals.

[0003] While existing object detection methods (such as Faster R-CNN and the YOLO series) have achieved excellent performance on natural images, they still face significant challenges when directly applied to mural images. First, mural images have complex backgrounds, often containing dense decorative patterns, religious symbols, and noise from fading and cracks caused by age, resulting in blurred boundaries between the object and the background, making it difficult for traditional detection models to accurately focus on the target area. Second, the scale of objects in murals varies greatly, ranging from large central Buddha statues to smaller donor figures or decorative patterns. Existing networks, limited by fixed or finitely variable receptive fields, struggle to capture the complete features of objects at multiple scales simultaneously. Furthermore, mural images are rich in detail, and both local texture and global semantic information are crucial for object recognition. However, existing methods often focus on single-level feature representation, lacking effective coordination between local and global information, leading to missed or false detections in densely detailed areas.

[0004] To address the aforementioned issues, existing technologies attempt to enhance the model's feature representation capabilities by introducing attention mechanisms or multi-scale feature pyramids. For example, important features are weighted through channel attention, and key regions are focused using spatial attention. However, these improvements are mostly limited to a single dimension or fixed strategies, failing to fully consider the complementarity of channel and spatial information, and are also difficult to dynamically adjust the feature extraction range according to changes in the target scale. Therefore, when dealing with images such as murals that combine complex backgrounds, multi-scale targets, and rich details, there is still considerable room for improvement in detection performance.

[0005] In conclusion, there is an urgent need to design a technical solution that can overcome the above-mentioned defects. Summary of the Invention

[0006] One objective of this invention is to provide a mural target detection method based on dual-channel feature enhancement, which improves the detection accuracy and robustness of various targets in mural images.

[0007] To achieve these objectives and other advantages of the present invention, according to one aspect of the present invention, a mural target detection method based on dual-channel feature enhancement is provided, comprising: S1: acquiring an image of the mural to be detected, preprocessing the mural image and inputting it into a backbone network to extract multi-scale channel feature maps; S2: performing global average pooling on the multi-scale channel feature maps, generating weight coefficients for each channel through convolutional layers and activation functions, and weighting the channel feature maps by channel to output a channel-weighted feature map; S3: downsampling the channel-weighted feature map to segment it into multiple regions, performing cross-scale feature fusion on each region to generate a lookup table. The query vector, along with the key vector and value vector generated by the convolutional layer, is used to perform region-to-region affinity graph calculation to generate a routing index matrix. Based on the routing index matrix, the key vector and value vector are indexed and then attention is calculated to obtain a spatially weighted feature map. S4: The spatially weighted feature map is average pooled and then a switching function is generated through a convolutional layer. The dilation rate is adaptively selected based on the output value of the switching function for convolution operation to obtain an enhanced feature map. S5: The enhanced feature map is residually fused with the multi-scale channel feature map to obtain a fused feature map. S6: The fused feature map is input into the detection head of the target detection network to output the detection result of the mural target.

[0008] Furthermore, in S2, global average pooling is performed on the multi-scale channel feature maps in the spatial dimension to obtain channel descriptors of size 1×1×C, where C is the number of channels. The channel descriptors are then sequentially input into a 1×1 convolutional layer, a SiLU activation function layer, and another 1×1 convolutional layer, and then mapped to the weight coefficients of each channel by the Sigmoid function. The weight coefficients are multiplied by the multi-scale channel feature maps for each channel to obtain the channel-weighted feature maps.

[0009] Further, S3 includes: S31: Downsampling the channel-weighted feature map and reducing its size to 1 / 2 or 1 / 4 of its original size through average pooling to obtain the downsampled feature map; S32: Generating key vectors and value vectors from the downsampled feature map through convolutional layers; S33: Cross-scale fusion of the region features after channel attention weighting at different scales to obtain fused features, and generating query vectors from the fused features through convolutional layers; S34: Performing region averaging on the query vector and key vector to obtain region-averaged query vectors and region-averaged key vectors, and calculating the affinity graph of the region-averaged query vector and region-averaged key vector through matrix multiplication to obtain the affinity matrix; S35: Performing Top-K operation on the affinity matrix after Softmax normalization to generate a routing index matrix; S36: Indexing the key vector and value vector according to the routing index matrix to obtain the indexed key vector and indexed value vector; S37: Performing attention calculation on the query vector, the indexed key vector, and the indexed value vector to obtain a spatially weighted feature map.

[0010] Further, in S33, the regional feature maps at each scale are unified to the same spatial size through upsampling or downsampling operations to obtain unified feature maps at each scale. Global average pooling is performed on the unified feature maps at each scale to obtain global feature vectors for each scale. The global feature vectors are then expanded to the same spatial size as the corresponding feature maps to obtain global feature maps for each scale. The feature maps at each scale are concatenated with their corresponding global feature maps along the channel dimension to obtain enhanced feature maps for each scale. The enhanced feature maps at all scales are concatenated along the channel dimension to obtain a total concatenated feature map. The total concatenated feature map is input into a 1×1 convolutional layer to generate a multi-channel weight map. The spatial size of the multi-channel weight map is the same as that of the unified feature map, and the number of channels is equal to the number of scales participating in the fusion. Softmax normalization is performed on the multi-channel weight map along the scale dimension to obtain a normalized weight map for each scale. The regional feature maps at each scale are multiplied element-wise with the corresponding normalized weight maps, and then the multiplied feature maps are added along the channel dimension to obtain the fused features.

[0011] Further, S4 includes: S41: performing convolution operations on the spatially weighted feature map using a first dilation rate and a second dilation rate respectively to obtain a first convolutional feature map and a second convolutional feature map, wherein the second dilation rate is the sum of the first dilation rate and the change in dilation rate; S42: performing average pooling and 1×1 convolution on the spatially weighted feature map in sequence to generate a spatial weight map; S43: performing weighted fusion of the first convolutional feature map and the second convolutional feature map based on the spatial weight map to obtain an enhanced feature map.

[0012] Further, in S42 and S43, the first convolutional feature map and the second convolutional feature map are subtracted element-wise to obtain a difference feature map; the spatial weighted feature map is sequentially subjected to average pooling and 1×1 convolution to generate an initial weight map; the difference feature map and the initial weight map are concatenated along the channel dimension and input into a 1×1 convolutional layer to generate a spatial weight map containing two channels, where the first channel corresponds to the fusion weight of the first dilatation rate and the second channel corresponds to the fusion weight of the second dilatation rate; the two channels of the spatial weight map are Softmax normalized so that the sum of the two weights at each spatial location is 1, resulting in a normalized first weight map and a normalized second weight map; the first convolutional feature map is multiplied element-wise with the first weight map, and the second convolutional feature map is multiplied element-wise with the second weight map, and then the two multiplied feature maps are added element-wise to obtain an enhanced feature map.

[0013] Furthermore, in S5, the multi-scale channel feature maps extracted in S1 are obtained, and the enhanced feature map and the multi-scale channel feature maps are weighted and summed to obtain the fused feature map, where the weighting coefficients are learnable parameters.

[0014] Furthermore, in S6, the fused feature map is input into the neck network, which performs multi-scale feature fusion on the fused feature map to obtain a multi-scale enhanced feature map. The multi-scale enhanced feature map is then input into the detection head, which contains a classification convolutional layer and a regression convolutional layer. The classification convolutional layer outputs the class probability at each location, and the regression convolutional layer outputs the target bounding box parameters at each location. The class probability and the target bounding box parameters are decoded and non-maximum suppression is applied to obtain the detection result of the mural target.

[0015] Furthermore, the backbone network, neck network, and detection head are all corresponding parts of the YOLOv8 network.

[0016] The present invention has at least the following beneficial effects: This invention employs a channel attention mechanism to weight multi-scale feature maps, enhancing the response of important channels. Simultaneously, it introduces a spatial attention mechanism to perform cross-scale feature fusion and affinity map calculation on downsampled regions, enabling the network to focus on key areas. The combined use of these two mechanisms effectively suppresses background interference such as decorative patterns and fading noise in mural images, significantly improving the distinction between the target and the background, thereby enhancing detection accuracy. Furthermore, this invention adaptively selects the dilation rate for convolution operations based on the spatial distribution of input features. When the target scale is small, the network prioritizes a small dilation rate to preserve local details; when the target scale is large, a large dilation rate is used to capture broader contextual information. This dynamic receptive field adjustment mechanism allows the model to flexibly adapt to multi-scale targets in murals, ranging from large main figures to small decorative patterns, improving detection robustness.

[0017] Other advantages, objectives and features of the present invention will become apparent in part from the following description, and in part from those skilled in the art through study and practice of the invention. Attached Figure Description

[0018] Figure 1 This is a framework diagram of an embodiment of this application. In the diagram, Conv is a convolutional layer, C2f is a cross-stage part (CSP) bottleneck module containing two convolutional operations, DDAP is a two-dimensional hybrid feature enhancement module, C is a concatenation operation, Upsample is upsampling, Backbone is the backbone network, Neck is the neck feature fusion network, Head is the detection head, and Detect is the detection module. Figure 1 The process is as follows: The input is a 640×640×3 mural image. It first enters the backbone network, where features are extracted and downsampled through multiple convolutions (Conv) and C2f modules, gradually reducing the image size from 640×640 to 320×320, 160×160, 80×80, 40×40, and 20×20, while simultaneously increasing the number of channels. At the end of the backbone network, DDAP is introduced to perform two-dimensional enhancement on the 20×20×512 features. Then, it enters the neck network, where the 80×80, 40×40, and 20×20 multi-scale features output from the backbone are fused across scales through upsampling and concatenation (C) operations, resulting in enhanced features of 80×80×768, 40×40×512, and 20×20×512. Finally, the data enters the detection head, which performs target detection through the detection module based on the fusion features at the three scales. The final output is a 640×640×3 detection result image with the same size as the input, thus completing the target recognition of the mural.

[0019] Figure 2 This is a diagram of the DDAP two-dimensional hybrid feature enhancement network architecture. In the diagram, MaxPool2d is a two-dimensional max pooling layer, ConvBNSiLU is a combination module of convolution + batch normalization + SiLU activation function, Scale-Att is a scale attention module, region partitioning is feature sub-region partitioning, Q is the query vector, and K... g V is the global key vector. g Let A be the global value vector (Value), Softmax be the Softmax activation function (used for weight normalization), and A be the global value vector (Value). r For region attention weights, Top-K is the Top-K selection operation, I rFor Top-K region features, O is the output feature, Conv(3×3, atrous=1) is a 3×3 dilated convolution (dilation rate of 1), AvgPool is average pooling, Conv(1×1) is a 1×1 convolution (used for channel transformation), Conv(3×3, atrous=3) is a 3×3 dilated convolution (dilation rate of 3), S is the scale attention weight, and IS is the complementary scale weight; Figure 2 The process is as follows: Input mural feature x, which first extracts basic features through the ConvBNSiLU module, then splits into two paths: One is the scale attention branch, which performs residual connections with the original features through three cascaded 2D max pooling layers (MaxPool2d), and then inputs it into the scale attention module (Scale-Att). This module generates scale weights S and complementary weights IS through average pooling (AvgPool), 1×1 convolution, and 3×3 convolutions with different dilation rates. These weights are then integrated after weighting the features from both convolutional paths to obtain multi-scale enhanced features. The other path is the region attention branch, which divides the features into regions and fuses them with the output of Scale-Att to generate a query vector Q and a global key vector K. g and global value vector V g ; through Q and K g The region attention weights A are obtained by combining matrix multiplication with the Softmax activation function. r And then with V g Weighted regional attention features are obtained; simultaneously, key regional features I are selected through Top-K selection. r This is further integrated with the region attention features, and the final output is O (spatial dimension enhancement features), which is used for subsequent network learning.

[0020] Figure 3 This diagram illustrates the spatial attention mechanism. In the diagram, MaxPool2d is a two-dimensional max pooling layer, ConvBNSiLU is a combination module of convolution, batch normalization, and SiLU activation function, Scale-Att is a scale attention module, Q is the query vector, and K... g V is the global key vector. g Let A be the global value vector, Softmax be the Softmax activation function, A be the attention weight matrix, and O be the output feature. Figure 3 The displayed process is as follows: Input mural feature x, first extract basic features through the ConvBNSiLU module, then perform multi-scale pooling through three two-dimensional max pooling layers (MaxPool2d) and perform residual connections with the original features, input to the scale attention module (Scale-Att) to enhance multi-scale representation. Subsequently, the enhanced features are divided into sub-regions, fused with the output of Scale-Att to generate query vector Q and global key vector K. gand global value vector V g ; through Q and K g The matrix multiplication combined with the Softmax activation function yields the attention weight matrix A, which is then multiplied by V. g The attention features are obtained by weighting, and finally O (spatial dimension enhancement feature) is output after feature integration operation, so as to focus on the key areas of the mural and improve the accuracy of subsequent detection. Detailed Implementation

[0021] The present invention will now be described in further detail so that those skilled in the art can implement it based on the description.

[0022] It should be understood that terms such as "having," "comprising," and "including" used in the embodiments of this application do not exclude the presence or addition of one or more other elements or combinations thereof. All directional indications (such as up, down, left, right, front, back, etc.) in the embodiments of this application are only used to explain the relative positional relationship and movement of components in a specific posture. If the specific posture changes, the directional indication will also change accordingly. When an element is referred to as "fixed to" or "set on" another element, it can be directly on the other element or may have an intervening element present. When an element is referred to as "connected to" another element, it can be directly connected to the other element or indirectly connected to the other element through an intervening element. Descriptions involving "first," "second," etc., in the embodiments of this application are for descriptive purposes only and should not be construed as indicating or implying their relative importance or implicitly specifying the number of indicated technical features. Therefore, a feature defined with "first" or "second" may explicitly or implicitly include at least one of those features.

[0023] It should be noted that the technical solutions of the various embodiments of this application can be combined with each other, but this must be based on the ability of those skilled in the art to implement them. When the combination of technical solutions is contradictory or cannot be implemented, it should be considered that such combination of technical solutions does not exist and is not within the scope of protection claimed by this application. In one embodiment, an image of the mural to be detected is acquired, such as a high-resolution image of the mural captured by a digital camera. The acquired mural image is preprocessed. The preprocessing operation may include adjusting the image size to a uniform size, for example, adjusting it to 640×640 pixels, and normalizing the pixel values. The preprocessed image is input into a backbone feature extraction network. This backbone network may adopt the Backbone part of the YOLOv8 network. Internally, it extracts multi-scale channel feature maps from the input image through a series of convolution and downsampling operations. These feature maps have different spatial resolutions and number of channels, for example, they may include feature maps of sizes of 80×80×256, 40×40×512, and 20×20×1024, used to characterize multi-level information of the image from details to semantics.

[0024] Next, the channel attention module performs global average pooling on the extracted multi-scale channel feature maps, compressing the feature map of each channel into a single value in the spatial dimension, thus obtaining a global descriptor for each channel. This descriptor is then processed through convolutional layers and activation functions to generate a set of weight coefficients, which reflect the importance of each channel to the target task. The generated weight coefficients are then multiplied channel-by-channel with the original multi-scale channel feature maps, i.e., multiplying the feature map of each channel by its corresponding weight coefficient, thereby strengthening important channels and suppressing less important channels, outputting a channel-weighted feature map.

[0025] After enhancing the features along the channel dimension, the spatial attention module downsamples the channel-weighted feature map, dividing it into multiple spatial regions. For each region, cross-scale feature fusion is performed to generate a query vector carrying multi-scale contextual information. Simultaneously, key and value vectors are generated from the downsampled feature map through convolution. Based on the query and key vectors, region-to-region affinity graphs are calculated to generate a routing index matrix, which records the positions of the most relevant key regions for each query region. The key and value vectors are indexed according to the routing index matrix, focusing attention computation on a small number of relevant regions. Then, a spatially weighted feature map is obtained through attention computation, which spatially enhances the feature responses of key target regions.

[0026] After obtaining the spatially weighted feature map, it is input into a gated convolutional module. This module first performs average pooling on the input feature map, and then generates a switching function through convolution. This switching function is used to adaptively select the dilation rate for the convolution operation. Specifically, based on the output value of the switching function, the receptive field of the convolution is dynamically adjusted at different spatial locations, thereby obtaining an enhanced feature map that can better adapt to the diversity of target scales in the mural.

[0027] The enhanced feature map is residually fused with the multi-scale channel feature map initially extracted from the backbone network to obtain a fused feature map. The residual fusion method can be weighted summation, allowing the model to enhance key features while preserving original information. Finally, the fused feature map is input into the detection head of the object detection network. The detection head contains classification and regression branches, which output the object class probability and bounding box parameters at each location, respectively. After decoding and non-maximum suppression processing, the detection results of each object in the mural image are obtained.

[0028] In existing technologies, target detection for cultural heritage images such as murals often employs methods based on general target detection frameworks, such as directly using networks like Faster R-CNN or YOLOv3 for training and inference. While these methods can extract basic features, they often fall short when dealing with images like murals—characterized by extremely complex backgrounds, large target scales, and rich detail and texture. This is due to their fixed receptive field and single feature dimension, leading to insufficient suppression of background noise, loss of edge details for large targets, and difficulty in effectively locating small targets. This embodiment introduces a multi-level feature enhancement mechanism involving channel attention, spatial attention, and gated convolution. This mechanism collaboratively strengthens key features from both channel and spatial dimensions and dynamically adjusts the receptive field according to the target scale, thereby more comprehensively addressing the complex characteristics of mural images and improving detection accuracy and robustness.

[0029] In one embodiment, the process of generating channel weight coefficients in step S2 can be implemented using a specific operational procedure. First, the input multi-scale channel feature map F is subjected to global average pooling in the spatial dimension H×W to obtain a channel descriptor F of size 1×1×C. avgEach value in this descriptor represents the global average response of the corresponding channel, condensing the overall information of that channel. Next, this channel descriptor is sequentially input into three layers: the first is a 1×1 convolutional layer, Conv1x1, which acts as a fully connected layer, compressing the number of channels, for example, to one-quarter of the original, to reduce subsequent computation; followed by a SiLU activation function layer, SiLU being a Sigmoid weighted linear unit, which introduces non-linearity and improves gradient flow; finally, a 1×1 convolutional layer, Conv2x2, restores the number of channels to the original C. After processing by these two convolutional layers and the activation function, each channel obtains its corresponding weight value. Then, the output value is mapped to the range of 0 to 1 using the Sigmoid function σ, forming the weight coefficient CA for each channel: CA = σ(Conv2x2(SiLU(Conv1x1(F)). avg The generated weight coefficients CA are multiplied element-wise with the input multi-scale channel feature map F along the channel dimension, i.e., F out =F×CA, thereby strengthening important channels and suppressing secondary channels, resulting in a channel-weighted feature map.

[0030] In existing technologies, attention mechanisms such as the SE module typically use global average pooling followed by two fully connected layers to generate channel weights. This embodiment replaces the fully connected layers with two 1×1 convolutional layers and introduces the SiLU activation function. This structure, while maintaining a small number of parameters, provides stronger nonlinear expressive power, making the generation of weight coefficients more accurate. Compared to directly using a single fully connected layer, the two-layer structure can learn more complex nonlinear relationships between channels, thus more effectively filtering out key channels in feature-rich images such as murals, improving the accuracy of subsequent detection.

[0031] In one embodiment, the processing flow of the spatial attention module in step S3 can be further refined into a series of ordered sub-steps to implement a region-to-region attention mechanism. First, in step S31, the input channel-weighted feature map is downsampled. This downsampling can be achieved using an average pooling layer, with the pooling kernel size set to 2×2 and a stride of 2, thereby reducing the size of the feature map to half of its original size; or the pooling kernel can be set to 4×4 with a stride of 4, reducing the size to one-quarter. The purpose of downsampling is to reduce the resolution of the feature map, reduce the number of regions in subsequent attention calculations, thereby reducing computational complexity, and expand the receptive field corresponding to each region, making region-level interactions more global, resulting in a downsampled feature map. Next, in step S32, two parallel 1×1 convolutional layers are applied to the downsampled feature map to generate a key vector K = X. r W k Sum vector V = Xr W v The number of input channels for these two convolutional layers is the same as the number of channels in the feature map. The number of output channels can be set as needed, for example, it can be set to the same number as the number of input channels or half that, to control the dimension of the attention head. The key vector is used to calculate the similarity with the query vector later, while the value vector carries the feature content to be aggregated.

[0032] Meanwhile, in step S33, to generate a query vector containing multi-scale information, it is necessary to perform cross-scale fusion of the region features at different scales after channel attention weighting. Specifically, the channel-weighted feature maps X output from multiple layers in the backbone network can be obtained. r (i,CA) , where i represents the i-th scale, such as a high-resolution feature map from a shallow layer and a low-resolution feature map from a deep layer. These feature maps are unified to the same spatial size through upsampling or downsampling operations, for example, uniformly adjusted to the same size as the downsampled feature map. Then, these unified feature maps from different scales are fused to obtain the fused feature map. Based on this fusion feature, a linear mapping is then applied. Generate a query vector Q. The channel dimension of Q can be kept consistent with K. This results in Q containing semantic information from different scales and enhanced with channel attention, enabling it to more comprehensively guide subsequent region matching.

[0033] In step S34, a region averaging operation is performed on the generated query vector Q and key vector K. Q and K can be spatially divided into several non-overlapping rectangular regions, for example, each region being 2×2 or 4×4 pixels in size. The average of all feature vectors within each region is then calculated to obtain the region-averaged query vector Q. r = mean(Q) and the regional average key vector K r =mean(K), and their shapes are ,in S1 is the number of regions, and S2 is the spatial size of the regions. That's the number of channels. Then, Q is calculated using matrix multiplication. r With K r The transpose of the given matrix yields an affinity matrix A. r = Q r (K r ) T , Each element represents the semantic similarity between a query region and a key region. This matrix reflects the relevance between different regions. In step S35, the affinity matrix A is... rSoftmax normalization is performed to obtain the normalized similarity distribution. Then, for each query region, the K most similar key regions are selected, and a Top-K operation is performed to generate the routing index matrix I. r = Top-K(Softmax(A r Here, K can be set to a small integer, such as 4 or 8. Routing index matrix I r It records the index position of the most relevant key region corresponding to each query region. A Softmax plus Top-K approach is used to ensure gradient continuity while achieving computational sparsity.

[0034] In step S36, the original key vector K and value vector V are indexed and aggregated according to the routing index matrix I^r to obtain K. g = gather(K, I r ) and V g = gather(V, I r Specifically, for each query region, all feature vectors within the corresponding region indicated by I^r are extracted from K and V and stored contiguously. This step reduces the scope of attention computation from the global region to a few relevant regions for each query region, thereby reducing computational cost.

[0035] Finally, in step S37, the query vector Q is compared with the indexed key vector K. g The indexed value vector V g Perform standard scaled dot product attention calculations to obtain the output feature O = Attention(Q, K). g V g The calculation process is as follows: First, calculate Q and K. g The attention weights are obtained by taking the dot product of the transpose of V and dividing by the scaling factor; then, Softmax normalization is applied to the attention weights; finally, the normalized weights are multiplied by V. g Multiplying and summing these features yields the output feature O, which is a spatially weighted feature map. This feature map aggregates features from the most relevant regions at each location, thereby enhancing the feature representation of key target regions.

[0036] This embodiment uses a region-to-region routing mechanism to first perform coarse-grained matching at the region level on the downsampled feature map, and then selects the most relevant regions through Top-K for fine-grained attention calculation. This significantly reduces computational complexity while ensuring that the long-distance context related to the semantics of the target region can be captured. In particular, by generating query vectors through cross-scale fusion, multi-scale information is incorporated into the region matching process, which helps to handle targets with large size variations.

[0037] In one embodiment, the specific method of cross-scale feature fusion in step S33 can be implemented using a detailed operational procedure. First, region feature maps of multiple scales are acquired. These feature maps can be feature maps from different layers of the backbone network that have already undergone channel attention weighting, for example, they can include shallow feature maps X with larger scales. r (1,CA), with a size of 80×80, and a smaller-scale deep feature map X r (2,CA), a feature map of size 40×40, and a smaller feature map X. r (3,CA), with a size of 20×20. To fuse them, these feature maps need to be unified to the same spatial size through upsampling or downsampling operations. Optionally, an intermediate scale can be chosen as the target size, for example, X... r (1,CA) downsampled to 40×40, X r The (3,CA) region is upsampled to 40×40, resulting in three feature maps of size 40×40. Then, global average pooling is performed on each of these uniformly sized feature maps to obtain a global feature vector for each scale. For example, for a 40×40 feature map, pooling yields a vector of length C. This global feature vector is then expanded by copying to restore it to the same spatial size as the corresponding feature map, generating a 40×40×C global feature map. The values ​​at each spatial location in this feature map are the same as the global average pooling result. Next, the original feature map at each scale is concatenated with its corresponding global feature map along the channel dimension to obtain an enhanced feature map for each scale, doubling the number of channels. This concatenation operation preserves both local detail information and incorporates global statistical information of the entire image, which is beneficial for subsequent fusion weight generation. Finally, all enhanced feature maps at all scales are concatenated along the channel dimension to form a total concatenated feature map, whose number of channels is the sum of the number of channels in each scale's enhanced feature map. The overall stitched feature map is input into a 1×1 convolutional layer. This layer learns the interaction relationships between channels and outputs a multi-channel weight map with the same spatial size as the unified size, for example, 40×40. The number of channels equals the number of scales involved in the fusion; for example, if there are 3 scales, a 3-channel weight map is output. Softmax normalization is performed on this multi-channel weight map along the scale dimension, that is, the three weight values ​​at each spatial location are normalized so that their sum is 1, resulting in a normalized weight map for each scale at each location. Finally, the original region feature maps X at each scale are... r(i,CA) is multiplied element-wise with the corresponding normalized weight map, and then the results of the multiplication are added along the channel dimension to obtain the final fused feature. This fused feature at each spatial location is the result of weighted summation of features at each scale according to adaptive weights, thus containing multi-scale information and being able to dynamically select the most suitable scale combination based on local content.

[0038] This embodiment generates a spatially adaptive weight map and uses Softmax normalization for weighted summation, enabling the network to dynamically determine the importance of each scale based on local image features. For example, for intricate decorative patterns in murals, the model may assign higher weights to shallow high-resolution features, while for large Buddha statues, it may assign higher weights to deep semantic features, thereby more accurately preserving useful information and improving detection accuracy.

[0039] In one embodiment, the implementation of the gated convolutional module in step S4 can be achieved by adaptively fusing the convolutional results with two different dilation rates. First, in step S41, the input spatially weighted feature map x is convolved with a first dilation rate r and a second dilation rate r + Δr. The first dilation rate r can be set to 1, i.e., standard convolution is performed. In this case, the receptive field is small, allowing for precise capture of local texture and edge details, resulting in the first convolutional feature map Conv(x,w,r). The second dilation rate can be set to the sum of the first dilation rate and the dilation rate variation. The dilation rate variation Δr can be set to 2, resulting in a second dilation rate of 3, performing dilated convolution. This significantly expands the receptive field, enabling the capture of a wider range of contextual semantic information, resulting in the second convolutional feature map Conv(x,w,r + Δr). Both convolutional operations can use the same kernel size, for example, 3×3. Then, in step S42, the input spatially weighted feature map x is sequentially subjected to average pooling and 1×1 convolution to generate a switching function S(x) = Conv(AvgPool(x), 1×1). The average pooling AvgPool can use a 5×5 pooling kernel with a stride of 1 and padding of 2 to maintain the same size. This operation can aggregate statistical information within the local neighborhood, providing a basis for subsequent weight generation. The 1×1 convolution maps the number of channels in the pooled feature map to 1, resulting in a single-channel initial weight map with the same spatial size as the input feature map, i.e., the switching function S(x). This switching function reflects the different spatial locations' preferences for receptive field size. Next, in step S43, the first and second convolutional feature maps are weighted and fused using this switching function to obtain the final enhanced feature map SAConv(x) = S(x)·Conv(x,w,r) + (1-S(x))·Conv(x,w,r+Δr).

[0040] This embodiment introduces a lightweight spatial adaptive weight generation mechanism, which can dynamically adjust the receptive field by adding only a few parameters. This allows the model to adaptively select the appropriate receptive field according to the size of the target, thereby better adapting to the drastic changes in the scale of the target in the mural.

[0041] In one embodiment, the weighted fusion method in step S43 can be implemented with a more refined operation. Specifically, the first convolutional feature map Conv(x,w,r) and the second convolutional feature map Conv(x,w,r+Δr) are subtracted element-wise to obtain a difference feature map, which captures the differences between the features under the two receptive fields. The difference feature map is concatenated with the switching function S(x) generated in step S42 along the channel dimension and then input into a 1×1 convolutional layer. This convolutional layer outputs spatial weight maps for two channels, corresponding to the fusion weights for the first and second dilatations, respectively. Then, the two channel weight maps are Softmax normalized so that the sum of the two weights at each spatial location is 1, resulting in the normalized first and second weight maps. Finally, the first convolutional feature map is multiplied element-wise with the first weight map, and the second convolutional feature map is multiplied element-wise with the second weight map. The two results are then added element-wise to obtain the enhanced feature map. This fusion method allows for a more refined blending of features from small and large receptive fields at each spatial location, based on local context. When local details of the target are important, the first weight map has a larger value; when a broader context is needed, the second weight map has a larger value. Introducing and concatenating difference feature maps before learning weights, compared to directly using the switching function S(x) to generate two weights, S(x) and 1-S(x), more fully utilizes the difference information between the two convolutional features, resulting in a more reasonable weight allocation.

[0042] This embodiment introduces a difference feature map and concatenates it with S(x), and then generates two weights through a learnable 1×1 convolution. This enables the network to comprehensively consider local contextual information and the differences between the two convolution results, thereby making more refined fusion decisions and further enhancing the model's adaptability to multi-scale targets.

[0043] In one embodiment, the residual fusion operation in step S5 can be implemented using a learnable weighting coefficient α. Specifically, the multi-scale channel feature map extracted from the backbone network in step S1 is obtained, denoted as x. inSimultaneously, the enhanced feature map, denoted as O, is obtained after processing steps S2 to S4. To combine the original features with the enhanced features, a learnable parameter α is introduced, which can be optimized through backpropagation during network training. The initial value of α can be set to 0.2, indicating that the enhanced features dominate in the initial stage, and the original features are added with a smaller weight. The fusion process is as follows: multiply the enhanced feature map O by α and the original feature map x. in By adding elements one by one, we obtain the fused feature map y = O + α·x in This residual connection method allows gradients to be directly propagated back to previous layers through the identity mapping branch, helping to alleviate the gradient vanishing problem in deep networks while preserving the integrity of the original features. If α is learned to be 0, it is equivalent to degenerating into purely augmented features; if α is learned to be a large positive value, the original features still contribute significantly to the final output. Through this learnable weighting, the network can adaptively balance the proportion of original and augmented information, preventing information distortion or overfitting caused by excessive augmentation.

[0044] In existing technologies, many feature enhancement modules combine enhanced features with original features through direct replacement or simple addition. For example, in CBAM, features weighted by channel and spatial attention are directly used as output, completely replacing the original features. This approach may lose some effective information from the original features, especially when the enhancement module is not perfect, potentially introducing noise or bias. This embodiment introduces learnable residual weighting coefficients, allowing the network to decide how much original information to retain, increasing the model's flexibility and robustness, contributing to stable training and improved final performance.

[0045] In one embodiment, the output process of the target detection result in step S6 can be further refined. First, the fused feature map obtained in step S5 is input into the neck network for multi-scale feature fusion. This neck network can adopt a feature pyramid structure, such as PANet, to fully fuse feature maps of different levels through a top-down upsampling path and a bottom-up downsampling path. Specifically, assuming there are three fused feature maps of different scales extracted from the backbone network, with sizes decreasing sequentially. The neck network first upsamples the large-size feature map, concatenates it with the second-largest feature map, and then convolves it to obtain a new feature map; then it upsamples this new feature map and concatenates it with the smallest-size feature map to obtain another feature map. Simultaneously, a bottom-up path can also be constructed: the smallest-size feature map is downsampled and concatenated with the middle-size feature map to obtain a new feature map; then it downsamples this new feature map and concatenates it with the largest-size feature map to obtain another feature map. Finally, three enhanced feature maps of different scales are output, which are used to detect small, medium, and large targets, respectively. Then, these multi-scale enhanced feature maps are input into the detection head. The detection head comprises classification and regression branches, each consisting of several convolutional layers. The classification branch's convolutional layers output the class probability at each location in the feature map. The number of classes can be set to 8, corresponding to the eight types of objects in the mural: Buddha, Bodhisattva, Buddha Mother, Vajra, Dharma Protector, Master, Offering Goddess, and Indian Great Master. The regression branch's convolutional layers output bounding box parameters at each location, typically including the center offset of the bounding box relative to the anchor box, width, and height scaling factors. During training, these outputs are compared with the ground truth annotations to calculate the loss. During inference, the outputs need to be decoded, i.e., the predicted box's specific coordinates on the original image are calculated based on the preset anchor boxes and regression parameters. After decoding, a large number of candidate boxes are obtained, which overlap significantly. Non-maximum suppression (NMS) is then used for post-processing. NMS can set the intersection-union ratio (IU) threshold to 0.5, sorting candidate boxes of the same class by confidence, retaining the highest-scoring box, and suppressing other boxes with excessive overlap. Finally, the class label and precise location of each object are output.

[0046] In one embodiment, the backbone, neck network, and detection head can be implemented using corresponding parts of the YOLOv8 network. Specifically, the backbone network can adopt the YOLOv8 Backbone, which is typically composed of multiple C2f modules and convolutional downsampling layers stacked together, enabling efficient extraction of multi-scale features from the image. The C2f module is a core building block in YOLOv8, enhancing gradient flow and feature reuse through branching and concatenation structures. The neck network can adopt the YOLOv8 Neck part, i.e., the PANet structure, which combines feature pyramids and path aggregation, enabling the transfer of deep semantic information to shallow layers while transferring shallow localization information to deep layers, achieving full multi-scale fusion. The detection head can adopt the decoupled head structure of YOLOv8, i.e., separating classification and regression branches, with each branch consisting of several convolutional layers, finally outputting the prediction result. YOLOv8 detection heads typically use a free-frame anchoring approach, directly predicting the target center point and dimensions, simplifying design and improving efficiency. The dual-channel feature enhancement module proposed in this invention is embedded into the YOLOv8 framework. Specifically, it can be placed after the feature map output by the backbone network and before it is fed into the neck network to enhance the multi-scale feature maps. This retains the original high-efficiency architecture of YOLOv8 while specifically addressing the difficulties in mural detection by introducing the enhancement module. The entire network can be trained end-to-end, and the loss function can use the default combination of YOLOv8 losses, including classification loss, regression loss, and confidence loss.

[0047] In existing technologies, YOLOv8, as an advanced object detector, has achieved excellent performance on various general datasets. However, when directly applied to murals, its performance is often limited due to the unique characteristics of mural images. This embodiment combines a specially designed dual-channel feature enhancement module with the mature architecture of YOLOv8. It leverages YOLOv8's efficient feature extraction and multi-scale fusion capabilities while compensating for its shortcomings in adapting to complex backgrounds and multi-scale targets through the enhancement module. This allows the improved network to more accurately detect various targets in murals while maintaining high inference efficiency.

[0048] The following is a description of a specific embodiment.

[0049] The overall network framework and DDAP module structure (channel attention module, spatial attention module, gated convolution module) are as follows: Figure 1 , Figure 2As shown, this invention uses the YOLOv8 object detection network as its basic framework and introduces the proposed DDAP dual-dimensional hybrid feature enhancement module (DDAP module) in its feature extraction and fusion stages. First, the input image is preprocessed and multi-scale channel feature maps are extracted by the backbone network. Then, these features are fed into the DDAP module, where a dynamic weight allocation mechanism adaptively adjusts the contribution of different channels, thereby strengthening the feature representation of key target regions. To balance local details and global contextual information, the DDAP module further incorporates a spatial attention mechanism on top of channel-dimensional attention, enhancing the network's ability to focus on target regions under complex background conditions. Simultaneously, the DDAP module uses gated convolution instead of traditional convolution operations, dynamically adjusting the receptive field size according to feature distribution, effectively adapting to targets with significant scale differences in murals. By embedding the DDAP module into the overall YOLOv8 detection framework, the network significantly improves object detection accuracy while maintaining inference efficiency, reducing missed detections and false detections, making it particularly suitable for target extraction tasks in complex scenes such as murals.

[0050] The core idea of ​​the DDAP dual-dimensional hybrid feature enhancement module is to first enhance the channel dimension of the feature map, then focus on the spatial dimension, and finally adapt to targets of different sizes through convolutional operations with adjustable receptive fields. This module is embedded after the backbone network and before the neck network to refine multi-scale feature maps. The first step is channel-dimensional feature enhancement. The channel attention module performs global average pooling on the input feature map in the spatial dimension, compressing the two-dimensional features of each channel into a single value, obtaining a global response description for each channel. This description is then passed through two convolutional layers, with an activation function performing a non-linear transformation in between. Finally, a function maps the output to the range of 0-1, generating weight coefficients for each channel. These weight coefficients are then multiplied channel-wise with the original feature map in the channel dimension, i.e., multiplying the feature map of each channel by the corresponding weight coefficient, thereby enhancing the feature responses of important channels and suppressing noise interference in unimportant channels, outputting a channel-weighted feature map. The second step is spatial-dimensional feature enhancement. The spatial attention module first downsamples the channel-weighted feature map, dividing it into multiple spatial regions. Next, key and value vectors are generated from the downsampled feature maps through convolution. The key vectors are used for subsequent similarity calculations, while the value vectors carry the feature content to be aggregated. To introduce multi-scale information into spatial attention, the module uniformly samples the channel-weighted feature maps from different layers of the autonomous backbone network to the same spatial size and generates a fused feature through a fusion operation. Then, a query vector is generated based on this fused feature through convolution, enabling the query vector to carry multi-scale contextual information. Next, region averaging is performed on the query vector and key vector respectively to obtain region-level queries and keys. The similarity between regions is calculated through matrix multiplication, resulting in an affinity matrix that reflects the semantic relevance between different regions. After normalizing the affinity matrix, the key regions with the highest similarity are selected for each query region to generate a routing index matrix. The original key and value vectors are indexed and clustered based on the routing index matrix, focusing subsequent attention calculations on a small number of most relevant regions. Finally, attention is calculated between the query vector and the indexed key and value vectors to obtain a spatially weighted feature map. This feature map aggregates features from the most relevant regions at each location, thereby strengthening the spatial representation of key target regions. The third step is the adaptive adjustment of the receptive field. The gated convolution module introduces a gated convolution mechanism. This module performs convolution operations on the input spatially weighted feature map using two different dilation rates. Convolutions with a smaller dilation rate have a smaller receptive field, which can capture local details more precisely; convolutions with a larger dilation rate have a larger receptive field, which can capture broader contextual information. Simultaneously, average pooling and convolution operations are performed on the input feature map in sequence to generate a spatial weight map. This weight map reflects the preference for receptive field size at different spatial locations.Using this spatial weight map, the convolution results with two different dilation rates are weighted and fused. This allows the network to adaptively select an appropriate receptive field at each spatial location based on the local content. When the target region is small, the weight of the convolution with a small dilation rate is larger; when the target region is large, the weight of the convolution with a large dilation rate is larger, ultimately outputting an enhanced feature map. The fourth step is residual fusion. The enhanced feature map is residually connected to the multi-scale channel feature map initially extracted from the backbone network, specifically through weighted summation, where the weighting coefficients are learnable parameters. The final fused feature map is then fed into the subsequent neck network and detection head to generate target detection results.

[0051] This invention establishes a self-built dataset of mural images. During the dataset preparation phase, to better suit object detection networks, we used a Python script to automatically crop the entire mural image into 640×640 images. Each image contains multiple main deity categories. Increasing the number of different categories within the same image increases the difficulty of model training and prevents overfitting. Due to the limited number of training samples, we used data augmentation methods to randomly select two categories from the original images for data augmentation. These methods included horizontal flipping, adjusting brightness (randomly multiplying by a factor of 0.8 to 1.2), applying Gaussian noise (noise intensity ranging from 5 to 15), and affine transformation (scaling from 90% to 110%), ultimately expanding the dataset to 3735 images.

[0052] This application uses the Labelme tool to annotate the images, classifying the deities in the murals into 8 categories. These are further divided into 6 categories based on their appearance and origin: Buddha, Bodhisattva, Buddha Mother, Vajra, Dharma Protector, and Master. There are also 2 categories for offering goddesses and Indian virtuous masters. The total number of images is as follows: 2859 Buddha images, 2046 Bodhisattva images, 2754 Buddha Mother images, 3246 Vajra images, 1266 Dharma Protector images, 7734 Master images, 960 offering goddess images, and 942 Indian virtuous masters.

[0053] This paper uses four parameters—P, R, mAP, and GFLOPs—as evaluation metrics for the model. P (Precision) is one of the important metrics for evaluating model performance in object detection algorithms. It is defined as the proportion of actually positive samples out of those predicted as positive, and the calculation formula is as follows: Where TP stands for True Positive Count, representing the number of correctly detected targets, and FP stands for False Positive Count, representing the number of falsely detected background or other objects. Precision reflects the accuracy of the model's predictions; a higher value indicates fewer false positives and more reliable detection results.

[0054] R (Recall) is the proportion of samples that are actually positive but were correctly predicted as positive. The formula for calculating it is as follows: Here, FN represents the number of false negatives, indicating the number of real targets that were not detected. Recall reflects the model's ability to cover targets; a higher value indicates fewer missed detections and a more comprehensive target detection. In target detection tasks, Recall is used in conjunction with Precision to comprehensively evaluate the model's accuracy and completeness.

[0055] mAP (Mean Average Precision) is a comprehensive metric used in object detection to measure the overall detection performance of a model. It is used to evaluate the balance between accuracy and recall across different classes and confidence thresholds. Calculating mAP first requires obtaining the Precision-Recall curves for each class at different IoU thresholds and calculating their average precision. Then, the average of the AP values ​​for all classes is taken as mAP. Where N is the number of categories, Let be the average precision of the i-th category.

[0056] FLOPs (Giga Floating Point Operations per Second) is an important metric for measuring the computational complexity and inference efficiency of deep learning models. It represents the total number of floating-point operations (in billions) required for the model to complete one forward inference. Higher FLOPs mean that the model requires more computational resources during inference, and the inference speed may be slower; lower FLOPs generally mean faster inference speed, but excessively low FLOPs may limit the model's feature extraction capabilities and detection accuracy.

[0057] YOLOv8 was chosen as the carrier for the DDAP feature enhancement module to quantitatively analyze its advantages. The following table compares nine representative YOLO series target detection methods and current mainstream two-stage target detection methods using the following five quantitative indicators: As can be seen, the models included in the comparison are YOLOv5n, YOLOX-tiny, YOLOv6n, YOLOv9n, YOLOv10n, YOLOv11n, YOLOv12n, YOLOv8-Ghost, YOLOv8n, and the classic two-stage detection model Faster-RCNN. The comparison metrics include five quantitative indicators: precision (P), recall (R), mean average precision (mAP@50), mAP@50:95, and computational complexity (FLOPs).

[0058] In terms of accuracy, the method of this application achieved an accuracy of 93.9%, which is basically on par with YOLOv8n's 94.7% and YOLOv6n's 94.5%, slightly higher than YOLOv11n's 93.2% and YOLOv9n's 92.1%, and significantly higher than YOLOv10n's 89.7%, YOLOv5n's 83.0%, and YOLOv12n's 78.1%. This indicates that this application maintains high detection accuracy while effectively controlling the false alarm rate.

[0059] In terms of recall, the method in this application achieved 92.4%, significantly higher than all comparable models except Faster-RCNN, including YOLOv11n (90.1%), YOLOv8n (90.5%), YOLOv9n (87.7%), YOLOv6n (86.5%), and YOLOv5n (82.2%). Although slightly lower than Faster-RCNN's 95.1%, considering that Faster-RCNN's computational complexity is as high as 134.3G, far exceeding the 7.7G of this application, the recall performance of this application is already excellent. The high recall indicates that this application has a low false negative rate for various targets in the mural, and can more comprehensively cover the target areas in the image.

[0060] In terms of the mAP@50 metric, this application achieved a top value of 96.9%, surpassing YOLOv8n's 96.5%, YOLOv11n's 95.4%, YOLOv6n's 95.1%, YOLOv9n's 93.0%, and Faster-RCNN's 95.8%. This metric comprehensively reflects the model's detection accuracy at commonly used IoU thresholds. Our application ranked first in this metric, indicating its optimal performance in balancing precision and recall.

[0061] In terms of the mAP@50:95 metric, this application achieved a top value of 80.2%, surpassing YOLOv8n's 79.6%, YOLOv11n's 78.1%, YOLOv9n's 78.8%, YOLOv6n's 78.0%, and Faster-RCNN's 76.9%. This metric places stricter requirements on the localization accuracy of bounding boxes. The leading advantage of this application in this aspect demonstrates that it can not only correctly classify targets but also more accurately locate their positions, showing better adaptability to targets with complex shapes and blurred edges in murals.

[0062] In terms of computational complexity, the method in this application requires only 7.7 G FLOPs, far lower than Faster-RCNN's 134.3 G, and also lower than YOLOv8n's 14.5 G, YOLOv9n's 13.9 G, YOLOv5n's 14.0 G, and YOLOv6n's 11.8 G. It is only slightly higher than YOLOv12n's 8.2 G and YOLOv8-Ghost's 8.8 G. This indicates that while significantly improving detection accuracy, this application does not introduce excessive computational burden, maintaining high inference efficiency and making it suitable for practical applications.

[0063] The above data comparison shows that the method in this application achieves the best results in both mAP@50 and mAP@50:95, while also leading in precision and recall, and with lower computational complexity than most comparative models. This result fully demonstrates that this application, by introducing a two-dimensional feature enhancement mechanism combining channel attention, spatial attention, and gated convolution, effectively solves the technical challenges of complex backgrounds, diverse target scales, and rich details in mural images. Without significantly increasing computational overhead, it achieves a comprehensive improvement in detection accuracy and robustness, representing a significant technological advancement compared to existing methods.

[0064] Although embodiments of the present invention have been disclosed above, they are not limited to the applications listed in the specification and embodiments. They can be applied to various fields suitable for the present invention. For those skilled in the art, other modifications can be easily made. Therefore, without departing from the general concept defined by the claims and their equivalents, the present invention is not limited to the specific details and illustrations shown and described herein.

Claims

1. A mural target detection method based on dual-channel feature enhancement, characterized in that, include: S1: Obtain the mural image to be detected, preprocess the mural image and input it into the backbone network to extract multi-scale channel feature maps; S2: Perform global average pooling on the multi-scale channel feature maps, generate weight coefficients for each channel through convolutional layers and activation functions, and weight the channel feature maps by channel to output the channel-weighted feature maps; S3: Downsample the channel-weighted feature map to segment it into multiple regions. After cross-scale feature fusion in each region, a query vector is generated. The query vector is then calculated with the key vector and value vector generated by the convolutional layer to perform region-to-region affinity graph calculation, generating a routing index matrix. Based on the routing index matrix, the key vector and value vector are indexed and then attention is calculated to obtain the spatially weighted feature map. S4: After performing average pooling on the spatial weighted feature map, a switching function is generated through a convolutional layer. The dilation rate is adaptively selected based on the output value of the switching function to perform convolution operations, thereby obtaining the enhanced feature map. S5: Residual fusion of the enhanced feature map with the multi-scale channel feature map is performed to obtain the fused feature map; S6: Input the fused feature map into the detection head of the target detection network and output the detection result of the mural target.

2. The mural target detection method based on dual-channel feature enhancement as described in claim 1, characterized in that, In S2, global average pooling is performed on the multi-scale channel feature maps in the spatial dimension to obtain channel descriptors of size 1×1×C, where C is the number of channels. The channel descriptors are then sequentially input into a 1×1 convolutional layer, a SiLU activation function layer, and another 1×1 convolutional layer, and then mapped to the weight coefficients of each channel by the Sigmoid function. The weight coefficients are multiplied by the multi-scale channel feature maps for each channel to obtain the channel-weighted feature maps.

3. The mural target detection method based on dual-channel feature enhancement as described in claim 1, characterized in that, S3 include: S31: Downsample the channel-weighted feature map and reduce the feature map size to 1 / 2 or 1 / 4 of the original size through average pooling to obtain the downsampled feature map; S32: Generate key vectors and value vectors from the downsampled feature maps using convolutional layers; S33: Cross-scale fusion of regional features at different scales after channel attention weighting is performed to obtain fused features, and query vectors are generated from the fused features through convolutional layers. S34: Perform regional averaging on the query vector and key vector respectively to obtain the regional average query vector and the regional average key vector. Calculate the affinity graph of the regional average query vector and the regional average key vector through matrix multiplication to obtain the affinity matrix. S35: After performing Softmax normalization on the affinity matrix, execute the Top-K operation to generate the routing index matrix; S36: Index the key vector and value vector according to the routing index matrix to obtain the indexed key vector and the indexed value vector; S37: Perform attention calculations on the query vector, the indexed key vector, and the indexed value vector to obtain a spatially weighted feature map.

4. The mural target detection method based on dual-channel feature enhancement as described in claim 3, characterized in that, In S33, the regional feature maps at each scale are unified to the same spatial size through upsampling or downsampling operations to obtain feature maps at each scale after unification. Global average pooling is then performed on the feature maps at each scale after unification to obtain global feature vectors for each scale. These global feature vectors are then expanded to the same spatial size as the corresponding feature maps to obtain global feature maps for each scale. The feature maps at each scale are then concatenated with their corresponding global feature maps along the channel dimension to obtain enhanced feature maps for each scale. Finally, the enhanced feature maps at all scales are concatenated along the channel dimension to obtain the final concatenated feature map. The total spliced ​​feature map is input into a 1×1 convolutional layer to generate a multi-channel weight map. The spatial size of the multi-channel weight map is the same as that of the unified feature map, and the number of channels is equal to the number of scales involved in the fusion. The multi-channel weight map is Softmax normalized in the scale dimension to obtain a normalized weight map for each scale. The regional feature map of each scale is multiplied element-wise with the corresponding normalized weight map, and then the multiplied feature maps are added along the channel dimension to obtain the fused feature.

5. The mural target detection method based on dual-channel feature enhancement as described in claim 1, characterized in that, S4 include: S41: Perform convolution operations on the spatial weighted feature map using the first dilation rate and the second dilation rate respectively to obtain the first convolution feature map and the second convolution feature map, wherein the second dilation rate is the sum of the first dilation rate and the change in dilation rate; S42: Perform average pooling and 1×1 convolution on the spatial weighted feature map in sequence to generate a spatial weight map; S43: The first convolutional feature map and the second convolutional feature map are weighted and fused according to the spatial weight map to obtain the enhanced feature map.

6. The mural target detection method based on dual-channel feature enhancement as described in claim 5, characterized in that, In S42 and S43, the first convolutional feature map and the second convolutional feature map are subtracted element-wise to obtain the difference feature map; the spatial weighted feature map is then subjected to average pooling and 1×1 convolution to generate the initial weight map; the difference feature map and the initial weight map are concatenated along the channel dimension and input into the 1×1 convolutional layer to generate a spatial weight map containing two channels, where the first channel corresponds to the fusion weight of the first dilatation rate and the second channel corresponds to the fusion weight of the second dilatation rate; Softmax normalization is applied to the two channels of the spatial weight map so that the sum of the two weights at each spatial location is 1, resulting in the normalized first weight map and second weight map. The first convolutional feature map is multiplied element-wise with the first weight map, and the second convolutional feature map is multiplied element-wise with the second weight map. Then, the two multiplied feature maps are added element-wise to obtain the enhanced feature map.

7. The mural target detection method based on dual-channel feature enhancement as described in claim 1, characterized in that, In S5, the multi-scale channel feature maps extracted in S1 are obtained. The enhanced feature map and the multi-scale channel feature maps are weighted and summed to obtain the fused feature map, where the weighting coefficients are learnable parameters.

8. The mural target detection method based on dual-channel feature enhancement as described in claim 1, characterized in that, In S6, the fused feature map is input into the neck network, which performs multi-scale feature fusion on the fused feature map to obtain a multi-scale enhanced feature map. The multi-scale enhanced feature map is then input into the detection head, which contains a classification convolutional layer and a regression convolutional layer. The classification convolutional layer outputs the class probability at each location, and the regression convolutional layer outputs the target bounding box parameters at each location. The class probability and target bounding box parameters are decoded and non-maximum suppression is applied to obtain the detection result of the mural target.

9. The mural target detection method based on dual-channel feature enhancement as described in claim 8, characterized in that, The backbone network, neck network, and detection head are all corresponding parts of the YOLOv8 network.