Intelligent detection method and system for surface diseases of ancient city wall based on deep learning
By employing self-calibrating illumination learning, edge information encoding, and time-frequency feature extraction modules, combined with bidirectional feature fusion and attention mechanisms, the problem of detecting ancient city wall defects in complex environments has been solved, achieving high-precision and stable defect identification.
Patent Information
- Application Number
- CN202511851583.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-10
- Publication Date
- 2026-03-06
AI Technical Summary
Existing technologies struggle to effectively identify surface defects on ancient city walls under complex lighting, texture interference, and multi-scale conditions. In particular, they suffer from low accuracy, high false negative rates, and unstable detection results in scenarios with low illumination, shadows, strong reflections, and small-scale defects.
A deep learning-based intelligent detection method for surface defects of ancient city walls is adopted. Image quality is improved by using a self-calibrated illumination learning module, an edge information encoding module, and a time-frequency feature extraction module. The method combines bidirectional path feature fusion with both top-down and bottom-up approaches, uses a cross-scale shared convolution module for defect identification, and introduces an attention mechanism to optimize feature fusion.
Maintaining stable detection accuracy under different lighting conditions significantly improves the ability to identify minor defects, enhances the accuracy of defect location and detection consistency, and improves the reliability and practicality of defect detection in ancient city walls.
Smart Images

Figure CN121616969A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image processing, specifically to a method and system for intelligent detection of surface defects on ancient city walls based on deep learning. Background Technology
[0002] Ancient city walls, exposed to the natural environment and human activities for extended periods, are prone to various damages on their surface, including salt efflorescence, vegetation buildup, crack propagation, weathering and powdering, and brick falling off. These problems not only damage the original appearance of the walls but can also lead to loosening of the brick structure, water seepage, and collapse, seriously jeopardizing the safety and sustainable protection of cultural heritage. Therefore, developing efficient, objective, and quantifiable disease detection technologies is crucial for the health diagnosis and scientific protection of ancient city walls.
[0003] Traditional methods for detecting defects in ancient city walls mainly include ground-penetrating radar (GPR), lidar, infrared thermal imaging, and manual inspection. Manual inspection relies on experience and judgment, resulting in low efficiency, high subjectivity, and difficulty in conducting large-scale, quantitative inspections. While infrared thermal imaging and GPR can detect internal defects, the equipment is expensive, operation is cumbersome, and sensitivity to minor surface defects is poor. LiDAR can acquire high-precision 3D point cloud data; however, the data volume is enormous, processing is complex, and automatic defect identification is challenging. In recent years, image processing and traditional machine learning methods have been used for defect identification, but they are significantly affected by changes in lighting, shadows, and complex textures, performing well only under single lighting conditions or in ideal environments. Overall, traditional methods are ill-suited to complex scenarios in natural environments, necessitating the development of an automated, non-contact detection technology based on deep learning to achieve accurate identification and intelligent monitoring of defects in ancient city walls.
[0004] The existing literature, "Application Research of Deep Learning in Surface Damage Detection of Ancient Buildings," discloses GreatWatcher, a cultural heritage damage detection system based on Mobile Crowdsourcing (MCS) and deep learning algorithms. This system combines mobile terminal data acquisition, a cloud database, and a deep learning algorithm based on Faster R-CNN to achieve rapid detection and localization of surface damage on the Great Wall's brick and stone structures. However, its model structure is complex, computationally intensive, and poorly adaptable to complex environments such as uneven lighting and strong reflections, making real-time on-site detection difficult.
[0005] The existing literature, "Non-destructive testing research on the surface damage faced by the Shanhaiguan Great Wall based on machine learning," proposes a non-destructive testing method based on the YOLOv4 model for surface defects of the Shanhaiguan Great Wall. This study utilizes UAV imagery data to automatically identify typical defects such as powdering, cracking, vegetation erosion, and efflorescence on the gray brick surface. However, its performance is unstable in low-light, shadowed, and small-scale defect detection scenarios, and its robustness to environmental changes is insufficient.
[0006] Furthermore, current methods for detecting defects in ancient city walls employ a multi-module cascaded structure, resulting in high model computational complexity. This leads to missed detections of small-target defects and limited research capabilities for identifying other types of defects such as cracks, weathering, and vegetation attachment.
[0007] Therefore, existing methods or systems have not been able to effectively solve the problem of detecting and identifying defects on the surface of ancient city walls under complex lighting, texture interference, and multi-scale conditions. In particular, in low-light, shadow occlusion, strong reflection, and small-scale defect scenarios, the identification accuracy is not high, the false negative rate is large, and the detection results are unstable. Summary of the Invention
[0008] To address the aforementioned technical shortcomings, the present invention aims to provide an intelligent detection method and system for surface defects of ancient city walls based on deep learning. This system addresses issues such as uneven illumination, texture interference, missed detection of multi-scale targets, and insufficient real-time performance in detecting defects on ancient city walls under complex environments.
[0009] To solve the above-mentioned technical problems, the present invention adopts the following technical solution: The present invention provides an intelligent detection method for surface defects of ancient city walls based on deep learning, comprising the following steps: S1. Input the original ancient city wall image into the backbone network, process the image through the self-calibration illumination learning module, and output an enhanced image with balanced illumination. S2. Input the enhanced image obtained in step S1 into the edge information encoding module and the time-frequency feature extraction module. The edge information encoding module strengthens the boundary information of the diseased area, and the time-frequency feature extraction module utilizes the complementary information of the time domain and frequency domain to improve the recognition ability of the missing brick boundary and vegetation texture, thereby obtaining a multi-scale enhanced feature map. S3. Input the multi-scale enhancement features obtained in step S2 into the neck network and perform feature fusion using a bidirectional path that is parallel to both top-down and bottom-up approaches. S4. Input the multi-scale feature maps obtained in steps S2 and S3 into the detection head. The input multi-scale feature maps are processed uniformly through a cross-scale shared convolution module, and normalization and decoupling are performed at the same time. Finally, the category label of the disease is output.
[0010] A deep learning-based intelligent detection system for surface defects in ancient city walls includes: The ancient city wall disease detection network consists of three parts: a backbone network, a neck network, and a detection head, and is used to detect surface diseases of the ancient city wall. The backbone network integrates a self-calibrating illumination learning module, a time-frequency feature extraction module, and an edge information encoding module. The neck network adopts a bidirectional feature fusion structure that combines top-down and bottom-up approaches and embeds an attention mechanism; The detection head adopts a lightweight structure based on cross-scale convolution computation sharing and normalization parameter decoupling.
[0011] Furthermore, the self-calibrating illumination learning module is based on Retinex, and the low-light image Y and the desired sharp image Z have the following relationship: ; Where X represents the illumination component. The symbol represents element-wise multiplication. The self-calibrating illumination learning module consists of an illumination estimation module. F and self-calibration module G composition.
[0012] Furthermore, the edge information encoding module includes: The Sobel-X operator in the Sobelconv dual-channel edge detection structure of the Sobel operator extracts spatial gradient features on the horizontal axis of the image, while the Sobel-Y operator captures feature changes on the vertical axis. The outputs of the Sobel-X and Sobel-Y operators are added pixel by pixel to obtain a comprehensive edge response map; Downsampling is performed using max pooling; After downsampling, a 1×1 convolution is used to map the edge features at each scale to the number of channels aligned with the backbone network and then fuse the edge information.
[0013] Furthermore, the fusion of edge information includes: By using a single 1×1 convolution, the edge features extracted by the Sobel operator are fused with the convolutional features of the backbone network at the same scale in the channel dimension, thereby enabling the interconnection of edge information and texture semantics. The spatial context of the fused features is extracted using 3×3 convolution, which enhances the perception of changes in the surface structure of the city wall; Perform a 1×1 convolution again to remap the channels, adjusting the fusion result to have the same number of channels as the subsequent network layers.
[0014] Furthermore, the time-frequency feature extraction module includes: The original Bottleneck unit in the C3k module is replaced with the FreqSpatial unit based on the FreqSpatial module structure, enabling C3k to have time-frequency joint modeling capability internally. When C3k=True, the C3k submodule in C3k2 is replaced with the C3k-FreqSpatial unit; When C3k=False, the original Bottleneck unit in C3k2 is directly replaced by the FreqSpatial unit.
[0015] Furthermore, the neck network includes: In the bottom-up path, deep semantic features are upsampled and fused with shallow high-resolution features to inject semantic information into the detailed features; In the top-down path, shallow detail features are downsampled and fused with deep features, and edge and texture information is fed back into semantic features; After each fusion node, an attention mechanism module is introduced to recalibrate the channel and spatial weights of the fused features, suppress irrelevant background, highlight diseased areas, and output multi-scale fused features.
[0016] Furthermore, the detection head includes: Receive feature maps of three different scales from the outputs of the backbone network and the neck network; A 1×1 convolutional module is introduced before each detection branch to perform channel alignment, so that feature maps of all scales have a consistent channel dimension before entering the shared computation unit. Feature maps of all scales are fed into a shared 3×3 convolutional module for feature extraction, achieving feature sharing and structure reuse; The detection head retains an independent BatchNorm and activation function module after each detection branch to decouple the normalization process, and superimposes a set of 3×3 convolutions with the BatchNorm and activation function module.
[0017] The beneficial effects of this invention are as follows: 1. This invention effectively solves the problem of loss of features in diseased areas caused by uneven illumination, and keeps the detection accuracy of the model stable under different illumination conditions.
[0018] 2. This invention enhances the multi-scale feature representation by jointly modeling temporal structure and frequency domain texture, which significantly improves the model's ability to identify subtle defects.
[0019] 3. This invention adopts a dual-path fusion mechanism of top-down and bottom-up and introduces an attention mechanism (CBAM) to optimize channel weights, so as to realize the collaborative expression of deep semantics and shallow texture, effectively improving the accuracy of disease location and detection consistency.
[0020] 4. The present invention exhibits small fluctuations and high stability in detection results under different scenarios, and can maintain high-precision identification under various natural lighting and background conditions, significantly improving the reliability and practicality of ancient city wall disease detection. Attached Figure Description
[0021] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0022] Figure 1 This is a schematic diagram of a deep learning-based intelligent detection system for surface defects of ancient city walls, provided as an embodiment of the present invention.
[0023] Figure 2 This is a schematic diagram of the overall structure of the self-calibrating illumination learning module.
[0024] Figure 3 This is a schematic diagram of the edge information encoding module.
[0025] Figure 4 This is a schematic diagram of the time-frequency feature extraction module.
[0026] Figure 5 This is a schematic diagram of the detection head.
[0027] Figure 6 This is a schematic diagram showing some vegetation diseases and missing bricks.
[0028] Figure 7 The images show the detection results for different models.
[0029] Figure 8 The images show the detection results in dark areas under low light conditions, in scenes with large sections of missing bricks, and in scenarios where vegetation and missing bricks coexist.
[0030] Figure 9 The image shows the test results in a scenario with complex surface textures, covered by withered vines, and exhibiting small-scale disease damage. Detailed Implementation
[0031] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0032] Example 1
[0033] This embodiment provides a deep learning-based intelligent detection method for surface defects on ancient city walls, including the following steps: S1. Input the original ancient city wall image into the backbone network, process the image through the self-calibration illumination learning module, and output an enhanced image with balanced illumination. S2. Input the enhanced image obtained in step S1 into the edge information encoding module and the time-frequency feature extraction module. The edge information encoding module strengthens the boundary information of the diseased area, and the time-frequency feature extraction module utilizes the complementary information of the time domain and frequency domain to improve the recognition ability of the missing brick boundary and vegetation texture, thereby obtaining a multi-scale enhanced feature map. S3. Input the multi-scale enhancement features obtained in step S2 into the neck network and perform feature fusion using a bidirectional path that is parallel to both top-down and bottom-up approaches. S4. Input the multi-scale feature maps obtained in steps S2 and S3 into the detection head. The input multi-scale feature maps are processed uniformly through a cross-scale shared convolution module, and normalization and decoupling are performed at the same time. Finally, the category label of the disease is output.
[0034] This embodiment takes the Nanjing Ming City Wall as an example and also provides a deep learning-based intelligent detection system for surface diseases of ancient city walls, CWADE-Net (City Wall Anomaly Detection Network). This intelligent detection system for surface diseases of ancient city walls consists of three parts: a backbone network, a neck network, and a head. The backbone network integrates a self-calibrated illumination network (SCI-Net), a time-frequency feature extraction module (C3k2-Freqspatial Module, C3k2-FSM), and an edge information encoding module (EIE). The three parts respectively complete the monitoring of falling blocks and vegetation invasion of the Ming City Wall from three stages: image quality optimization, time-frequency domain feature enhancement, and edge information enhancement, forming a Ming City Wall disease detection scheme with context guidance, multi-scale adaptability, and edge sensitivity. The network neck design employs a bidirectional fusion path combining top-down and bottom-up approaches, effectively integrating high-level abstract semantics with rich underlying textures. This guides the model to focus on the most discriminative feature channels and spatial regions for detecting diseases on the Ming Dynasty city wall. A lightweight Convolutional Block Attention Module (CBAM) is added after information fusion to enhance the identification capability of the city wall's diseases. In the network detection head, a lightweight structure based on cross-scale convolutional computation sharing and normalized parameter decoupling is introduced. This design effectively controls the number of model parameters while maintaining detection accuracy, thereby further improving the overall inference efficiency of the network. This intelligent detection system for surface diseases of the ancient city wall is highly compatible with the target features of vegetation attachment and missing bricks. It not only strengthens the model's understanding of textures and edges and improves its ability to focus on diseased areas, but also ensures efficient inference for both types of diseases through a lightweight detection head, providing solid technical support for the identification and scientific maintenance of diseases on the Nanjing Ming Dynasty city wall.
[0035] Specifically, the self-calibrating illumination learning module is based on Retinex, and the low-light image Y and the desired sharp image Z have the following relationship: Y=Z⨂X Where X represents the illumination component and ⨂ signifies element-wise multiplication, in the Nanjing Ming City Wall disease detection task, insufficient lighting in the Ming City Wall shooting environment often obscures the missing edges of bricks and the texture of vegetation diseases. SCI-Net uses iterative estimation of the illumination component to recover this ignored and obscured information. The overall structure of the self-calibrating illumination learning module is as follows: Figure 2 As shown, it consists of an illumination estimation module F and a self-calibration module G.
[0036] Preferably, this embodiment introduces an edge information encoding module into the backbone network, such as... Figure 3 The diagram shows its specific structure. The multi-scale edge information generation component on the left side of the edge information encoding module is based on the Sobelconv dual-channel edge detection structure of the Sobel operator. SobelConv is divided into two parts: the Sobel-X operator is dedicated to extracting spatial gradient features on the horizontal axis of the image, while the Sobel-Y operator is responsible for capturing feature changes on the vertical axis. The outputs of the two parts are added pixel by pixel to obtain a comprehensive edge response map. This dual-channel edge detection mechanism can effectively construct multi-scale edge representations, providing more discriminative geometric structural information for deep networks. To maximize the preservation of edge strength and avoid its dilution during downsampling, max pooling is used as the downsampling strategy. Max pooling can retain high response values in local regions, thereby highlighting edge features and suppressing the background, which is more conducive to the preservation of edge information than simple average pooling or direct downsampling. After downsampling, a 1×1 convolution maps the edge features of each scale to the number of channels aligned with the backbone network. This process removes irrelevant background interference while enhancing the outline of vegetation roots and the boundary of brick defects, providing a more reliable geometric basis for subsequent multi-scale fusion and accurate localization.
[0037] To further enhance the ability to express the characteristics of city wall defects, the edge information encoding module further integrates edge information. First, a 1×1 convolution is used to fuse the edge features extracted by the Sobel operator with the convolutional features of the same scale as the backbone network along the channel dimension, enabling the interconnection between edge information and texture semantics. Then, a 3×3 convolution is used to extract the spatial context of the fused features, strengthening the perception of changes in the city wall surface structure. Finally, a 1×1 convolution is performed again for channel remapping, adjusting the fusion result to the same number of channels as subsequent network layers, thus ensuring the stable transmission and effective utilization of edge information. This module can efficiently integrate multi-scale edge information into the backbone network, thereby improving the edge perception capability of the intelligent detection system for ancient city wall surface defects.
[0038] Preferably, to further enhance the ability of the intelligent detection system for surface defects of ancient city walls to identify targets with unclear edges and complex textures in the detection of defects in the Nanjing Ming City Wall, such as... Figure 5 As shown, the time-frequency feature extraction module includes: like Figure 4 (d) shows the specific structure of the time-frequency feature extraction module. Based on the structure of the Freqspatial module, the original Bottleneck unit in the C3k module is replaced with the following: Figure 4 (c) The FreqSpatial element enables C3k to have joint time-frequency modeling capability internally; When C3k=True, such as Figure 4 As shown in (a), the C3k submodule in C3k2 is replaced with C3k-FreqSpatial unit; When C3k=False, such as Figure 4 As shown in (b), the original Bottleneck element in C3k2 is directly replaced by the FreqSpatial element.
[0039] Preferably, to achieve high-quality feature integration under the complex background and diverse scale conditions of the Nanjing Ming City Wall, the neck network adopts a bidirectional fusion path that is parallel to both top-down and bottom-up approaches. CBAM attention is introduced after each fusion node to suppress irrelevant textures and highlight diseased areas. This design, on the one hand, injects deep semantics into high-resolution features step by step, and on the other hand, feeds back shallow edge and texture information to the deep representation, thereby simultaneously improving the detectability of both small-scale vegetation and large-scale landform fragments.
[0040] First, in the bottom-up path, starting with the lowest resolution and most semantically strongest feature L5 (20×20, 1024 channels), it is upsampled and aligned with the mesoscale feature L4 to 40×40. Then, through a time-frequency feature extraction module carrying time-frequency domain information, the number of channels is adjusted to 512 to obtain the mesoscale feature B4. Then, it is upsampled again to 80×80, consistent with the high-resolution layer, and the number of channels is adjusted to 256 through the time-frequency feature extraction module to obtain the high-resolution feature B3. This link injects deep semantics into higher-resolution features step by step from bottom to top. At the same time, the time-frequency domain modeling of the time-frequency feature extraction module suppresses background texture interference and strengthens structural boundaries.
[0041] In the top-down path, to supplement the semantically stronger deep representation with clear edge and texture cues, a 3×3 convolution with a stride of 2 is applied to the features after the second convolution of the backbone network to perform scale downsampling, resulting in A3 (80×80, 256 channels). To obtain a scale and channel configuration that matches L4 and L5, the 3×3 convolution with a stride of 2 is repeated to obtain A4 (40×40, 512 channels) and A5 (20×20, 1024 channels) respectively. This link transfers edge and texture cues from high resolution to low resolution, enabling the deep representation to maintain strong semantics while possessing better structural continuity and boundary discernibility.
[0042] During the data fusion phase, channel-dimensional concat operations were performed at three scales. At high resolution, A3 and B3 were concatenated with the sixth-layer output from the backbone network, which had the same resolution and number of channels, resulting in a fused feature of 80×80 and 256×3 channels. At medium resolution, A4 and B4 were concatenated with the ninth-layer output from the backbone network, resulting in a fused feature of 40×40 and 512×3 channels. At low resolution, the deepest layer output from the backbone network was concatenated with A5, resulting in a fused feature of 20×20 and 1024×2 channels. To focus the network's attention on channels and spatial regions more closely related to disease, a CBAM attention module was concatenated with each of the three fusion results to complete channel recalibration and spatial saliency enhancement. Finally, a C3k2-FSM module with time-frequency domain modeling capability is applied to the three-way fusion features to standardize the number of channels to 256 (80×80), 512 (40×40), and 1024 (20×20) before outputting them as the input of the continuous detection head.
[0043] Specifically, such as Figure 5 As shown, the detection head includes: The system receives three feature maps of different scales from the backbone and neck networks: P3 (stride=8), P4 (stride=16), and P5 (stride=32). Layer P3 has the highest spatial resolution and is mainly used to detect small targets, such as small-scale vegetation and hole diseases. Layer P4 achieves a balance between spatial information and semantic representation and is suitable for detecting medium-scale targets, such as local brick damage and structural defects. Layer P5 has the strongest semantic representation ability and is suitable for detecting large-scale targets, such as severely diseased areas with large-scale differences and large defects. Considering the differences in channel count and statistical distribution of feature maps at different scales, the detection head first introduces a 1×1 convolutional module before each detection branch for channel alignment. Subsequently, feature maps at all scales are uniformly fed into a shared 3×3 convolutional module for feature extraction. This unified shared convolutional design significantly reduces parameter redundancy and improves the model's efficiency in multi-scale detection tasks. At the same time, to avoid statistical interference between features at different scales during the normalization process, the detection head retains independent BatchNorm and activation function modules after each branch to decouple the normalization process, thereby improving numerical stability and training convergence. On this basis, a set of 3×3 convolutions is superimposed with BatchNorm and activation function modules to further expand the effective receptive field, enhance feature representation, and maintain training stability.
[0044] Example 2
[0045] This embodiment is the second embodiment of the present invention. Unlike the first embodiment, this embodiment provides a verification test of a method and system for intelligent detection of surface defects of ancient city walls based on deep learning, and verifies and explains the technical effects of the method.
[0046] This embodiment involves on-site image acquisition along the northeastern section of the Nanjing Ming City Wall, extending from Xuanwu Gate, through Jiefang Gate and Taiping Gate, to the Fugui Mountain section of the wall. Focusing on vegetation diseases and missing bricks, a dual-source acquisition method using a camera and a mobile phone was employed. The camera used was a Nikon D300, and the mobile phone was an Apple device. The acquisition covered various lighting conditions, including early morning, midday, and cloudy days, as well as multiple perspectives such as front, side, and overhead shots to enhance sample diversity and scene representativeness. All images were bounding box labeled using the LabelImg tool, categorized as vegetation diseases and missing bricks, and underwent quality control and consistency verification. A total of 2000 valid images were acquired and divided into training, validation, and test sets in an 8:1:1 ratio, with 1600, 200, and 200 images respectively. Figure 6 The images show some examples of vegetation diseases and missing bricks.
[0047] This experiment runs on Ubuntu 20.04 operating system, with an NVIDIA GeForce RTX3090 graphics card as the hardware environment, Visual Studio Code as the development platform, Python 3.8 as the programming language, PyTorch as the deep learning framework, and GPU acceleration based on CUDA 11.3. Table 1 shows the specific hyperparameter settings.
[0048] Table 1: Hyperparameter Settings
[0049] To verify the effectiveness of this invention in the task of detecting defects in city walls, this embodiment selects several advanced object detection models for comparative experiments under the same dataset and training parameter settings, including YOLOv8, YOLO11, RetinaNet, DINO, and Faster R-CNN. Figure 8 The visualization detection results of different models in typical disease scenarios are presented, and Table 2 shows their quantitative indicators on the Nanjing Ming City Wall disease dataset.
[0050] The comparative results show that although the precision of this invention is slightly lower than that of YOLOv8n and YOLO11n, its recall is significantly higher, resulting in a more balanced overall detection performance. In Table 2, the recall of this invention reached 82.8%, and the mAP50 index was 87.1%, 91.6%, and 89.3% for vegetation diseases, brick missing disease, and overall detection tasks, respectively, all at a high level. The same situation also exists... Figure 7 Presented in the visualization results: Figure 7 In (a) and 7(b), YOLOv8, RetinaNet, Faster R-CNN, and DINO all exhibited missed detections of small-scale vegetation, while the present invention effectively identified these small-scale targets. This indicates that the edge information encoding module of the present invention has a good enhancement effect on subtle boundary features, and the top-down branching of the neck network introduces high-resolution shallow information, enabling the model to maintain strong detection capabilities even in small target scenarios; Figure 7 In (c), YOLO11 and DINO missed some areas when detecting connected missing brick regions, while the detection frame of this invention basically matches the defect range. This effect is mainly due to the edge information encoding module highlighting the elongated gap features in the shallow stage and transmitting them to the deeper layers, while the time-frequency feature extraction module strengthens the long boundary of the defect region, enabling the model to stably identify large-area connected defect regions, thereby achieving complete coverage of connected missing brick regions; Figure 7 In (d), RetinaNet and DINO misclassified a whitish brick surface as missing, while this invention correctly identified it as a normal region. This is mainly due to the enhancement of surface frequency information by the time-frequency feature extraction module, enabling the model to effectively distinguish color differences from actual defects. Figure 7 (e) to Figure 7 In (g), YOLOv8, DINO, RetinaNet, and YOLO11 all showed missed detections of brick-missing defects, while this invention was able to maintain complete detection. This is mainly due to the enhancement of structural edge information by the edge information encoding module and the time-frequency feature extraction module, which enables the model to more accurately capture the boundary features of the missing brick area. The collaborative design of multiple modules allows the model to maintain a high detection rate in both small-scale vegetation and large-scale missing brick scenarios, thereby achieving a higher overall recall rate and mAP.
[0051] This invention achieves a reasonable balance between lightweight and high precision. Compared with large-scale models, this invention also maintains lower complexity and has better deployment friendliness. This invention achieves the best balance between accuracy, stability and efficiency, and is the most suitable model for the detection of defects in the Nanjing Ming City Wall.
[0052] Table 2: Detection accuracy of different models
[0053] To further verify the effectiveness of this invention in complex scenarios involving city walls, this embodiment conducted a qualitative experiment based on real-world photographic data of the Nanjing Ming City Wall. The results are as follows: Figure 8 and Figure 9 As shown, Figure 8As shown in (a) to (c), the missing edges of bricks and vegetation textures can still be clearly identified by the model in dark areas. In the heatmap, diseased areas show concentrated high response, while non-diseased areas remain low in activation, indicating that the model still possesses stable discrimination capabilities under insufficient lighting conditions. This result is closely related to the optimization of brightness and contrast by the illumination self-calibration enhancement module during the feature input stage, enabling the model to retain more structural and texture information, thus accurately focusing on diseased areas even in low-light environments; for example... Figure 8 As shown in (d) and (e), in the scenario of brick block defects, the detection results can be seen to cover a large area of defects well. The heat map also shows a continuous and consistent high-response distribution, which can accurately reflect the overall range of defects. This effect is mainly due to the edge information encoding module's ability to highlight the long strip-shaped gap features formed after the brick block falls off in the shallow stage and retain these features to pass them to deeper network layers. At the same time, the time-frequency feature extraction module strengthens the long boundary of the defect area during the feature extraction process, enabling the model to more stably identify large areas of connected defects, thereby ensuring the complete coverage of the block defects by the detection results. Figure 8 (f) and (g) show scenarios where vegetation and missing bricks coexist. The model provides clear bounding boxes for both types of disease areas, and the heatmaps show strong responses in both vegetation and missing brick areas, demonstrating good class differentiation capabilities. This result is attributed to the role of the CBAM attention mechanism in the feature fusion stage. On the one hand, it enhances the weights of feature channels highly correlated with the disease in the channel dimension; on the other hand, it highlights the locations of vegetation and missing bricks in the spatial dimension, enabling the model to simultaneously focus on and distinguish between two different types of disease areas in a complex context. Figure 9 Images (h) to (k) show areas with complex surface textures and covered by withered vines. It can be seen that the model can still correctly label the disease location despite background interference from vines and other elements. High-response areas in the heatmap are mainly concentrated at the edges of the defects rather than on the vine texture. This is primarily due to the time-frequency feature extraction module's simultaneous use of spatial edge information and frequency texture information during feature extraction, distinguishing high-frequency interference such as vines from real diseases. Simultaneously, the CBAM attention mechanism in the neck area further suppresses irrelevant background features, enabling the model to stably focus on the diseased area even under complex texture interference. Figure 9(k)~(n) include small-scale diseases such as fine vegetation and localized patchy lesions. The model can be seen to detect these tiny targets completely, and the heatmap shows clear and concentrated high-response areas, indicating that the model maintains strong sensitivity to fine-grained diseases. This capability is mainly due to the edge information encoding module's enhancement of subtle edge features in the shallow stage and its transmission to higher layers for utilization; simultaneously, the bidirectional feature fusion structure allows shallow edge and texture cues to be fully integrated with deep semantics, thus ensuring that the model can accurately locate small-scale diseases even in complex backgrounds.
[0054] The above are merely preferred embodiments of the present invention and are not intended to limit the present invention. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art can still modify the technical solutions described in the foregoing embodiments or make equivalent substitutions for some of the technical features. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A deep learning-based method for intelligent detection of surface diseases of ancient city walls, characterized in that, The method comprises the following steps: S1, inputting an original ancient city wall image to a backbone network, processing the image through a self-calibration light learning module, and outputting an enhanced image with balanced light; S2, inputting the enhanced image obtained in step S1 into an edge information coding module and a time-frequency feature extraction module, strengthening the boundary information of the disease area through the edge information coding module, and improving the recognition ability of the missing boundary of the brick and the texture of the vegetation through the time-frequency feature extraction module to obtain a multi-scale enhanced feature map; S3, inputting the multi-scale enhanced feature obtained in step S2 into a neck network, and adopting a top-down and bottom-up parallel bidirectional path for feature fusion; S4, inputting the multi-scale feature maps obtained in steps S2 and S3 into a detection head, uniformly processing the input multi-scale feature maps through a cross-scale shared convolution module, simultaneously performing normalization decoupling, and finally outputting the class label of the disease.
2. The system based on the deep learning-based ancient city wall surface disease intelligent detection method according to claim 1, characterized in that, It comprises: An ancient city wall disease detection network composed of a backbone network, a neck network and a detection head, used for detecting the surface diseases of the ancient city wall; The backbone network integrates a self-calibration light learning module, a time-frequency feature extraction module and an edge information coding module; The neck network adopts a bidirectional feature fusion structure combining top-down and bottom-up, and embeds an attention mechanism; The detection head adopts a lightweight structure based on cross-scale convolution calculation sharing and normalization parameter decoupling. 3.The deep learning-based ancient city wall surface disease intelligent detection system of claim 2, wherein, The self-calibration light learning module is based on Retinex, and there is a relationship between the low-light image Y and the expected clear image Z as follows: ; where X represents the illumination component, The symbol denotes element-wise multiplication, and the self-calibration illumination learning module is composed of an illumination estimation module F and a self-calibration module G . 4.The deep learning-based ancient city wall surface disease intelligent detection system of claim 2, wherein, The edge information coding module comprises: The Sobel-X operator in the double-channel edge detection structure Sobelconv of the Sobel operator extracts the spatial gradient features on the horizontal axis of the image, and the Sobel-Y operator captures the feature changes on the vertical axis; The Sobel-X operator and the Sobel-Y operator output are added pixel by pixel to obtain a comprehensive edge response map; Downsampling is performed by using maximum pooling; After downsampling, the edge features of each scale are mapped to the channel number aligned with the backbone network through a 1x1 convolution, and the edge information is fused.
5. The deep learning-based ancient city wall surface disease intelligent detection system according to claim 4, characterized in that, Fusing the edge information comprises: Through a 1x1 convolution, the edge features extracted by the Sobel operator are fused with the convolution features of the same scale of the backbone network in the channel dimension, so that the edge information and the texture semantics are interconnected; A 3x3 convolution is used to extract the spatial context of the fused features to strengthen the perception of the structure changes on the city wall surface; A 1x1 convolution is performed again to remap the channels to adjust the fusion result to the channel number consistent with the subsequent network level. 6.The deep learning-based ancient city wall surface disease intelligent detection system of claim 2, wherein, The time-frequency feature extraction module comprises: The original Bottleneck unit in the C3k module is replaced by a FreqSpatial unit based on the structure of the Freqspatial module, so that C3k has internal time-frequency joint modeling capability; When C3k=True, the C3k submodule in C3k2 is replaced by a C3k-FreqSpatial unit; When C3k is False, the original Bottleneck unit in C3k2 is directly replaced by FreqSpatial unit.
7. The deep learning-based ancient city wall surface disease intelligent detection system according to claim 2, characterized in that, The neck network comprises: In the bottom-up path, the deep semantic features are up-sampled and fused with the shallow high-resolution features to inject semantic information into the detail features; In the top-down path, the shallow detail features are down-sampled and fused with the deep features to backflow the edge and texture information into the semantic features; After each fusion node, an attention mechanism module is introduced to recalibrate the channel and spatial weight of the fused features, suppress irrelevant background and highlight the disease area, and output multi-scale fusion features. 8.The deep learning-based ancient city wall surface disease intelligent detection system of claim 2, wherein, The detection head comprises: receiving three feature maps of different scales output by the backbone network and the neck network; a 1x1 convolution module is introduced before each detection branch to perform channel alignment processing, so that all scale feature maps have consistent channel dimensions before entering the shared computing unit; all scale feature maps are sent to a shared 3x3 convolution module for feature extraction, realizing feature sharing and structure reuse; the detection head retains independent BatchNorm and activation function modules after each detection branch to realize the decoupling of the normalization process, and superimposes a group of 3x3 convolution and BatchNorm and activation function modules.